Bug 104427

Summary: WebViewClient::didHandleGestureEvent needs to distinguish the case if the event is processed or swallowed
Product: WebKit Reporter: Tien-Ren Chen <trchen>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, aelias, dglazkov, fishd, jamesr, tkent+wkapi, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Tien-Ren Chen 2012-12-07 18:59:46 PST
WebViewClient::didHandleGestureEvent needs to distinguish the case if the event is processed or swallowed
Comment 1 Tien-Ren Chen 2012-12-07 19:03:33 PST
Created attachment 178324 [details]
Patch
Comment 2 WebKit Review Bot 2012-12-07 19:06:01 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 Tien-Ren Chen 2012-12-07 19:08:39 PST
Created attachment 178325 [details]
Patch
Comment 4 WebKit Review Bot 2012-12-07 20:12:41 PST
Comment on attachment 178325 [details]
Patch

Attachment 178325 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15183654

New failing tests:
WebViewTest.ClientTapHandling
Comment 5 Darin Fisher (:fishd, Google) 2012-12-10 11:20:51 PST
Comment on attachment 178325 [details]
Patch

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

> Source/WebKit/chromium/public/WebViewClient.h:148
> +    enum EventStatus {

nit: It feels like this enum would be better at the top-level.  WebViewClient is already a big interface.

> Source/WebKit/chromium/public/WebViewClient.h:149
> +        EventStatusBubbledUp,

nit: Another name for EventStatusBubbledUp would be EventStatusUnprocessed or EventStatusNotProcessed, right?
Such a name might be easier to understand.  It was not obvious to me that "bubbled up" meant that WebKit
didn't handle the event.

Q: Are there cases where the event might get handled, but still propagate to another handler that would
then cancel further event propagation?
Comment 6 Tien-Ren Chen 2012-12-10 14:39:22 PST
(In reply to comment #5)
> (From update of attachment 178325 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=178325&action=review
> 
> > Source/WebKit/chromium/public/WebViewClient.h:148
> > +    enum EventStatus {
> 
> nit: It feels like this enum would be better at the top-level.  WebViewClient is already a big interface.

Do you mean move to the top-level and also to a separate header?
My thought is that put it under WebViewClient is good for namespace management. WebKit is probably a bigger interface than WebKit::WebViewClient right? :)

> > Source/WebKit/chromium/public/WebViewClient.h:149
> > +        EventStatusBubbledUp,
> 
> nit: Another name for EventStatusBubbledUp would be EventStatusUnprocessed or EventStatusNotProcessed, right?
> Such a name might be easier to understand.  It was not obvious to me that "bubbled up" meant that WebKit
> didn't handle the event.

Got it. Will change.

> Q: Are there cases where the event might get handled, but still propagate to another handler that would
> then cancel further event propagation?

I don't think so. If that's the case then we also need to move the didHandleGestureEvent hook point.
Personally I don't like the hook approach. A cleaner way would be looking at the return value from WebViewImpl::handleInputEvent. However I don't know what will be the side-effects if I change it that way.
Comment 7 Tien-Ren Chen 2012-12-10 16:25:54 PST
Created attachment 178664 [details]
Patch
Comment 8 Tien-Ren Chen 2012-12-20 16:41:44 PST
Ping. Do we need improvements other than mentioned above?
Comment 9 James Robinson 2013-01-02 14:03:41 PST
IMO it really doesn't make a lot of sense to have this on WebView-anything since input event handling is a WebWidget concept, not WebView.
Comment 10 Tien-Ren Chen 2013-01-08 18:00:28 PST
Created attachment 181814 [details]
Patch
Comment 11 Tien-Ren Chen 2013-01-08 18:04:48 PST
(In reply to comment #9)
> IMO it really doesn't make a lot of sense to have this on WebView-anything since input event handling is a WebWidget concept, not WebView.

It makes sense to move didHandleGestureEvent to WebWidgetClient. This new patch does it and I'm uploading a chromium patch to move corresponding handler from RenderViewImpl to RenderWidget.

I think we still need to handle passed-in events in WebViewImpl. After all we need someone to forward the events to the WebCore. Even if we can refactor the code to do the otherwise, it is out of the scope of this patch.
Comment 12 Adam Barth 2013-01-09 12:23:10 PST
Comment on attachment 181814 [details]
Patch

LGTM, but I'm not sure if jamesr or fishd have more comments.  Please give them a chance to comment before landing.
Comment 13 James Robinson 2013-01-09 14:42:24 PST
Comment on attachment 181814 [details]
Patch

Me likey!
Comment 14 WebKit Review Bot 2013-01-11 18:03:50 PST
Comment on attachment 181814 [details]
Patch

Clearing flags on attachment: 181814

Committed r139532: <http://trac.webkit.org/changeset/139532>
Comment 15 WebKit Review Bot 2013-01-11 18:03:56 PST
All reviewed patches have been landed.  Closing bug.