REGRESSION (iOS 13): Top fixed element on apple.com flickers in size while pinching in
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2019 20:18:07 +0000 (20:18 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2019 20:18:07 +0000 (20:18 +0000)
commit43fc19782f2aa7a214fc9efda4898093cef3228e
tree20a3cb5d4f96736e1b3ec9e6c5541a2b48dd4bbf
parent723672dcab58a56d69a588080eb952df61aa49a3
REGRESSION (iOS 13): Top fixed element on apple.com flickers in size while pinching in
https://bugs.webkit.org/show_bug.cgi?id=201668
rdar://problem/51934041

Reviewed by Frédéric Wang.

Source/WebCore:

When computing the new layout viewport rect in ScrollingTreeFrameScrollingNode, use
"StickToDocumentBounds" mode, not "StickToViewportBounds", because otherwise we'll compute
a layout viewport that has negative top/left offsets which causes fixed elements to jump outside
the viewport. The only code that should be moving things outside the viewport (a temporary effect
that happens when pinching) is the 'isBelowMinimumScale' path in WebPageProxy::computeCustomFixedPositionRect().

With this change ScrollingTreeFrameScrollingNode no longer needs m_behaviorForFixed; it can be removed later.

Not currently testable, since it involves pinching in past minimum zoom and transients state.

* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):

Source/WebKit:

The UI process can have transient state that pushes scrolling-tree-managed layers into custom
locations while pinch-zooming. We have to apply this state both when the visible rects
in the UI process change (existing code in -[WKContentView didUpdateVisibleRect:...]) and when
we get new layers from the web process (added in RemoteLayerTreeDrawingAreaProxy::commitLayerTree()
in this patch).

Move some code into WebPageProxy to create functions that we can call from both places.

For manual testing, visit a page with fixed banners, pinch in slightly, then pinch out and,
while keeping your fingers down, move the contents around.

* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::unconstrainedLayoutViewportRect const):
(WebKit::WebPageProxy::adjustLayersForLayoutViewport):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/WKContentView.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm