ScrollingTreeOverflowScrollingNodeIOS uses the wrong fixed position rectangle
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 08:08:17 +0000 (08:08 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 08:08:17 +0000 (08:08 +0000)
commit210a3f5d94ad29e95ea9a6e476a84f103fac8993
tree09ea783c62425cd1a539d806b5aa7280135e9144
parent66bcf632896cfecc8642d14967cc0c24463f9fae
ScrollingTreeOverflowScrollingNodeIOS uses the wrong fixed position rectangle
https://bugs.webkit.org/show_bug.cgi?id=175135

Patch by Frederic Wang <fwang@igalia.com> on 2017-08-04
Reviewed by Simon Fraser.

Source/WebCore:

This patch modifies ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll so
that it uses the fixed position rectangle relative of the first frame ancestor instead of
the one of the main frame. This makes it consistent with ScrollingTreeFrameScrollingNodeIOS
and RenderLayerCompositor. This fixes some flickering issues on iOS.

Test: fast/scrolling/ios/fixed-inside-overflow-inside-iframe.html

* page/scrolling/ScrollingTreeFrameScrollingNode.h:
(WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Helper function to get the
fixed position rect to use for that frame.
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::enclosingFrameNode const): Helper function to get the enclosing
frame for this scrolling node or null if there is none.
* page/scrolling/ScrollingTreeNode.h: Declare enclosingFrameNode.

Source/WebKit:

This patch modifies ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll so
that it uses the fixed position rectangle relative of the first frame ancestor instead of
the one of the main frame. This makes it consistent with ScrollingTreeFrameScrollingNodeIOS
and RenderLayerCompositor. This fixes some flickering issues on iOS.

* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll): Use the fixed
position rect of a non-main frame if there is one.

LayoutTests:

This patch adds a new test for a position:fixed element inside an overflow node inside an
iframe. When scrolling the overflow node, the position of such an element should remain fixed
relative to the inner frame. Before that change, ScrollingTreeOverflowScrollingNodeIOS used
to take the main frame as a reference instead, causing the element to flicker and even to
disappear when the user scrolls that overflow node. We add a reftest to verify that the
element is visible and positioned at the correct location when the user scrolls.

* fast/scrolling/ios/fixed-inside-overflow-inside-iframe-expected.html: Added.
* fast/scrolling/ios/fixed-inside-overflow-inside-iframe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/scrolling/ios/fixed-inside-overflow-inside-iframe-expected.html [new file with mode: 0644]
LayoutTests/fast/scrolling/ios/fixed-inside-overflow-inside-iframe.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h
Source/WebCore/page/scrolling/ScrollingTreeNode.cpp
Source/WebCore/page/scrolling/ScrollingTreeNode.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm