Scroll latching logic can get stuck in 'scrollable="no"' iframes
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Mar 2015 22:52:27 +0000 (22:52 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Mar 2015 22:52:27 +0000 (22:52 +0000)
commit0d9397a8b8ee0600fc7de0c2c11fbc6049b4fad7
tree5b993e4aea0029e56e584e4e160c77b04fe39b22
parentf2924d8c35b180866cfdd16500454636353ece53
Scroll latching logic can get stuck in 'scrollable="no"' iframes
https://bugs.webkit.org/show_bug.cgi?id=142789
<rdar://problem/20129494>

Reviewed by Dean Jackson.

Clean up the EventHandler and latching code as follows:
(1) Do not handle iframe elements as part of the normal latching logic. Instead, iframes should
    be evaluated during the 'platformCompleteWheelEvent' phase of processing as top-level scrolling
    frames.
(2) Get rid of the ill-conceived notation that we should process non-mainframe and main-frame frames
    different.
(3) Modify code to reflect that the scroll latching code really deals with overflow scrolling. Consequently,
    the 'findEnclosingScrollableContainer' was renamed to 'findEnclosingOverflowScroll' and does not
    treat iframe as a suitable target.
(4) Do not create a latching state object when the container being evaluated is already scrolled to the
    extreme position in the direction of the mouse gesture. In this case, we want the enclosing frame
    to be the latching target.
(5) Do not treat the state where the mouse wheel gesture has ended manual scrolling, but has not ended
    momentum scrolling, as an appropriate time to select a latching target.

* page/EventHandler.cpp:
(WebCore::EventHandler::platformCompleteWheelEvent): Modify signature to remove unneeded argument.
(WebCore::EventHandler::handleWheelEvent): Modify call to 'platformCompleteWheelEvent' to remove unused argument.
* page/EventHandler.h:
* page/mac/EventHandlerMac.mm:
(WebCore::findEnclosingOverflowScroll): Renamed from 'findEnclosingScrollableContainer' and revised per the
notes above.
(WebCore::EventHandler::platformPrepareForWheelEvents): Remove mainFrame vs. non-mainFrame code paths and
consolidate logic.
(WebCore::EventHandler::platformCompleteWheelEvent): Remove unused argument. The wheel event target is no
longer needed here, now that iframes are not processed by this code.
(WebCore::findEnclosingScrollableContainer): Deleted.
* page/scrolling/ScrollLatchingState.cpp:
(WebCore::ScrollLatchingState::setPreviousWheelScrolledElement:) Switch to move operator for passing
a temporary RefPtr to the the function.
* page/scrolling/ScrollLatchingState.h:
* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::useLatchedEventElement): Recognize 'phase=ended, momentum=none' as a state
that should not cause latching state to be revised.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/page/mac/EventHandlerMac.mm
Source/WebCore/page/scrolling/ScrollLatchingState.cpp
Source/WebCore/page/scrolling/ScrollLatchingState.h
Source/WebCore/platform/PlatformWheelEvent.h