WebKit Bugzilla
Attachment 360322 Details for
Bug 192529
: Add nodes to the scrolling tree in z-index order.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192529-20190127231531.patch (text/plain), 75.75 KB, created by
Simon Fraser (smfr)
on 2019-01-27 23:15:31 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2019-01-27 23:15:31 PST
Size:
75.75 KB
patch
obsolete
>Subversion Revision: 240558 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 57c90ac0041c15326a3440a20e6486cac0496a85..175443500038211d78c35d2e0e88443ce4736902 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,69 @@ >+2019-01-27 Simon Fraser <simon.fraser@apple.com> >+ >+ Add nodes to the scrolling tree in z-index order. >+ https://bugs.webkit.org/show_bug.cgi?id=192529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tests: scrollingcoordinator/scrolling-tree/overflow-in-fixed.html >+ scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order.html >+ >+ * page/scrolling/ScrollingStateTree.cpp: >+ (WebCore::ScrollingStateTree::insertNode): >+ * page/scrolling/ScrollingTreeNode.cpp: >+ (WebCore::ScrollingTreeNode::~ScrollingTreeNode): >+ * platform/Logging.cpp: >+ (WebCore::initializeLogChannelsIfNecessary): >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::setParent): >+ (WebCore::RenderLayer::calculateClipRects const): >+ * rendering/RenderLayerBacking.cpp: >+ (WebCore::RenderLayerBacking::~RenderLayerBacking): >+ (WebCore::RenderLayerBacking::willBeDestroyed): >+ (WebCore::RenderLayerBacking::updateGeometry): >+ (WebCore::RenderLayerBacking::updateBackgroundLayer): >+ (WebCore::RenderLayerBacking::coordinatedScrollingRoles const): >+ * rendering/RenderLayerBacking.h: >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::RenderLayerCompositor::flushPendingLayerChanges): >+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush): >+ (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer): >+ (WebCore::frameHostingNodeForFrame): >+ (WebCore::RenderLayerCompositor::updateCompositingLayers): >+ (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): >+ (WebCore::RenderLayerCompositor::updateBacking): >+ (WebCore::RenderLayerCompositor::layerWillBeRemoved): >+ (WebCore::RenderLayerCompositor::setIsInWindow): >+ (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants): >+ (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const): >+ (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers): >+ (WebCore::RenderLayerCompositor::attachScrollingNode): >+ (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerWithRole): >+ (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer): >+ (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole): >+ (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): >+ (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole): >+ (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking): >+ (WebCore::RenderLayerCompositor::didAddScrollingLayer): >+ (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers): >+ (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer): >+ (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer): >+ (WebCore::LegacyWebKitScrollingLayerCoordinator::removeLayer): >+ (WebCore::LegacyWebKitScrollingLayerCoordinator::addViewportConstrainedLayer): >+ (WebCore::LegacyWebKitScrollingLayerCoordinator::removeViewportConstrainedLayer): >+ (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush): Deleted. >+ (WebCore::RenderLayerCompositor::setCompositingParent): Deleted. >+ (WebCore::RenderLayerCompositor::removeCompositedChildren): Deleted. >+ (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged): Deleted. >+ (WebCore::canCoordinateScrollingForLayer): Deleted. >+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Deleted. >+ (WebCore::enclosingScrollingNodeID): Deleted. >+ (WebCore::scrollCoordinatedAncestorInParentOfFrame): Deleted. >+ (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): Deleted. >+ (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): Deleted. >+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Deleted. >+ * rendering/RenderLayerCompositor.h: >+ > 2019-01-27 Michael Catanzaro <mcatanzaro@igalia.com> > > Unreviewed, fix WPE/GTK debug builds after r240557 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d93f9222892c3b5fa7a1195611a552d7e430bba7..dd33565869d647412bc7ccb456bb82d8e03cb2bf 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,15 @@ >+2019-01-27 Simon Fraser <simon.fraser@apple.com> >+ >+ Add nodes to the scrolling tree in z-index order. >+ https://bugs.webkit.org/show_bug.cgi?id=192529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Platform/Logging.cpp: >+ (WebKit::initializeLogChannelsIfNecessary): >+ * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: >+ (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Replace many uses of String::format with more type-safe alternatives >diff --git a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp b/Source/WebCore/page/scrolling/ScrollingStateTree.cpp >index d5456984ae6263e263ccd31d932261ea074826a1..4c8306bd713ec33e842df653d1e594c23613cc31 100644 >--- a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp >+++ b/Source/WebCore/page/scrolling/ScrollingStateTree.cpp >@@ -153,6 +153,7 @@ ScrollingNodeID ScrollingStateTree::insertNode(ScrollingNodeType nodeType, Scrol > > ScrollingStateNode* newNode = nullptr; > if (!parentID) { >+ RELEASE_ASSERT(nodeType == ScrollingNodeType::MainFrame); // Need to avoid type confusion. > ASSERT(!childIndex || childIndex == notFound); > // If we're resetting the root node, we should clear the HashMap and destroy the current children. > clear(); >diff --git a/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp b/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp >index 0503cdb26caf7a20d1d1e10d22f6588503b54213..7857a639fb221275e40b4f39c030eee50b36a755 100644 >--- a/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp >+++ b/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp >@@ -42,7 +42,11 @@ ScrollingTreeNode::ScrollingTreeNode(ScrollingTree& scrollingTree, ScrollingNode > { > } > >-ScrollingTreeNode::~ScrollingTreeNode() = default; >+ScrollingTreeNode::~ScrollingTreeNode() >+{ >+// if (m_nodeID == 5) >+// WTFLogAlways("ScrollingTreeNode %llu dtor", m_nodeID); >+} > > void ScrollingTreeNode::appendChild(Ref<ScrollingTreeNode>&& childNode) > { >diff --git a/Source/WebCore/platform/Logging.cpp b/Source/WebCore/platform/Logging.cpp >index aec586696fb5eee1931b7fb815e1465d444e1022..69a1605411879a3e61242d8d74dc95c1691b327d 100644 >--- a/Source/WebCore/platform/Logging.cpp >+++ b/Source/WebCore/platform/Logging.cpp >@@ -78,6 +78,7 @@ void initializeLogChannelsIfNecessary(Optional<String> logChannelString) > > String enabledChannelsString = logChannelString ? logChannelString.value() : logLevelString(); > WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, enabledChannelsString.utf8().data()); >+// LogScrolling.state = WTFLogChannelOn; > } > > WTFLogChannel* getLogChannel(const String& name) >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index 8c4d7f1ea565418098c62474fa5668dcf49d627d..224bd9994bf88c80f6c91d48a4e68b7e77cd8d1b 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -603,7 +603,7 @@ void RenderLayer::setParent(RenderLayer* parent) > > if (m_parent && !renderer().renderTreeBeingDestroyed()) > compositor().layerWillBeRemoved(*m_parent, *this); >- >+ > m_parent = parent; > > if (m_parent && !renderer().renderTreeBeingDestroyed()) >@@ -5913,8 +5913,13 @@ RenderLayerBacking* RenderLayer::ensureBacking() > > void RenderLayer::clearBacking(bool layerBeingDestroyed) > { >- if (m_backing && !renderer().renderTreeBeingDestroyed()) >+ if (!m_backing) >+ return; >+ >+ if (!renderer().renderTreeBeingDestroyed()) > compositor().layerBecameNonComposited(*this); >+ >+ m_backing->willBeDestroyed(); > m_backing = nullptr; > > if (!layerBeingDestroyed) >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index f669c9122bc5b469f253921b9bb42524db0f9e5b..f4de5ec5f4137e06027056696eddb5d38d1df820 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -236,6 +236,7 @@ RenderLayerBacking::RenderLayerBacking(RenderLayer& layer) > > RenderLayerBacking::~RenderLayerBacking() > { >+ // Note that m_owningLayer->backing() is null here. > updateAncestorClippingLayer(false); > updateChildClippingStrategy(false); > updateDescendantClippingLayer(false); >@@ -244,10 +245,20 @@ RenderLayerBacking::~RenderLayerBacking() > updateBackgroundLayer(false); > updateMaskingLayer(false, false); > updateScrollingLayers(false); >- detachFromScrollingCoordinator({ ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained, ScrollCoordinationRole::FrameHosting }); >+ >+ ASSERT(!m_viewportConstrainedNodeID); >+ ASSERT(!m_scrollingNodeID); >+ ASSERT(!m_frameHostingNodeID); >+ > destroyGraphicsLayers(); > } > >+void RenderLayerBacking::willBeDestroyed() >+{ >+ ASSERT(m_owningLayer.backing() == this); >+ compositor().removeFromScrollCoordinatedLayers(m_owningLayer); >+} >+ > void RenderLayerBacking::willDestroyLayer(const GraphicsLayer* layer) > { > if (layer && layer->type() == GraphicsLayer::Type::Normal && layer->tiledBacking()) >@@ -1246,8 +1257,6 @@ void RenderLayerBacking::updateGeometry() > > if (subpixelOffsetFromRendererChanged(oldSubpixelOffsetFromRenderer, m_subpixelOffsetFromRenderer, deviceScaleFactor()) && canIssueSetNeedsDisplay()) > setContentsNeedDisplay(); >- >- compositor().updateScrollCoordinatedStatus(m_owningLayer, { RenderLayerCompositor::ScrollingNodeChangeFlags::Layer, RenderLayerCompositor::ScrollingNodeChangeFlags::LayerGeometry }); > } > > void RenderLayerBacking::updateAfterDescendants() >@@ -1643,12 +1652,8 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer) > } > } > >- if (layerChanged) { >+ if (layerChanged) > m_graphicsLayer->setNeedsDisplay(); >- >- if (m_backgroundLayerPaintsFixedRootBackground) >- compositor().fixedRootBackgroundLayerChanged(); >- } > > return layerChanged; > } >@@ -1767,6 +1772,23 @@ bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers) > return true; > } > >+OptionSet<ScrollCoordinationRole> RenderLayerBacking::coordinatedScrollingRoles() const >+{ >+ auto& compositor = this->compositor(); >+ >+ OptionSet<ScrollCoordinationRole> coordinationRoles; >+ if (compositor.isViewportConstrainedFixedOrStickyLayer(m_owningLayer)) >+ coordinationRoles.add(ScrollCoordinationRole::ViewportConstrained); >+ >+ if (compositor.useCoordinatedScrollingForLayer(m_owningLayer)) >+ coordinationRoles.add(ScrollCoordinationRole::Scrolling); >+ >+ if (compositor.isLayerForIFrameWithScrollCoordinatedContents(m_owningLayer)) >+ coordinationRoles.add(ScrollCoordinationRole::FrameHosting); >+ >+ return coordinationRoles; >+} >+ > void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole> roles) > { > if (!m_scrollingNodeID && !m_frameHostingNodeID && !m_viewportConstrainedNodeID) >diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h >index f7c89d6a4143f7f7714efc66643f34fb9b6bccdc..635a78893c5ea8704dd36a8f4d7078f14d673956 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.h >+++ b/Source/WebCore/rendering/RenderLayerBacking.h >@@ -64,6 +64,9 @@ public: > void layerWillBeDestroyed(); > #endif > >+ // Do cleanup while layer->backing() is still valid. >+ void willBeDestroyed(); >+ > RenderLayer& owningLayer() const { return m_owningLayer; } > > void updateConfigurationAfterStyleChange(); >@@ -100,13 +103,15 @@ public: > > bool requiresBackgroundLayer() const { return m_requiresBackgroundLayer; } > void setRequiresBackgroundLayer(bool); >- >+ > bool hasScrollingLayer() const { return m_scrollingLayer != nullptr; } > GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); } > GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); } > >+ OptionSet<ScrollCoordinationRole> coordinatedScrollingRoles() const; >+ > void detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole>); >- >+ > ScrollingNodeID scrollingNodeIDForRole(ScrollCoordinationRole role) const > { > switch (role) { >@@ -119,7 +124,7 @@ public: > } > return 0; > } >- >+ > void setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollCoordinationRole role) > { > switch (role) { >@@ -135,7 +140,7 @@ public: > break; > } > } >- >+ > ScrollingNodeID scrollingNodeIDForChildren() const > { > return m_frameHostingNodeID ? m_frameHostingNodeID : (m_scrollingNodeID ? m_scrollingNodeID : m_viewportConstrainedNodeID); >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index 3defc8ac8f8390ae7cfc5ed9e48a1352f5198c63..4e69a997f84b8cdb75418d387f07c9a6a290f58c 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -104,6 +104,11 @@ static const Seconds throttledLayerFlushDelay { 500_ms }; > > using namespace HTMLNames; > >+struct ScrollingTreeState { >+ Optional<ScrollingNodeID> parentNodeID; >+ size_t nextChildIndex { 0 }; >+}; >+ > class OverlapMapContainer { > public: > void add(const LayoutRect& bounds) >@@ -490,9 +495,9 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot) > ASSERT(m_flushingLayers); > } > >+#if PLATFORM(IOS_FAMILY) > updateScrollCoordinatedLayersAfterFlushIncludingSubframes(); > >-#if PLATFORM(IOS_FAMILY) > if (isFlushRoot) > page().chrome().client().didFlushCompositingLayers(); > #endif >@@ -501,6 +506,7 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot) > startLayerFlushTimerIfNeeded(); > } > >+#if PLATFORM(IOS_FAMILY) > void RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlushIncludingSubframes() > { > updateScrollCoordinatedLayersAfterFlush(); >@@ -517,38 +523,38 @@ void RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlushIncludingSubf > > void RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush() > { >- updateCustomLayersAfterFlush(); >- >- HashSet<RenderLayer*> layersNeedingUpdate; >- std::swap(m_scrollCoordinatedLayersNeedingUpdate, layersNeedingUpdate); >- >- for (auto* layer : layersNeedingUpdate) >- updateScrollCoordinatedStatus(*layer, ScrollingNodeChangeFlags::Layer); >-} >- >-void RenderLayerCompositor::updateCustomLayersAfterFlush() >-{ >-#if PLATFORM(IOS_FAMILY) > if (m_legacyScrollingLayerCoordinator) { >- m_legacyScrollingLayerCoordinator->registerAllViewportConstrainedLayers(*this, m_scrollCoordinatedLayers); >+ m_legacyScrollingLayerCoordinator->registerAllViewportConstrainedLayers(*this); > m_legacyScrollingLayerCoordinator->registerScrollingLayersNeedingUpdate(); > } >-#endif > } >+#endif > >-void RenderLayerCompositor::didChangePlatformLayerForLayer(RenderLayer& layer, const GraphicsLayer* graphicsLayer) >+void RenderLayerCompositor::didChangePlatformLayerForLayer(RenderLayer& layer, const GraphicsLayer*) > { >- if (m_scrollCoordinatedLayers.contains(&layer)) >- m_scrollCoordinatedLayersNeedingUpdate.add(&layer); >- > #if PLATFORM(IOS_FAMILY) > if (m_legacyScrollingLayerCoordinator) > m_legacyScrollingLayerCoordinator->didChangePlatformLayerForLayer(layer); > #endif > >+ auto* scrollingCoordinator = this->scrollingCoordinator(); >+ if (!scrollingCoordinator) >+ return; >+ > auto* backing = layer.backing(); >- if (backing->backgroundLayerPaintsFixedRootBackground() && graphicsLayer == backing->backgroundLayer()) >- fixedRootBackgroundLayerChanged(); >+ if (auto nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::ViewportConstrained)) >+ scrollingCoordinator->setNodeLayers(nodeID, backing->graphicsLayer()); >+ >+ if (auto nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling)) { >+ // FIXME: would be nice to not have to special-case the root. >+ if (layer.isRenderViewLayer()) >+ scrollingCoordinator->setNodeLayers(nodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer()); >+ else >+ scrollingCoordinator->setNodeLayers(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer()); >+ } >+ >+ if (auto nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::FrameHosting)) >+ scrollingCoordinator->setNodeLayers(nodeID, backing->graphicsLayer()); > } > > void RenderLayerCompositor::didPaintBacking(RenderLayerBacking*) >@@ -614,6 +620,32 @@ void RenderLayerCompositor::cancelCompositingLayerUpdate() > m_updateCompositingLayersTimer.stop(); > } > >+static Optional<ScrollingNodeID> frameHostingNodeForFrame(Frame& frame) >+{ >+ if (!frame.document() || !frame.view()) >+ return { }; >+ >+ // Find the frame's enclosing layer in our render tree. >+ auto* ownerElement = frame.document()->ownerElement(); >+ if (!ownerElement) >+ return { }; >+ >+ auto* frameRenderer = ownerElement->renderer(); >+ if (!frameRenderer || !is<RenderWidget>(frameRenderer)) >+ return { }; >+ >+ auto& widgetRenderer = downcast<RenderWidget>(*frameRenderer); >+ if (!widgetRenderer.hasLayer() || !widgetRenderer.layer()->isComposited()) { >+ LOG(Scrolling, "frameHostingNodeForFrame: frame renderer has no layer or is not composited."); >+ return { }; >+ } >+ >+ if (auto frameHostingNodeID = widgetRenderer.layer()->backing()->scrollingNodeIDForRole(ScrollCoordinationRole::FrameHosting)) >+ return frameHostingNodeID; >+ >+ return { }; >+} >+ > // Returns true on a successful update. > bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot) > { >@@ -713,8 +745,12 @@ bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update > #endif > > if (updateRoot->hasDescendantNeedingUpdateBackingOrHierarchyTraversal() || updateRoot->needsUpdateBackingOrHierarchyTraversal()) { >+ ScrollingTreeState scrollingTreeState = { 0, 0 }; >+ if (!m_renderView.frame().isMainFrame()) >+ scrollingTreeState.parentNodeID = frameHostingNodeForFrame(m_renderView.frame()); >+ > Vector<Ref<GraphicsLayer>> childList; >- updateBackingAndHierarchy(*updateRoot, childList); >+ updateBackingAndHierarchy(*updateRoot, childList, scrollingTreeState); > > // Host the document layer in the RenderView's root layer. > if (isFullUpdate) { >@@ -726,8 +762,6 @@ bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update > else if (m_rootContentLayer) > m_rootContentLayer->setChildren(WTFMove(childList)); > } >- >- reattachSubframeScrollLayers(); > } > > #if !LOG_DISABLED >@@ -1100,7 +1134,7 @@ void RenderLayerCompositor::traverseUnchangedSubtree(RenderLayer* ancestorLayer, > overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer); > } > >-void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector<Ref<GraphicsLayer>>& childLayersOfEnclosingLayer, OptionSet<UpdateLevel> updateLevel, int depth) >+void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector<Ref<GraphicsLayer>>& childLayersOfEnclosingLayer, ScrollingTreeState& scrollingTreeState, OptionSet<UpdateLevel> updateLevel, int depth) > { > layer.updateDescendantDependentFlags(); > layer.updateLayerListsIfNeeded(); >@@ -1109,6 +1143,8 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector > if (layer.descendantsNeedUpdateBackingAndHierarchyTraversal()) > updateLevel.add(UpdateLevel::AllDescendants); > >+ ScrollingTreeState stateForDescendants = scrollingTreeState; >+ > auto* layerBacking = layer.backing(); > if (layerBacking) { > updateLevel.remove(UpdateLevel::CompositedChildren); >@@ -1144,6 +1180,11 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector > if (!layer.parent()) > updateRootLayerPosition(); > >+ // FIXME: do based on dirty flags. Need to do this for changes of geometry, configuration and hierarchy. >+ // Need to be careful to do the right thing when a scroll-coordinated layer loses a scroll-coordinated ancestor. >+ stateForDescendants.parentNodeID = updateScrollCoordinationForLayer(layer, scrollingTreeState, layerBacking->coordinatedScrollingRoles(), { ScrollingNodeChangeFlags::Layer, ScrollingNodeChangeFlags::LayerGeometry }); >+ stateForDescendants.nextChildIndex = 0; >+ > #if !LOG_DISABLED > logLayerInfo(layer, "updateBackingAndHierarchy", depth); > #else >@@ -1161,7 +1202,7 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector > > bool requireDescendantTraversal = layer.hasDescendantNeedingUpdateBackingOrHierarchyTraversal() > || (layer.hasCompositingDescendant() && (!layerBacking || layer.needsCompositingLayerConnection() || !updateLevel.isEmpty())); >- >+ > bool requiresChildRebuild = layerBacking && layer.needsCompositingLayerConnection() && !layer.hasCompositingDescendant(); > > #if !ASSERT_DISABLED >@@ -1178,15 +1219,15 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector > > if (requireDescendantTraversal) { > for (auto* renderLayer : layer.negativeZOrderLayers()) >- updateBackingAndHierarchy(*renderLayer, childList, updateLevel, depth + 1); >+ updateBackingAndHierarchy(*renderLayer, childList, stateForDescendants, updateLevel, depth + 1); > > appendForegroundLayerIfNecessary(); > > for (auto* renderLayer : layer.normalFlowLayers()) >- updateBackingAndHierarchy(*renderLayer, childList, updateLevel, depth + 1); >+ updateBackingAndHierarchy(*renderLayer, childList, stateForDescendants, updateLevel, depth + 1); > > for (auto* renderLayer : layer.positiveZOrderLayers()) >- updateBackingAndHierarchy(*renderLayer, childList, updateLevel, depth + 1); >+ updateBackingAndHierarchy(*renderLayer, childList, stateForDescendants, updateLevel, depth + 1); > } else if (requiresChildRebuild) > appendForegroundLayerIfNecessary(); > >@@ -1497,7 +1538,6 @@ bool RenderLayerCompositor::updateBacking(RenderLayer& layer, RequiresCompositin > layer.ensureBacking(); > > if (layer.isRenderViewLayer() && useCoordinatedScrollingForLayer(layer)) { >- updateScrollCoordinatedStatus(layer, { ScrollingNodeChangeFlags::Layer, ScrollingNodeChangeFlags::LayerGeometry }); > if (auto* scrollingCoordinator = this->scrollingCoordinator()) > scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView()); > #if ENABLE(RUBBER_BANDING) >@@ -1534,8 +1574,6 @@ bool RenderLayerCompositor::updateBacking(RenderLayer& layer, RequiresCompositin > } > } > >- removeFromScrollCoordinatedLayers(layer); >- > layer.clearBacking(); > layerChanged = true; > >@@ -1644,10 +1682,8 @@ void RenderLayerCompositor::layerWillBeRemoved(RenderLayer& parent, RenderLayer& > if (!child.isComposited() || parent.renderer().renderTreeBeingDestroyed()) > return; > >- removeFromScrollCoordinatedLayers(child); > repaintInCompositedAncestor(child, child.backing()->compositedBounds()); // FIXME: do via dirty bits? > >- setCompositingParent(child, nullptr); > child.setNeedsCompositingLayerConnection(); > } > >@@ -1738,33 +1774,6 @@ void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, con > overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer); > } > >-void RenderLayerCompositor::setCompositingParent(RenderLayer& childLayer, RenderLayer* parentLayer) >-{ >- ASSERT(!parentLayer || childLayer.ancestorCompositingLayer() == parentLayer); >- ASSERT(childLayer.isComposited()); >- >- // It's possible to be called with a parent that isn't yet composited when we're doing >- // partial updates as required by painting or hit testing. Just bail in that case; >- // we'll do a full layer update soon. >- if (!parentLayer || !parentLayer->isComposited()) >- return; >- >- if (parentLayer) { >- auto* hostingLayer = parentLayer->backing()->parentForSublayers(); >- auto* hostedLayer = childLayer.backing()->childForSuperlayers(); >- >- hostingLayer->addChild(*hostedLayer); >- } else >- childLayer.backing()->childForSuperlayers()->removeFromParent(); >-} >- >-void RenderLayerCompositor::removeCompositedChildren(RenderLayer& layer) >-{ >- ASSERT(layer.isComposited()); >- >- layer.backing()->parentForSublayers()->removeAllChildren(); >-} >- > #if ENABLE(VIDEO) > bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo& video) const > { >@@ -1875,15 +1884,6 @@ void RenderLayerCompositor::rootLayerConfigurationChanged() > } > } > >-void RenderLayerCompositor::fixedRootBackgroundLayerChanged() >-{ >- if (m_renderView.renderTreeBeingDestroyed()) >- return; >- >- if (m_renderView.layer()->isComposited()) >- updateScrollCoordinatedStatus(*m_renderView.layer(), ScrollingNodeChangeFlags::Layer); >-} >- > String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) > { > updateCompositingLayers(CompositingUpdateType::AfterLayout); >@@ -2034,7 +2034,7 @@ void RenderLayerCompositor::setIsInWindow(bool isInWindow) > attachRootLayer(attachment); > #if PLATFORM(IOS_FAMILY) > if (m_legacyScrollingLayerCoordinator) { >- m_legacyScrollingLayerCoordinator->registerAllViewportConstrainedLayers(*this, m_scrollCoordinatedLayers); >+ m_legacyScrollingLayerCoordinator->registerAllViewportConstrainedLayers(*this); > m_legacyScrollingLayerCoordinator->registerAllScrollingLayers(); > } > #endif >@@ -2054,10 +2054,8 @@ void RenderLayerCompositor::setIsInWindow(bool isInWindow) > > void RenderLayerCompositor::clearBackingForLayerIncludingDescendants(RenderLayer& layer) > { >- if (layer.isComposited()) { >- removeFromScrollCoordinatedLayers(layer); >+ if (layer.isComposited()) > layer.clearBacking(); >- } > > for (auto* childLayer = layer.firstChild(); childLayer; childLayer = childLayer->nextSibling()) > clearBackingForLayerIncludingDescendants(*childLayer); >@@ -2855,7 +2853,7 @@ bool RenderLayerCompositor::useCoordinatedScrollingForLayer(const RenderLayer& l > > if (auto* scrollingCoordinator = this->scrollingCoordinator()) > return scrollingCoordinator->coordinatesScrollingForOverflowLayer(layer); >- >+ > return false; > } > >@@ -3676,47 +3674,12 @@ void RenderLayerCompositor::deviceOrPageScaleFactorChanged() > rootLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants(); > } > >-static bool canCoordinateScrollingForLayer(const RenderLayer& layer) >-{ >- return (layer.isRenderViewLayer() || layer.parent()) && layer.isComposited(); >-} >- >-void RenderLayerCompositor::updateScrollCoordinatedStatus(RenderLayer& layer, OptionSet<ScrollingNodeChangeFlags> changes) >-{ >- OptionSet<ScrollCoordinationRole> coordinationRoles; >- if (isViewportConstrainedFixedOrStickyLayer(layer)) >- coordinationRoles.add(ScrollCoordinationRole::ViewportConstrained); >- >- if (useCoordinatedScrollingForLayer(layer)) >- coordinationRoles.add(ScrollCoordinationRole::Scrolling); >- >- if (isLayerForIFrameWithScrollCoordinatedContents(layer)) { >- // We never expect a RenderIFrame to have scrollable overflow. >- ASSERT(!coordinationRoles.contains(ScrollCoordinationRole::Scrolling)); >- coordinationRoles.add(ScrollCoordinationRole::FrameHosting); >- } >- >- if (layer.isComposited()) >- layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains(ScrollCoordinationRole::ViewportConstrained)); >- >- if (coordinationRoles && canCoordinateScrollingForLayer(layer)) { >- if (m_scrollCoordinatedLayers.add(&layer).isNewEntry) >- m_subframeScrollLayersNeedReattach = true; >- >- updateScrollCoordinatedLayer(layer, coordinationRoles, changes); >- } else >- removeFromScrollCoordinatedLayers(layer); >-} >- > void RenderLayerCompositor::removeFromScrollCoordinatedLayers(RenderLayer& layer) > { >- if (!m_scrollCoordinatedLayers.contains(&layer)) >- return; >- >- m_subframeScrollLayersNeedReattach = true; >- >- m_scrollCoordinatedLayers.remove(&layer); >- m_scrollCoordinatedLayersNeedingUpdate.remove(&layer); >+#if PLATFORM(IOS_FAMILY) >+ if (m_legacyScrollingLayerCoordinator) >+ m_legacyScrollingLayerCoordinator->removeLayer(layer); >+#endif > > detachScrollCoordinatedLayer(layer, { ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained, ScrollCoordinationRole::FrameHosting }); > } >@@ -3778,72 +3741,6 @@ StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo > return constraints; > } > >-static ScrollingNodeID enclosingScrollingNodeID(RenderLayer& layer, IncludeSelfOrNot includeSelf) >-{ >- auto* currLayer = includeSelf == IncludeSelf ? &layer : layer.parent(); >- while (currLayer) { >- if (auto* backing = currLayer->backing()) { >- if (ScrollingNodeID nodeID = backing->scrollingNodeIDForChildren()) >- return nodeID; >- } >- currLayer = currLayer->parent(); >- } >- >- return 0; >-} >- >-static Optional<ScrollingNodeID> scrollCoordinatedAncestorInParentOfFrame(Frame& frame) >-{ >- if (!frame.document() || !frame.view()) >- return { }; >- >- // Find the frame's enclosing layer in our render tree. >- auto* ownerElement = frame.document()->ownerElement(); >- auto* frameRenderer = ownerElement ? ownerElement->renderer() : nullptr; >- if (!frameRenderer || !is<RenderWidget>(frameRenderer)) >- return { }; >- >- auto& widgetRenderer = downcast<RenderWidget>(*frameRenderer); >- if (!widgetRenderer.hasLayer() || !widgetRenderer.layer()->isComposited()) { >- LOG(Scrolling, "scrollCoordinatedAncestorInParentOfFrame: frame renderer has no layer or is not composited."); >- return { }; >- } >- >- if (auto frameHostingNodeID = widgetRenderer.layer()->backing()->scrollingNodeIDForRole(ScrollCoordinationRole::FrameHosting)) >- return frameHostingNodeID; >- >- return { }; >-} >- >-void RenderLayerCompositor::reattachSubframeScrollLayers() >-{ >- if (!m_subframeScrollLayersNeedReattach) >- return; >- >- m_subframeScrollLayersNeedReattach = false; >- >- auto* scrollingCoordinator = this->scrollingCoordinator(); >- >- for (Frame* child = m_renderView.frameView().frame().tree().firstChild(); child; child = child->tree().nextSibling()) { >- if (!child->document() || !child->view()) >- continue; >- >- // Ignore frames that are not scroll-coordinated. >- auto* childFrameView = child->view(); >- ScrollingNodeID frameScrollingNodeID = childFrameView->scrollLayerID(); >- if (!frameScrollingNodeID) >- continue; >- >- auto parentNodeID = scrollCoordinatedAncestorInParentOfFrame(*child); >- if (!parentNodeID) { >- LOG(Scrolling, "RenderLayerCompositor %p reattachSubframeScrollLayers: failed to find scrolling node parent for frame with nodeID %" PRIu64 ".", this, frameScrollingNodeID); >- continue; >- } >- >- scrollingCoordinator->insertNode(child->isMainFrame() ? ScrollingNodeType::MainFrame : ScrollingNodeType::Subframe, frameScrollingNodeID, parentNodeID.value()); >- } >-} >- > static inline ScrollCoordinationRole scrollCoordinationRoleForNodeType(ScrollingNodeType nodeType) > { > switch (nodeType) { >@@ -3861,7 +3758,7 @@ static inline ScrollCoordinationRole scrollCoordinationRoleForNodeType(Scrolling > return ScrollCoordinationRole::Scrolling; > } > >-ScrollingNodeID RenderLayerCompositor::attachScrollingNode(RenderLayer& layer, ScrollingNodeType nodeType, Optional<ScrollingNodeID> parentNodeID) >+ScrollingNodeID RenderLayerCompositor::attachScrollingNode(RenderLayer& layer, ScrollingNodeType nodeType, ScrollingTreeState& treeState) > { > auto* scrollingCoordinator = this->scrollingCoordinator(); > auto* backing = layer.backing(); >@@ -3870,24 +3767,29 @@ ScrollingNodeID RenderLayerCompositor::attachScrollingNode(RenderLayer& layer, S > if (!backing) > return 0; > >+ ASSERT(treeState.parentNodeID || nodeType == ScrollingNodeType::Subframe); >+ ASSERT_IMPLIES(nodeType == ScrollingNodeType::MainFrame, !treeState.parentNodeID.value()); >+ > ScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType); > ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role); > if (!nodeID) > nodeID = scrollingCoordinator->uniqueScrollingNodeID(); > >- LOG_WITH_STREAM(Scrolling, stream << "RenderLayerCompositor " << this << " attachScrollingNode " << nodeID << " type " << nodeType << " parent " << parentNodeID.valueOr(0)); >+ LOG_WITH_STREAM(Scrolling, stream << "RenderLayerCompositor " << this << " attachScrollingNode " << nodeID << " (layer " << backing->graphicsLayer()->primaryLayerID() << ") type " << nodeType << " parent " << treeState.parentNodeID.valueOr(0)); > >- if (nodeType == ScrollingNodeType::Subframe && !parentNodeID) >+ if (nodeType == ScrollingNodeType::Subframe && !treeState.parentNodeID) > nodeID = scrollingCoordinator->createNode(nodeType, nodeID); > else >- nodeID = scrollingCoordinator->insertNode(nodeType, nodeID, parentNodeID.valueOr(0)); >+ nodeID = scrollingCoordinator->insertNode(nodeType, nodeID, treeState.parentNodeID.valueOr(0), treeState.nextChildIndex); > >+ ASSERT(nodeID); > if (!nodeID) > return 0; >- >+ > backing->setScrollingNodeIDForRole(nodeID, role); > m_scrollingNodeToLayerMap.add(nodeID, &layer); >- >+ >+ ++treeState.nextChildIndex; > return nodeID; > } > >@@ -3900,6 +3802,7 @@ void RenderLayerCompositor::detachScrollCoordinatedLayerWithRole(RenderLayer& la > auto childNodes = scrollingCoordinator.childrenOfNode(nodeID); > for (auto childNodeID : childNodes) { > // FIXME: The child might be in a child frame. Need to do something that crosses frame boundaries. >+ // FIXME > if (auto* layer = m_scrollingNodeToLayerMap.get(childNodeID)) > layer->setNeedsScrollingTreeUpdate(); > } >@@ -3927,148 +3830,177 @@ void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer, Opt > backing->detachFromScrollingCoordinator(roles); > } > >-void RenderLayerCompositor::updateScrollCoordinationForThisFrame(Optional<ScrollingNodeID> parentNodeID, OptionSet<ScrollingNodeChangeFlags> changes) >+ScrollingNodeID RenderLayerCompositor::updateScrollCoordinationForLayer(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollCoordinationRole> roles, OptionSet<ScrollingNodeChangeFlags> changes) >+{ >+ bool isViewportConstained = roles.contains(ScrollCoordinationRole::ViewportConstrained); >+#if PLATFORM(IOS_FAMILY) >+ if (m_legacyScrollingLayerCoordinator) { >+ if (isViewportConstained) >+ m_legacyScrollingLayerCoordinator->addViewportConstrainedLayer(layer); >+ else >+ m_legacyScrollingLayerCoordinator->removeViewportConstrainedLayer(layer); >+ } >+#endif >+ >+ // GraphicsLayers need to know whether they are viewport-constrained. >+ layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(isViewportConstained); >+ >+ if (!hasCoordinatedScrolling()) { >+ // If this frame isn't coordinated, it cannot contain any scrolling tree nodes. >+ return 0; >+ } >+ >+ auto newNodeID = treeState.parentNodeID.valueOr(0); >+ >+ ScrollingTreeState viewportConstrainedChildTreeState; >+ ScrollingTreeState* currentTreeState = &treeState; >+ >+ // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling/frame hosting. >+ if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) { >+ newNodeID = updateScrollingNodeForViewportConstrainedRole(layer, *currentTreeState, changes); >+ // ViewportConstrained nodes are the parent of same-layer scrolling nodes, so adjust the ScrollingTreeState. >+ viewportConstrainedChildTreeState.parentNodeID = newNodeID; >+ currentTreeState = &viewportConstrainedChildTreeState; >+ } else >+ detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::ViewportConstrained); >+ >+ if (roles.contains(ScrollCoordinationRole::Scrolling)) >+ newNodeID = updateScrollingNodeForScrollingRole(layer, *currentTreeState, changes); >+ else >+ detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::Scrolling); >+ >+ if (roles.contains(ScrollCoordinationRole::FrameHosting)) >+ newNodeID = updateScrollingNodeForFrameHostingRole(layer, *currentTreeState, changes); >+ else >+ detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::FrameHosting); >+ >+ return newNodeID; >+} >+ >+ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes) > { > auto* scrollingCoordinator = this->scrollingCoordinator(); >- FrameView& frameView = m_renderView.frameView(); >- ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(frameView)); > >- ScrollingNodeID nodeID = attachScrollingNode(*m_renderView.layer(), m_renderView.frame().isMainFrame() ? ScrollingNodeType::MainFrame : ScrollingNodeType::Subframe, parentNodeID); >+ auto nodeType = ScrollingNodeType::Fixed; >+ if (layer.renderer().style().position() == PositionType::Sticky) >+ nodeType = ScrollingNodeType::Sticky; >+ else >+ ASSERT(layer.renderer().isFixedPositioned()); >+ >+ auto newNodeID = attachScrollingNode(layer, nodeType, treeState); >+ if (!newNodeID) { >+ ASSERT_NOT_REACHED(); >+ return treeState.parentNodeID.valueOr(0); >+ } >+ >+ LOG_WITH_STREAM(Compositing, stream << "Registering ViewportConstrained " << nodeType << " node " << newNodeID << " (layer " << layer.backing()->graphicsLayer()->primaryLayerID() << ") as child of " << treeState.parentNodeID.valueOr(0)); > > if (changes & ScrollingNodeChangeFlags::Layer) >- scrollingCoordinator->setNodeLayers(nodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer()); >+ scrollingCoordinator->setNodeLayers(newNodeID, layer.backing()->graphicsLayer()); > > if (changes & ScrollingNodeChangeFlags::LayerGeometry) { >- ScrollingCoordinator::ScrollingGeometry scrollingGeometry; >- // FIXME(https://webkit.org/b/172917): Pass parentRelativeScrollableRect? >- scrollingGeometry.scrollOrigin = frameView.scrollOrigin(); >- scrollingGeometry.scrollableAreaSize = frameView.visibleContentRect().size(); >- scrollingGeometry.contentSize = frameView.totalContentsSize(); >- scrollingGeometry.reachableContentSize = frameView.totalContentsSize(); >-#if ENABLE(CSS_SCROLL_SNAP) >- frameView.updateSnapOffsets(); >- scrollingCoordinator->updateScrollSnapPropertiesWithFrameView(frameView); >-#endif >- scrollingCoordinator->setScrollingNodeGeometry(nodeID, scrollingGeometry); >+ switch (nodeType) { >+ case ScrollingNodeType::Fixed: >+ scrollingCoordinator->setViewportConstraintedNodeGeometry(newNodeID, computeFixedViewportConstraints(layer)); >+ break; >+ case ScrollingNodeType::Sticky: >+ scrollingCoordinator->setViewportConstraintedNodeGeometry(newNodeID, computeStickyViewportConstraints(layer)); >+ break; >+ case ScrollingNodeType::MainFrame: >+ case ScrollingNodeType::Subframe: >+ case ScrollingNodeType::FrameHosting: >+ case ScrollingNodeType::Overflow: >+ break; >+ } > } >+ >+ return newNodeID; > } > >-void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, OptionSet<ScrollCoordinationRole> roles, OptionSet<ScrollingNodeChangeFlags> changes) >+ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForScrollingRole(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes) > { >- bool isRenderViewLayer = layer.isRenderViewLayer(); >- >- ASSERT(m_scrollCoordinatedLayers.contains(&layer)); >- ASSERT(layer.isComposited()); >- > auto* scrollingCoordinator = this->scrollingCoordinator(); >- if (!scrollingCoordinator || !scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView())) >- return; > >- if (!m_renderView.frame().isMainFrame()) { >- auto parentDocumentHostingNodeID = scrollCoordinatedAncestorInParentOfFrame(m_renderView.frame()); >- updateScrollCoordinationForThisFrame(parentDocumentHostingNodeID, changes); >- if (!(roles.contains(ScrollCoordinationRole::ViewportConstrained)) && isRenderViewLayer) >- return; >- } >+ ScrollingNodeID newNodeID = 0; > >- ScrollingNodeID parentNodeID = enclosingScrollingNodeID(layer, ExcludeSelf); >- if (!parentNodeID && !isRenderViewLayer) >- return; >+ if (layer.isRenderViewLayer()) { >+ FrameView& frameView = m_renderView.frameView(); >+ ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(frameView)); > >- auto* backing = layer.backing(); >+ newNodeID = attachScrollingNode(*m_renderView.layer(), m_renderView.frame().isMainFrame() ? ScrollingNodeType::MainFrame : ScrollingNodeType::Subframe, treeState); > >- // Always call this even if the backing is already attached because the parent may have changed. >- // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling. >- if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) { >- ScrollingNodeType nodeType = ScrollingNodeType::MainFrame; >- if (layer.renderer().isFixedPositioned()) >- nodeType = ScrollingNodeType::Fixed; >- else if (layer.renderer().style().position() == PositionType::Sticky) >- nodeType = ScrollingNodeType::Sticky; >- else >+ if (!newNodeID) { > ASSERT_NOT_REACHED(); >- >- ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID); >- if (!nodeID) >- return; >- >- LOG_WITH_STREAM(Compositing, stream << "Registering ViewportConstrained " << nodeType << " node " << nodeID << " (layer " << backing->graphicsLayer()->primaryLayerID() << ") as child of " << parentNodeID); >+ return treeState.parentNodeID.valueOr(0); >+ } > > if (changes & ScrollingNodeChangeFlags::Layer) >- scrollingCoordinator->setNodeLayers(nodeID, backing->graphicsLayer()); >+ scrollingCoordinator->setNodeLayers(newNodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer()); > > if (changes & ScrollingNodeChangeFlags::LayerGeometry) { >- switch (nodeType) { >- case ScrollingNodeType::Fixed: >- scrollingCoordinator->setViewportConstraintedNodeGeometry(nodeID, computeFixedViewportConstraints(layer)); >- break; >- case ScrollingNodeType::Sticky: >- scrollingCoordinator->setViewportConstraintedNodeGeometry(nodeID, computeStickyViewportConstraints(layer)); >- break; >- case ScrollingNodeType::MainFrame: >- case ScrollingNodeType::Subframe: >- case ScrollingNodeType::FrameHosting: >- case ScrollingNodeType::Overflow: >- break; >- } >+ ScrollingCoordinator::ScrollingGeometry scrollingGeometry; >+ // FIXME(https://webkit.org/b/172917): Pass parentRelativeScrollableRect? >+ scrollingGeometry.scrollOrigin = frameView.scrollOrigin(); >+ scrollingGeometry.scrollableAreaSize = frameView.visibleContentRect().size(); >+ scrollingGeometry.contentSize = frameView.totalContentsSize(); >+ scrollingGeometry.reachableContentSize = frameView.totalContentsSize(); >+#if ENABLE(CSS_SCROLL_SNAP) >+ frameView.updateSnapOffsets(); >+ scrollingCoordinator->updateScrollSnapPropertiesWithFrameView(frameView); >+#endif >+ scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry); >+ } >+ } else { >+ newNodeID = attachScrollingNode(layer, ScrollingNodeType::Overflow, treeState); >+ if (!newNodeID) { >+ ASSERT_NOT_REACHED(); >+ return treeState.parentNodeID.valueOr(0); > } > >- parentNodeID = nodeID; >- } else >- detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::ViewportConstrained); >- >- if (roles.contains(ScrollCoordinationRole::Scrolling)) { >- if (isRenderViewLayer) >- updateScrollCoordinationForThisFrame(parentNodeID, changes); >- else { >- ScrollingNodeType nodeType = ScrollingNodeType::Overflow; >- ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID); >- if (!nodeID) >- return; >- >- if (changes & ScrollingNodeChangeFlags::Layer) >- scrollingCoordinator->setNodeLayers(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer()); >- >- if (changes & ScrollingNodeChangeFlags::LayerGeometry) { >- ScrollingCoordinator::ScrollingGeometry scrollingGeometry; >- // FIXME(https://webkit.org/b/172917): Pass parentRelativeScrollableRect? >- scrollingGeometry.scrollOrigin = layer.scrollOrigin(); >- scrollingGeometry.scrollPosition = layer.scrollPosition(); >- scrollingGeometry.scrollableAreaSize = layer.visibleSize(); >- scrollingGeometry.contentSize = layer.contentsSize(); >- scrollingGeometry.reachableContentSize = layer.scrollableContentsSize(); >+ if (changes & ScrollingNodeChangeFlags::Layer) >+ scrollingCoordinator->setNodeLayers(newNodeID, layer.backing()->scrollingLayer(), layer.backing()->scrollingContentsLayer()); >+ >+ if (changes & ScrollingNodeChangeFlags::LayerGeometry) { >+ ScrollingCoordinator::ScrollingGeometry scrollingGeometry; >+ // FIXME(https://webkit.org/b/172917): Pass parentRelativeScrollableRect? >+ scrollingGeometry.scrollOrigin = layer.scrollOrigin(); >+ scrollingGeometry.scrollPosition = layer.scrollPosition(); >+ scrollingGeometry.scrollableAreaSize = layer.visibleSize(); >+ scrollingGeometry.contentSize = layer.contentsSize(); >+ scrollingGeometry.reachableContentSize = layer.scrollableContentsSize(); > #if ENABLE(CSS_SCROLL_SNAP) >- if (const Vector<LayoutUnit>* offsets = layer.horizontalSnapOffsets()) >- scrollingGeometry.horizontalSnapOffsets = *offsets; >- if (const Vector<LayoutUnit>* offsets = layer.verticalSnapOffsets()) >- scrollingGeometry.verticalSnapOffsets = *offsets; >- if (const Vector<ScrollOffsetRange<LayoutUnit>>* ranges = layer.horizontalSnapOffsetRanges()) >- scrollingGeometry.horizontalSnapOffsetRanges = *ranges; >- if (const Vector<ScrollOffsetRange<LayoutUnit>>* ranges = layer.verticalSnapOffsetRanges()) >- scrollingGeometry.verticalSnapOffsetRanges = *ranges; >- scrollingGeometry.currentHorizontalSnapPointIndex = layer.currentHorizontalSnapPointIndex(); >- scrollingGeometry.currentVerticalSnapPointIndex = layer.currentVerticalSnapPointIndex(); >+ if (const Vector<LayoutUnit>* offsets = layer.horizontalSnapOffsets()) >+ scrollingGeometry.horizontalSnapOffsets = *offsets; >+ if (const Vector<LayoutUnit>* offsets = layer.verticalSnapOffsets()) >+ scrollingGeometry.verticalSnapOffsets = *offsets; >+ if (const Vector<ScrollOffsetRange<LayoutUnit>>* ranges = layer.horizontalSnapOffsetRanges()) >+ scrollingGeometry.horizontalSnapOffsetRanges = *ranges; >+ if (const Vector<ScrollOffsetRange<LayoutUnit>>* ranges = layer.verticalSnapOffsetRanges()) >+ scrollingGeometry.verticalSnapOffsetRanges = *ranges; >+ scrollingGeometry.currentHorizontalSnapPointIndex = layer.currentHorizontalSnapPointIndex(); >+ scrollingGeometry.currentVerticalSnapPointIndex = layer.currentVerticalSnapPointIndex(); > #endif >+ scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry); >+ } >+ } > >- LOG(Compositing, "Registering Scrolling scrolling node %" PRIu64 " (layer %" PRIu64 ") as child of %" PRIu64, nodeID, backing->graphicsLayer()->primaryLayerID(), parentNodeID); >+ return newNodeID; >+} > >- scrollingCoordinator->setScrollingNodeGeometry(nodeID, scrollingGeometry); >- } >- } >- } else >- detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::Scrolling); >+ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForFrameHostingRole(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes) >+{ >+ auto* scrollingCoordinator = this->scrollingCoordinator(); > >- if (roles.contains(ScrollCoordinationRole::FrameHosting)) { >- ScrollingNodeID nodeID = attachScrollingNode(layer, ScrollingNodeType::FrameHosting, parentNodeID); >- if (!nodeID) >- return; >+ auto newNodeID = attachScrollingNode(layer, ScrollingNodeType::FrameHosting, treeState); >+ if (!newNodeID) { >+ ASSERT_NOT_REACHED(); >+ return treeState.parentNodeID.valueOr(0); >+ } > >- if (changes & ScrollingNodeChangeFlags::Layer) >- scrollingCoordinator->setNodeLayers(nodeID, backing->graphicsLayer()); >+ if (changes & ScrollingNodeChangeFlags::Layer) >+ scrollingCoordinator->setNodeLayers(newNodeID, layer.backing()->graphicsLayer()); > >- LOG(Compositing, "Registering Scrolling scrolling node %" PRIu64 " (layer %" PRIu64 ") as child of %" PRIu64, nodeID, backing->graphicsLayer()->primaryLayerID(), parentNodeID); >- } else >- detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::FrameHosting); >+ return newNodeID; > } > > ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingNodeID nodeID) const >@@ -4081,10 +4013,8 @@ ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingN > > void RenderLayerCompositor::willRemoveScrollingLayerWithBacking(RenderLayer& layer, RenderLayerBacking& backing) > { >- if (scrollingCoordinator()) { >- backing.detachFromScrollingCoordinator(ScrollCoordinationRole::Scrolling); >+ if (scrollingCoordinator()) > return; >- } > > #if PLATFORM(IOS_FAMILY) > ASSERT(m_renderView.document().pageCacheState() == Document::NotInPageCache); >@@ -4092,12 +4022,13 @@ void RenderLayerCompositor::willRemoveScrollingLayerWithBacking(RenderLayer& lay > m_legacyScrollingLayerCoordinator->removeScrollingLayer(layer, backing); > #else > UNUSED_PARAM(layer); >+ UNUSED_PARAM(backing); > #endif > } > >+// FIXME: This should really be called from the updateBackingAndHierarchy. > void RenderLayerCompositor::didAddScrollingLayer(RenderLayer& layer) > { >- updateScrollCoordinatedStatus(layer, { ScrollingNodeChangeFlags::Layer, ScrollingNodeChangeFlags::LayerGeometry }); > if (scrollingCoordinator()) > return; > >@@ -4105,6 +4036,8 @@ void RenderLayerCompositor::didAddScrollingLayer(RenderLayer& layer) > ASSERT(m_renderView.document().pageCacheState() == Document::NotInPageCache); > if (m_legacyScrollingLayerCoordinator) > m_legacyScrollingLayerCoordinator->addScrollingLayer(layer); >+#else >+ UNUSED_PARAM(layer); > #endif > } > >@@ -4225,7 +4158,7 @@ TextStream& operator<<(TextStream& ts, CompositingPolicy compositingPolicy) > typedef HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>> LayerMap; > typedef HashMap<PlatformLayer*, PlatformLayer*> StickyContainerMap; > >-void LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers(RenderLayerCompositor& compositor, const HashSet<RenderLayer*>& layers) >+void LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers(RenderLayerCompositor& compositor) > { > if (!m_coordinateViewportConstainedLayers) > return; >@@ -4233,7 +4166,7 @@ void LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers > LayerMap layerMap; > StickyContainerMap stickyContainerMap; > >- for (auto* layer : layers) { >+ for (auto* layer : m_viewportConstrainedLayers) { > ASSERT(layer->isComposited()); > > std::unique_ptr<ViewportConstraints> constraints; >@@ -4310,16 +4243,35 @@ void LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers() > void LegacyWebKitScrollingLayerCoordinator::addScrollingLayer(RenderLayer& layer) > { > m_scrollingLayers.add(&layer); >+ m_scrollingLayersNeedingUpdate.add(&layer); > } > > void LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer(RenderLayer& layer, RenderLayerBacking& backing) > { > m_scrollingLayersNeedingUpdate.remove(&layer); >- m_scrollingLayers.remove(&layer); >+ if (m_scrollingLayers.remove(&layer)) { >+ auto* scrollingLayer = backing.scrollingLayer()->platformLayer(); >+ auto* contentsLayer = backing.scrollingContentsLayer()->platformLayer(); >+ m_chromeClient.removeScrollingLayer(layer.renderer().element(), scrollingLayer, contentsLayer); >+ } >+} >+ >+void LegacyWebKitScrollingLayerCoordinator::removeLayer(RenderLayer& layer) >+{ >+ removeScrollingLayer(layer, *layer.backing()); >+ >+ // We'll put the new set of layers to the client via registerAllViewportConstrainedLayers() at flush time. >+ m_viewportConstrainedLayers.remove(&layer); >+} > >- auto* scrollingLayer = backing.scrollingLayer()->platformLayer(); >- auto* contentsLayer = backing.scrollingContentsLayer()->platformLayer(); >- m_chromeClient.removeScrollingLayer(layer.renderer().element(), scrollingLayer, contentsLayer); >+void LegacyWebKitScrollingLayerCoordinator::addViewportConstrainedLayer(RenderLayer& layer) >+{ >+ m_viewportConstrainedLayers.add(&layer); >+} >+ >+void LegacyWebKitScrollingLayerCoordinator::removeViewportConstrainedLayer(RenderLayer& layer) >+{ >+ m_viewportConstrainedLayers.remove(&layer); > } > > void LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer(RenderLayer& layer) >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h >index 9c94bdf072839387280ab15dc3818d5b6fcc4ec4..ca7b69ac6253cf4c13967a5b8fb19212e81c1328 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.h >+++ b/Source/WebCore/rendering/RenderLayerCompositor.h >@@ -98,7 +98,7 @@ public: > { > } > >- void registerAllViewportConstrainedLayers(RenderLayerCompositor&, const HashSet<RenderLayer*>&); >+ void registerAllViewportConstrainedLayers(RenderLayerCompositor&); > void unregisterAllViewportConstrainedLayers(); > > void registerAllScrollingLayers(); >@@ -108,13 +108,21 @@ public: > void addScrollingLayer(RenderLayer&); > void removeScrollingLayer(RenderLayer&, RenderLayerBacking&); > >+ void addViewportConstrainedLayer(RenderLayer&); >+ void removeViewportConstrainedLayer(RenderLayer&); >+ > void didChangePlatformLayerForLayer(RenderLayer&); > >+ void removeLayer(RenderLayer&); >+ > private: > void updateScrollingLayer(RenderLayer&); > > ChromeClient& m_chromeClient; >+ > HashSet<RenderLayer*> m_scrollingLayers; >+ HashSet<RenderLayer*> m_viewportConstrainedLayers; >+ > HashSet<RenderLayer*> m_scrollingLayersNeedingUpdate; > const bool m_coordinateViewportConstainedLayers; > }; >@@ -282,8 +290,6 @@ public: > void frameViewDidLayout(); > void rootLayerConfigurationChanged(); > >- void fixedRootBackgroundLayerChanged(); >- > String layerTreeAsText(LayerTreeFlags); > > float deviceScaleFactor() const override; >@@ -315,19 +321,15 @@ public: > GraphicsLayer* updateLayerForFooter(bool wantsLayer); > #endif > >- ScrollableArea* scrollableAreaForScrollLayerID(ScrollingNodeID) const; >+ // FIXME: make the coordinated/async terminology consistent. >+ bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const; >+ bool useCoordinatedScrollingForLayer(const RenderLayer&) const; >+ bool isLayerForIFrameWithScrollCoordinatedContents(const RenderLayer&) const; > >- enum class ScrollingNodeChangeFlags { >- Layer = 1 << 0, >- LayerGeometry = 1 << 1, >- }; >+ ScrollableArea* scrollableAreaForScrollLayerID(ScrollingNodeID) const; > >- void updateScrollCoordinatedStatus(RenderLayer&, OptionSet<ScrollingNodeChangeFlags>); > void removeFromScrollCoordinatedLayers(RenderLayer&); > >- bool useCoordinatedScrollingForLayer(const RenderLayer&) const; >- bool isLayerForIFrameWithScrollCoordinatedContents(const RenderLayer&) const; >- > void willRemoveScrollingLayerWithBacking(RenderLayer&, RenderLayerBacking&); > void didAddScrollingLayer(RenderLayer&); > >@@ -412,10 +414,7 @@ private: > CompositedChildren = 1 << 1, > }; > // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer. >- void updateBackingAndHierarchy(RenderLayer&, Vector<Ref<GraphicsLayer>>& childGraphicsLayersOfEnclosingLayer, OptionSet<UpdateLevel> = { }, int depth = 0); >- >- void setCompositingParent(RenderLayer& childLayer, RenderLayer* parentLayer); >- void removeCompositedChildren(RenderLayer&); >+ void updateBackingAndHierarchy(RenderLayer&, Vector<Ref<GraphicsLayer>>& childGraphicsLayersOfEnclosingLayer, struct ScrollingTreeState&, OptionSet<UpdateLevel> = { }, int depth = 0); > > bool layerHas3DContent(const RenderLayer&) const; > bool isRunningTransformAnimation(RenderLayerModelObject&) const; >@@ -441,8 +440,10 @@ private: > > void notifyIFramesOfCompositingChange(); > >+#if PLATFORM(IOS_FAMILY) > void updateScrollCoordinatedLayersAfterFlushIncludingSubframes(); > void updateScrollCoordinatedLayersAfterFlush(); >+#endif > > FloatRect visibleRectForLayerFlushing() const; > >@@ -475,14 +476,23 @@ private: > > static bool styleChangeMayAffectIndirectCompositingReasons(const RenderStyle& oldStyle, const RenderStyle& newStyle); > >- void updateCustomLayersAfterFlush(); >+ enum class ScrollingNodeChangeFlags { >+ Layer = 1 << 0, >+ LayerGeometry = 1 << 1, >+ }; >+ >+ ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, struct ScrollingTreeState&); >+ >+ // Returns the ScrollingNodeID which acts as the parent for children. >+ ScrollingNodeID updateScrollCoordinationForLayer(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollCoordinationRole>, OptionSet<ScrollingNodeChangeFlags>); >+ >+ // These return the ScrollingNodeID which acts as the parent for children. >+ ScrollingNodeID updateScrollingNodeForViewportConstrainedRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>); >+ ScrollingNodeID updateScrollingNodeForScrollingRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>); >+ ScrollingNodeID updateScrollingNodeForFrameHostingRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>); > >- void updateScrollCoordinationForThisFrame(Optional<ScrollingNodeID>, OptionSet<ScrollingNodeChangeFlags>); >- ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, Optional<ScrollingNodeID> parentNodeID); >- void updateScrollCoordinatedLayer(RenderLayer&, OptionSet<ScrollCoordinationRole>, OptionSet<ScrollingNodeChangeFlags>); > void detachScrollCoordinatedLayer(RenderLayer&, OptionSet<ScrollCoordinationRole>); > void detachScrollCoordinatedLayerWithRole(RenderLayer&, ScrollingCoordinator&, ScrollCoordinationRole); >- void reattachSubframeScrollLayers(); > > FixedPositionViewportConstraints computeFixedViewportConstraints(RenderLayer&) const; > StickyPositionViewportConstraints computeStickyViewportConstraints(RenderLayer&) const; >@@ -501,8 +511,7 @@ private: > > // FIXME: make the coordinated/async terminology consistent. > bool isAsyncScrollableStickyLayer(const RenderLayer&, const RenderLayer** enclosingAcceleratedOverflowLayer = nullptr) const; >- bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const; >- >+ > bool shouldCompositeOverflowControls() const; > > void scheduleLayerFlushNow(); >@@ -539,7 +548,6 @@ private: > bool m_shouldFlushOnReattach { false }; > bool m_forceCompositingMode { false }; > bool m_inPostLayoutUpdate { false }; // true when it's OK to trust layout information (e.g. layer sizes and positions) >- bool m_subframeScrollLayersNeedReattach { false }; > > bool m_isTrackingRepaints { false }; // Used for testing. > >@@ -554,9 +562,6 @@ private: > RefPtr<GraphicsLayer> m_clipLayer; > RefPtr<GraphicsLayer> m_scrollLayer; > >- HashSet<RenderLayer*> m_scrollCoordinatedLayers; >- HashSet<RenderLayer*> m_scrollCoordinatedLayersNeedingUpdate; >- > // Enclosing layer for overflow controls and the clipping layer > RefPtr<GraphicsLayer> m_overflowControlsHostLayer; > >diff --git a/Source/WebKit/Platform/Logging.cpp b/Source/WebKit/Platform/Logging.cpp >index 5f7d6eeef10004c2b3bdc8dabcebb1e12392260f..414667f87fa354a843f8cc60956a3878bf761534 100644 >--- a/Source/WebKit/Platform/Logging.cpp >+++ b/Source/WebKit/Platform/Logging.cpp >@@ -53,6 +53,7 @@ void initializeLogChannelsIfNecessary(Optional<String> logChannelString) > > String enabledChannelsString = logChannelString ? logChannelString.value() : logLevelString(); > WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, enabledChannelsString.utf8().data()); >+// WebKit2LogRemoteLayerTree.state = WTFLogChannelOn; > } > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm b/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm >index 5dc011f1ed1f7b4d8624a0b34e8b3a22df70c837..3970732b28620b067fde0ad0bb52cc93c9968f45 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm >@@ -84,11 +84,10 @@ void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& > } > case ScrollingNodeType::Fixed: > case ScrollingNodeType::Sticky: >+ case ScrollingNodeType::FrameHosting: > if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) > currNode->setLayer(layerTreeHost.layerForID(currNode->layer())); > break; >- case ScrollingNodeType::FrameHosting: >- break; > } > } > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 60ff27a25c933e47603321fc81295afdb3e9b440..7de6781c94ce46476eabd6a9d5307b6ec4c7f7c6 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,20 @@ >+2019-01-27 Simon Fraser <simon.fraser@apple.com> >+ >+ Add nodes to the scrolling tree in z-index order. >+ https://bugs.webkit.org/show_bug.cgi?id=192529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt: Added. >+ * platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt: >+ * platform/ios-wk2/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt: Added. >+ * platform/mac-wk2/TestExpectations: >+ * scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt: Added. >+ * scrollingcoordinator/scrolling-tree/overflow-in-fixed.html: Added. >+ * scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt: >+ * scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt: Added. >+ * scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order.html: Added. >+ > 2019-01-26 Simon Fraser <simon.fraser@apple.com> > > Have composited RenderIFrame layers make FrameHosting scrolling tree nodes to parent the iframe's scrolling node >diff --git a/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt b/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..730e785b8e5537ad3f07d058c771e4c93ddadf5a >--- /dev/null >+++ b/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt >@@ -0,0 +1,36 @@ >+Scrolling content >+ >+(Frame scrolling node >+ (scrollable area size 800 600) >+ (contents size 800 600) >+ (scrollable area parameters >+ (horizontal scroll elasticity 1) >+ (vertical scroll elasticity 1) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ (visual viewport enabled 1) >+ (layout viewport at (0,0) size 800x600) >+ (min layout viewport origin (0,0)) >+ (max layout viewport origin (0,0)) >+ (behavior for fixed 0) >+ (children 1 >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (8,13)) >+ (children 1 >+ (Overflow scrolling node >+ (scrollable area size 400 300) >+ (contents size 400 1000) >+ (scrollable area parameters >+ (horizontal scroll elasticity 1) >+ (vertical scroll elasticity 1) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ ) >+ ) >+ ) >+ ) >+) >+ >+ >diff --git a/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt b/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt >index e651f7916f5599d6f2ded457ccaea775c340529a..2240194c88dca420a71e74ba596a13953a6adad2 100644 >--- a/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt >+++ b/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt >@@ -15,7 +15,16 @@ Inner scrolling content > (min layout viewport origin (0,0)) > (max layout viewport origin (0,0)) > (behavior for fixed 0) >- (children 0 >+ (children 1 >+ (Overflow scrolling node >+ (scrollable area size 440 340) >+ (contents size 440 1040) >+ (scrollable area parameters >+ (horizontal scroll elasticity 1) >+ (vertical scroll elasticity 1) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ ) > ) > ) > >diff --git a/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt b/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f0e1c19acf46d8446b8a3490aa3595a68395824c >--- /dev/null >+++ b/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt >@@ -0,0 +1,35 @@ >+FirstSecondThird >+ >+(Frame scrolling node >+ (scrollable area size 800 600) >+ (contents size 800 600) >+ (scrollable area parameters >+ (horizontal scroll elasticity 1) >+ (vertical scroll elasticity 1) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ (visual viewport enabled 1) >+ (layout viewport at (0,0) size 800x600) >+ (min layout viewport origin (0,0)) >+ (max layout viewport origin (0,0)) >+ (behavior for fixed 0) >+ (children 3 >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (100,100)) >+ ) >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (150,50)) >+ ) >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (8,13)) >+ ) >+ ) >+) >+ >+ >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index 8d852f0ce342edf6c64600c2ca374e88064760c5..5376b47d0d104f9c8ff6e3957b6c16a978c2dc41 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -324,8 +324,6 @@ webkit.org/b/167321 tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-ma > > webkit.org/b/148408 tiled-drawing/scrolling/root-overflow-with-mousewheel.html [ Pass Failure Timeout ] > >-webkit.org/b/192529 fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html [ Pass Failure ] >- > webkit.org/b/139820 fast/frames/lots-of-objects.html [ Pass Timeout ] > webkit.org/b/139820 fast/frames/lots-of-iframes.html [ Pass Timeout ] > >diff --git a/LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt b/LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0d2b4d05f98e49117ea8a98f39d15c06d49fe392 >--- /dev/null >+++ b/LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt >@@ -0,0 +1,36 @@ >+Scrolling content >+ >+(Frame scrolling node >+ (scrollable area size 800 600) >+ (contents size 800 600) >+ (scrollable area parameters >+ (horizontal scroll elasticity 2) >+ (vertical scroll elasticity 2) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ (visual viewport enabled 1) >+ (layout viewport at (0,0) size 800x600) >+ (min layout viewport origin (0,0)) >+ (max layout viewport origin (0,0)) >+ (behavior for fixed 0) >+ (children 1 >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (8,13)) >+ (children 1 >+ (Overflow scrolling node >+ (scrollable area size 385 285) >+ (contents size 385 1000) >+ (scrollable area parameters >+ (horizontal scroll elasticity 1) >+ (vertical scroll elasticity 1) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ ) >+ ) >+ ) >+ ) >+) >+ >+ >diff --git a/LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed.html b/LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed.html >new file mode 100644 >index 0000000000000000000000000000000000000000..dc54c5e385f5dbfe34a90a4e92b8bb086e3f92c2 >--- /dev/null >+++ b/LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed.html >@@ -0,0 +1,44 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title> >+ Check that overflow is nested inside fixed >+ </title> >+ <script> >+ if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+ if (window.internals) >+ window.internals.settings.setAsyncOverflowScrollingEnabled(true); >+ >+ function doTest() { >+ if (window.internals) >+ document.getElementById('scrollingTree').innerText = window.internals.scrollingStateTreeAsText() + "\n"; >+ >+ if (window.testRunner) >+ testRunner.notifyDone(); >+ } >+ >+ window.addEventListener('load', doTest, false); >+ </script> >+ <style> >+ .fixed { >+ position: fixed; >+ background-color: silver; >+ width: 400px; >+ height: 300px; >+ overflow: scroll; >+ } >+ >+ .scrolling-content { >+ height: 1000px; >+ } >+ </style> >+</head> >+<body> >+ <div class="fixed"> >+ <div class="scrolling-content">Scrolling content</div> >+ </div> >+ <pre id="scrollingTree"></pre> >+</body> >+</html> >diff --git a/LayoutTests/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt b/LayoutTests/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt >index 353babe68b49c4ed5a23fa02927bc137cc303b33..691b8346faf7902f066962f7576dbe5bd02f0dd6 100644 >--- a/LayoutTests/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt >+++ b/LayoutTests/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt >@@ -15,7 +15,16 @@ Inner scrolling content > (min layout viewport origin (0,0)) > (max layout viewport origin (0,0)) > (behavior for fixed 0) >- (children 0 >+ (children 1 >+ (Overflow scrolling node >+ (scrollable area size 425 325) >+ (contents size 425 1040) >+ (scrollable area parameters >+ (horizontal scroll elasticity 1) >+ (vertical scroll elasticity 1) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ ) > ) > ) > >diff --git a/LayoutTests/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt b/LayoutTests/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6865a1ab5632e814ddf112308dad62916075283f >--- /dev/null >+++ b/LayoutTests/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order-expected.txt >@@ -0,0 +1,35 @@ >+FirstSecondThird >+ >+(Frame scrolling node >+ (scrollable area size 800 600) >+ (contents size 800 600) >+ (scrollable area parameters >+ (horizontal scroll elasticity 2) >+ (vertical scroll elasticity 2) >+ (horizontal scrollbar mode 0) >+ (vertical scrollbar mode 0)) >+ (visual viewport enabled 1) >+ (layout viewport at (0,0) size 800x600) >+ (min layout viewport origin (0,0)) >+ (max layout viewport origin (0,0)) >+ (behavior for fixed 0) >+ (children 3 >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (100,100)) >+ ) >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (150,50)) >+ ) >+ (Fixed node >+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop) >+ (viewport rect at last layout at (0,0) size 800x600) >+ (layer position at last layout (8,13)) >+ ) >+ ) >+) >+ >+ >diff --git a/LayoutTests/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order.html b/LayoutTests/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order.html >new file mode 100644 >index 0000000000000000000000000000000000000000..385f13a4a83314531511ef4eeebb00d363b72563 >--- /dev/null >+++ b/LayoutTests/scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order.html >@@ -0,0 +1,59 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>Test that the scrolling tree is in z-order.</title> >+ <script> >+ if (window.testRunner) { >+ testRunner.dumpAsText(); >+ testRunner.waitUntilDone(); >+ } >+ >+ function doTest() { >+ requestAnimationFrame(() => { >+ document.body.classList.add('changed'); >+ >+ if (window.internals) >+ document.getElementById('scrollingTree').innerText = window.internals.scrollingStateTreeAsText() + "\n"; >+ >+ if (window.testRunner) >+ testRunner.notifyDone(); >+ }); >+ } >+ >+ window.addEventListener('load', doTest, false); >+ </script> >+ <style> >+ .fixed { >+ position: fixed; >+ background-color: silver; >+ border: 1px solid black; >+ width: 200px; >+ height: 150px; >+ } >+ >+ #second { >+ left: 100px; >+ top: 100px; >+ } >+ >+ #third { >+ left: 150px; >+ top: 50px; >+ } >+ >+ .changed #first { >+ z-index: 3; >+ } >+ >+ .changed #third { >+ z-index: 1; >+ } >+ </style> >+</head> >+<body> >+ <div class="fixed" id="first">First</div> >+ <div class="fixed" id="second">Second</div> >+ <div class="fixed" id="third">Third</div> >+ <pre id="scrollingTree"></pre> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192529
:
360318
|
360322
|
360510
|
360530