Bug 136029 - [Mac] Gesture scrolls don't work in the WebKit1 clients after scrolling a non-scrollable iFrame
Summary: [Mac] Gesture scrolls don't work in the WebKit1 clients after scrolling a non...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac All
: P1 Blocker
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on: 134569
Blocks: 136040
  Show dependency treegraph
 
Reported: 2014-08-17 14:02 PDT by Brent Fulgham
Modified: 2014-08-18 13:42 PDT (History)
6 users (show)

See Also:


Attachments
Patch (4.82 KB, patch)
2014-08-17 14:12 PDT, Brent Fulgham
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2014-08-17 14:02:03 PDT
Testing with various WebKit1 clients after my change for Iframe scroll gestures has revealed an edge case:

Under the following conditions:
1. A Cocoa application embeds a WebView using WK1.
2. The webview consists of an Iframe.
3. The Iframe size is the same as the WebView, so that there is no scrollable region.

If the user performs a scroll wheel gesture on the web view, other scrollable portions of the user interface become "locked up".
Comment 1 Brent Fulgham 2014-08-17 14:03:05 PDT
<rdar://problem/17767169>
Comment 2 Brent Fulgham 2014-08-17 14:05:01 PDT
Analysis indicates that WebKit is issuing two scrollWheel events during the handling of this gesture. The two events are intercepted at the OS level and result in some undesirable side effects that end up locking the view.

It looks like the nuance I missed in my earlier work was that although we bail out early when interacting with IFrames in the general case (under WK1), when we pass through the EventHandler::passWheelEventToWidget for an IFrame we actually DO dispatch the 'scrollWheel' event to the NSScrollView backing the IFrame.

This seems to set up the multiple-scrollWheel event condition found in Dictionary.app.

I think the correct fix is to recognize a WK1 case where the widget to which we just passed the wheel event is an frame view (IFrame), to not dispatch a second scrollWheel event by returning 'true' in this case.
Comment 3 Brent Fulgham 2014-08-17 14:12:46 PDT
Created attachment 236736 [details]
Patch
Comment 4 Sam Weinig 2014-08-17 14:27:18 PDT
Since this depends on host application logic, it might be a good candidate for a TestWebKitAPI test.
Comment 5 Maciej Stachowiak 2014-08-17 23:35:09 PDT
Comment on attachment 236736 [details]
Patch

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

> Source/WebCore/page/mac/EventHandlerMac.mm:923
> +    // If the platform widget is a frame view (IFrame), and we are in WebKit1, 'passWheelEventToWidget' has already
> +    // called 'scrollWheel' on the underlying platform widget. We need to return true in this case to avoid getting
> +    // multiple copies of the scrollWheel event sent to the platform widget.

IS such a long comment really necessary? I'd suggest no comment, or a one-liner stating the reason.
Comment 6 Brent Fulgham 2014-08-18 08:54:34 PDT
Committed r172703: <http://trac.webkit.org/changeset/172703>
Comment 7 Brent Fulgham 2014-08-18 08:55:08 PDT
(In reply to comment #5)
> (From update of attachment 236736 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=236736&action=review
> 
> > Source/WebCore/page/mac/EventHandlerMac.mm:923
> > +    // If the platform widget is a frame view (IFrame), and we are in WebKit1, 'passWheelEventToWidget' has already
> > +    // called 'scrollWheel' on the underlying platform widget. We need to return true in this case to avoid getting
> > +    // multiple copies of the scrollWheel event sent to the platform widget.
> 
> IS such a long comment really necessary? I'd suggest no comment, or a one-liner stating the reason.

OK! Fixed while landing.
Comment 8 Brent Fulgham 2014-08-18 08:55:36 PDT
See Bug 136040 for work on creating a TestWebKitAPI test for this condition.
Comment 9 Darin Adler 2014-08-18 09:32:50 PDT
Comment on attachment 236736 [details]
Patch

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

> Source/WebCore/page/EventHandler.cpp:2658
> +bool EventHandler::platformCompletePlatformWidgetWheelEvent(const PlatformWheelEvent&, const Widget*, ContainerNode*)

Since this can never be null, it should be a Widget& rather than a Widget*.
Comment 10 Brent Fulgham 2014-08-18 09:37:42 PDT
Comment on attachment 236736 [details]
Patch

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

>> Source/WebCore/page/EventHandler.cpp:2658
>> +bool EventHandler::platformCompletePlatformWidgetWheelEvent(const PlatformWheelEvent&, const Widget*, ContainerNode*)
> 
> Since this can never be null, it should be a Widget& rather than a Widget*.

Good point! I'll land this as a follow-up patch.
Comment 11 Brent Fulgham 2014-08-18 09:52:05 PDT
Added Darin's suggested clean-up:

Committed r172705: <http://trac.webkit.org/changeset/172705>
Comment 12 Brent Fulgham 2014-08-18 13:42:53 PDT
Correct a bad merge from my last change:

Committed in r172720. <http://trac.webkit.org/changeset/172720>