REGRESSION: (r181879): Scrolling in select/option region in iFrame scrolls both selec...
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 18:37:23 +0000 (18:37 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 18:37:23 +0000 (18:37 +0000)
commit16e55687c2d8133f2d149e8480a5163a05408bf7
treebea6732327119180b938d5603560f8289a4e881f
parent348597e9a03306199903919f83e09f161b0fbc49
REGRESSION: (r181879): Scrolling in select/option region in iFrame scrolls both select and iframe
https://bugs.webkit.org/show_bug.cgi?id=145574
<rdar://problem/20966828>

Reviewed by Simon Fraser.

Source/WebCore:

Tested by platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-select.html

When the scroll gesture is started when the latched scrollable container is not at the limit of its
scroll region, we are NOT supposed to propagate the scroll event to the enclosing region. However,
we were doing two things wrong:
(1) When we recognized we were latching, we were using the right wheel event target, but not using
    the latched scrollable container.
(2) Likewise, we were not using latched ScrollableArea when handling wheel events.

Instead, we were using the current scrollable container and ScrollableArea under the mouse pointer,
which could be different from the point we started latching as the content scrolled.

The fix was to properly track the scrollable container and scrollable area during latching.

I attempted to store the latched ScrollableArea in the latchingState object, like we already do for the
scrollable container, but found that this did not work properly. I think the life cycle of the
ScrollableArea may not match the scrollable container, and since they are not reference counted I
simply retrieve the ScrollableArea when needed.

* page/mac/EventHandlerMac.mm:
(WebCore::scrollableAreaForContainerNode): Helper function to return the correct ScrollableArea
for the two types of RenderBox elements.
(WebCore::latchedToFrameOrBody): Helper predicate to identify Frame and Body elements.
(WebCore::EventHandler::platformPrepareForWheelEvents): Use the correct ScrollableArea for the given
ContainerNode. When latching, make sure to use the ScrollableArea that is related to the latched scrollable
container, not the area currently underneath the mouse pointer.

LayoutTests:

* platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-select-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-select.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/select_iframe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185156 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-select-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-select.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/resources/select_iframe.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/mac/EventHandlerMac.mm