Position fixed is buggy with overflow:auto scrolling inside iframes
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jun 2019 16:39:34 +0000 (16:39 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jun 2019 16:39:34 +0000 (16:39 +0000)
commitea5b5b581c38b8d59c36391687daada00f41f772
tree54c756b7ed8d87dfd9314138c9e31072f04d71f5
parent068c9864c94b303667a122ce6e676ae1ba4d0cbf
Position fixed is buggy with overflow:auto scrolling inside iframes
https://bugs.webkit.org/show_bug.cgi?id=154399
<rdar://problem/24742251>

Reviewed by Frederic Wang and Simon Fraser.

Source/WebCore:

Test: scrollingcoordinator/ios/fixed-frame-overflow-swipe.html

After layer tree commit we were calling mainFrameViewportChangedViaDelegatedScrolling (even if viewport did not change)
and expecting it to apply UI side scrolling deltas. However optimization prevents it from descending into subframes
and we fail to update those properly.

In reality we only need to to apply scrolling tree positiong after commit if there has been delegated scrolling after the last
one. Track this and do full update when needed.

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::applyLayerPositionsAfterCommit):

Add specific function for this. Don't do anything unless needed.

* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::didScrollByDelegatedScrolling):

Track if there has been any delegated scrolling.

* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):

We can now bail out if nothing changes since we no longer rely on this for post-commit updates.

Source/WebKit:

* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

Remove viewportChangedViaDelegatedScrolling call as we were just relying on its side effect of (partially) applying
the scrolling tree. Instead call the new applyScrollingTreeLayerPositionsAfterCommit() unconditionally.
It only does work if there are local deltas to apply.

Local deltas will potentially need to be applied in non-fixed cases too and it is hard to reason about the conditions.

* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositionsAfterCommit):
(WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions): Deleted.
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:

LayoutTests:

* scrollingcoordinator/ios/fixed-frame-overflow-swipe-expected.html: Added.
* scrollingcoordinator/ios/fixed-frame-overflow-swipe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246156 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/scrollingcoordinator/ios/fixed-frame-overflow-swipe-expected.html [new file with mode: 0644]
LayoutTests/scrollingcoordinator/ios/fixed-frame-overflow-swipe.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingTree.cpp
Source/WebCore/page/scrolling/ScrollingTree.h
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h