Bug 59715 - [GTK] Click counting logic should be shared between WebKit1 and WebKit2
Summary: [GTK] Click counting logic should be shared between WebKit1 and WebKit2
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P3 Normal
Assignee: Martin Robinson
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2011-04-28 10:57 PDT by Martin Robinson
Modified: 2011-04-29 05:33 PDT (History)
6 users (show)

See Also:


Attachments
Patch (21.77 KB, patch)
2011-04-28 11:10 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Robinson 2011-04-28 10:57:24 PDT
The click counting logic is currently duplicated for both ports. We should push this down into WebCore as a utility class. This has the added benefit of helping put WebKitWebView on a diet.
Comment 1 Martin Robinson 2011-04-28 11:10:07 PDT
Created attachment 91519 [details]
Patch
Comment 2 WebKit Review Bot 2011-04-28 11:13:22 PDT
Attachment 91519 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/platform/gtk/GtkClickCounter.cpp:80:  Use 0 instead of NULL.  [readability/null] [5]
Total errors found: 1 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Xan Lopez 2011-04-28 11:28:16 PDT
Comment on attachment 91519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=91519&action=review

Great stuff!

> Source/WebCore/platform/gtk/GtkClickCounter.cpp:23
> +#include <gdk/gdk.h>

I suppose this comes for free from gtk.h

> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:-339
> -

I actually object to this line being removed! Buurn.
Comment 4 Martin Robinson 2011-04-28 11:38:16 PDT
Committed r85214: <http://trac.webkit.org/changeset/85214>
Comment 5 WebKit Review Bot 2011-04-28 12:45:17 PDT
http://trac.webkit.org/changeset/85214 might have broken GTK Linux 64-bit Debug
Comment 6 Martin Robinson 2011-04-28 15:33:00 PDT
Comment on attachment 91519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=91519&action=review

> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:274
>      WebKitWebViewBasePrivate* priv = webViewBase->priv;
> -
>      priv->page->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */));

This was extra and I can omit it from the patch.
Comment 7 Carlos Garcia Campos 2011-04-28 23:46:29 PDT
Comment on attachment 91519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=91519&action=review

> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:-151
> -    priv->pageClient = PageClientImpl::create(GTK_WIDGET(webkitWebViewBase));

This line should not be removed.

> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:-268
> -    if (buttonEvent->button == 3) {
> -        // FIXME: [GTK] Add context menu support for Webkit2.
> -        // https://bugs.webkit.org/show_bug.cgi?id=54827
> -        notImplemented();
> -        return FALSE;
> -    }
> -

Why did you remove these lines? we haven't added support for context menus yet.
Comment 8 Martin Robinson 2011-04-29 05:25:35 PDT
Comment on attachment 91519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=91519&action=review

>> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:-151
>> -    priv->pageClient = PageClientImpl::create(GTK_WIDGET(webkitWebViewBase));
> 
> This line should not be removed.

Indeed. That was a mistake.

>> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:-268
>> -
> 
> Why did you remove these lines? we haven't added support for context menus yet.

That's correct, but I believe that an early return here prevents detecting double, triple, quadruple, etc third button clicks. If we need to generate context menu events, it should happen later in this method.
Comment 9 Carlos Garcia Campos 2011-04-29 05:33:57 PDT
(In reply to comment #8)
> (From update of attachment 91519 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=91519&action=review
> 
> >> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:-151
> >> -    priv->pageClient = PageClientImpl::create(GTK_WIDGET(webkitWebViewBase));
> > 
> > This line should not be removed.
> 
> Indeed. That was a mistake.

No problem, I already fixed it.

> >> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:-268
> >> -
> > 
> > Why did you remove these lines? we haven't added support for context menus yet.
> 
> That's correct, but I believe that an early return here prevents detecting double, triple, quadruple, etc third button clicks. If we need to generate context menu events, it should happen later in this method.

Patch for bug #54827 would remove those lines anyway.