After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679394 - Simplify ephy_window_dom_mouse_click_cb
Simplify ephy_window_dom_mouse_click_cb
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks: 679395
 
 
Reported: 2012-07-04 12:45 UTC by Carlos Garcia Campos
Modified: 2012-10-11 10:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (7.70 KB, patch)
2012-07-04 12:45 UTC, Carlos Garcia Campos
reviewed Details | Review
Updated patch (7.82 KB, patch)
2012-07-05 06:53 UTC, Carlos Garcia Campos
committed Details | Review

Description Carlos Garcia Campos 2012-07-04 12:45:39 UTC
Created attachment 218008 [details] [review]
Patch

That function is too complex and uses a lot of local variables that are only needed depending on the actual button pressed.
Comment 1 Carlos Garcia Campos 2012-07-04 12:46:59 UTC
Btw, this refactoring will help to port that code to webkit2
Comment 2 Xan Lopez 2012-07-04 15:45:43 UTC
Review of attachment 218008 [details] [review]:

Great cleanup in general, a few comments.

::: src/ephy-window.c
@@ +2108,3 @@
+	gboolean retval = FALSE;
+
+	if ((event->state & GDK_SHIFT_MASK) != GDK_SHIFT_MASK)

The original code checked that control was not pressed. Why did you drop it?

@@ +2136,3 @@
+	{
+		return retval;
+	}

Seems cleaner to have the rest of the method inside if (location) {} ... no point in having an early return so late ;)

@@ +2197,1 @@
 	}

I think you can just merge these two...
Comment 3 Carlos Garcia Campos 2012-07-05 06:34:00 UTC
(In reply to comment #2)
> Review of attachment 218008 [details] [review]:
> 
> Great cleanup in general, a few comments.
> 
> ::: src/ephy-window.c
> @@ +2108,3 @@
> +    gboolean retval = FALSE;
> +
> +    if ((event->state & GDK_SHIFT_MASK) != GDK_SHIFT_MASK)
> 
> The original code checked that control was not pressed. Why did you drop it?

Because it wasn't needed, we are not checking whether the flag is present, we are checking whether the result is exactly the mask or not.

> @@ +2136,3 @@
> +    {
> +        return retval;
> +    }
> 
> Seems cleaner to have the rest of the method inside if (location) {} ... no
> point in having an early return so late ;)

Ok.

> @@ +2197,1 @@
>      }
> 
> I think you can just merge these two...

Ok.
Comment 4 Carlos Garcia Campos 2012-07-05 06:53:32 UTC
Created attachment 218073 [details] [review]
Updated patch
Comment 5 Xan Lopez 2012-07-09 10:29:52 UTC
Review of attachment 218073 [details] [review]:

You are totally right about the shift/control thing of course. Looks great!