Diff
Modified: trunk/Source/WebCore/ChangeLog (257948 => 257949)
--- trunk/Source/WebCore/ChangeLog 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/ChangeLog 2020-03-05 22:53:56 UTC (rev 257949)
@@ -35,6 +35,47 @@
https://bugs.webkit.org/show_bug.cgi?id=208659
https://trac.webkit.org/changeset/257945
+2020-03-05 Simon Fraser <[email protected]>
+
+ When using the scrolling thread, push ScrollingNodeIDs onto PlatformCALayers
+ https://bugs.webkit.org/show_bug.cgi?id=208654
+
+ Reviewed by Antti Koivisto.
+
+ The scrolling thread on macOS will need to be able to associate layers with scrolling nodes,
+ so push a ScrollingNodeID down through GraphicsLayer to PlatformCALayerCocoa.
+
+ We only need one ScrollingNodeID per platform layer, since a given platform layer only
+ ever has one scrolling role.
+
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::scrollingTreeAsText):
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::dumpProperties const):
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::scrollingNodeID const):
+ (WebCore::GraphicsLayer::setScrollingNodeID):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setScrollingNodeID):
+ (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+ (WebCore::GraphicsLayerCA::updateScrollingNode):
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * platform/graphics/ca/PlatformCALayer.h: setEventRegion() doesn't need to be pure virtual.
+ * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
+ * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+ (WebCore::PlatformCALayerCocoa::setEventRegion):
+ (WebCore::PlatformCALayerCocoa::eventRegionContainsPoint const):
+ * platform/graphics/ca/win/PlatformCALayerWin.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
+ (WebCore::RenderLayerBacking::setScrollingNodeIDForRole):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::ensureRootLayer):
+ (WebCore::RenderLayerCompositor::attachScrollingNode): For subframe scrolling, the clipLayer
+ is the layer that gets associated with a scrolling node.
+ (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingProxyRole):
+
2020-03-05 Said Abou-Hallawa <[email protected]>
Remove the optimization for discarding no operation DisplayList items between Save and Restore items
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (257948 => 257949)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-03-05 22:53:56 UTC (rev 257949)
@@ -482,14 +482,38 @@
m_rootNode->dump(ts, behavior | ScrollingStateTreeAsTextBehaviorIncludeLayerPositions);
}
- if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs && !m_overflowRelatedNodesMap.isEmpty()) {
- TextStream::GroupScope scope(ts);
- ts << "overflow related nodes";
- {
- TextStream::IndentScope indentScope(ts);
- for (auto& it : m_overflowRelatedNodesMap)
- ts << "\n" << indent << it.key << " -> " << it.value;
+ if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs) {
+ if (!m_overflowRelatedNodesMap.isEmpty()) {
+ TextStream::GroupScope scope(ts);
+ ts << "overflow related nodes";
+ {
+ TextStream::IndentScope indentScope(ts);
+ for (auto& it : m_overflowRelatedNodesMap)
+ ts << "\n" << indent << it.key << " -> " << it.value;
+ }
}
+
+#if ENABLE(SCROLLING_THREAD)
+ if (!m_activeOverflowScrollProxyNodes.isEmpty()) {
+ TextStream::GroupScope scope(ts);
+ ts << "overflow scroll proxy nodes";
+ {
+ TextStream::IndentScope indentScope(ts);
+ for (auto& node : m_activeOverflowScrollProxyNodes)
+ ts << "\n" << indent << node->scrollingNodeID();
+ }
+ }
+
+ if (!m_activePositionedNodes.isEmpty()) {
+ TextStream::GroupScope scope(ts);
+ ts << "active positioned nodes";
+ {
+ TextStream::IndentScope indentScope(ts);
+ for (const auto& node : m_activePositionedNodes)
+ ts << "\n" << indent << node->scrollingNodeID();
+ }
+ }
+#endif // ENABLE(SCROLLING_THREAD)
}
}
return ts.release();
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2020-03-05 22:53:56 UTC (rev 257949)
@@ -1004,6 +1004,11 @@
ts << indent << "(event region" << m_eventRegion;
ts << indent << ")\n";
}
+
+#if ENABLE(SCROLLING_THREAD)
+ if ((behavior & LayerTreeAsTextDebug) && m_scrollingNodeID)
+ ts << indent << "(scrolling node " << m_scrollingNodeID << ")\n";
+#endif
if (behavior & LayerTreeAsTextIncludePaintingPhases && paintingPhase())
ts << indent << "(paintingPhases " << paintingPhase() << ")\n";
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2020-03-05 22:53:56 UTC (rev 257949)
@@ -37,6 +37,7 @@
#include "PlatformLayer.h"
#include "Region.h"
#include "ScrollableArea.h"
+#include "ScrollTypes.h"
#include "TimingFunction.h"
#include "TransformOperations.h"
#include "WindRule.h"
@@ -323,6 +324,11 @@
ScrollOffset scrollOffset() const { return m_scrollOffset; }
void setScrollOffset(const ScrollOffset&, ShouldSetNeedsDisplay = SetNeedsDisplay);
+#if ENABLE(SCROLLING_THREAD)
+ ScrollingNodeID scrollingNodeID() const { return m_scrollingNodeID; }
+ virtual void setScrollingNodeID(ScrollingNodeID nodeID) { m_scrollingNodeID = nodeID; }
+#endif
+
// The position of the layer (the location of its top-left corner in its parent)
const FloatPoint& position() const { return m_position; }
virtual void setPosition(const FloatPoint& p) { m_approximatePosition = WTF::nullopt; m_position = p; }
@@ -683,6 +689,10 @@
FilterOperations m_filters;
FilterOperations m_backdropFilters;
+
+#if ENABLE(SCROLLING_THREAD)
+ ScrollingNodeID m_scrollingNodeID { 0 };
+#endif
#if ENABLE(CSS_COMPOSITING)
BlendMode m_blendMode { BlendMode::Normal };
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-03-05 22:53:56 UTC (rev 257949)
@@ -1002,6 +1002,17 @@
noteLayerPropertyChanged(EventRegionChanged, m_isCommittingChanges ? DontScheduleFlush : ScheduleFlush);
}
+#if ENABLE(SCROLLING_THREAD)
+void GraphicsLayerCA::setScrollingNodeID(ScrollingNodeID nodeID)
+{
+ if (nodeID == m_scrollingNodeID)
+ return;
+
+ GraphicsLayer::setScrollingNodeID(nodeID);
+ noteLayerPropertyChanged(ScrollingNodeChanged);
+}
+#endif
+
bool GraphicsLayerCA::shouldRepaintOnSizeChange() const
{
return drawsContent() && !tiledBacking();
@@ -1886,6 +1897,11 @@
if (m_uncommittedChanges & EventRegionChanged)
updateEventRegion();
+#if ENABLE(SCROLLING_THREAD)
+ if (m_uncommittedChanges & ScrollingNodeChanged)
+ updateScrollingNode();
+#endif
+
if (m_uncommittedChanges & MaskLayerChanged) {
updateMaskLayer();
// If the mask layer becomes tiled it can set this flag again. Clear the flag so that
@@ -2742,6 +2758,13 @@
m_layer->setEventRegion(eventRegion());
}
+#if ENABLE(SCROLLING_THREAD)
+void GraphicsLayerCA::updateScrollingNode()
+{
+ m_layer->setScrollingNodeID(scrollingNodeID());
+}
+#endif
+
void GraphicsLayerCA::updateMaskLayer()
{
PlatformCALayer* maskCALayer = m_maskLayer ? downcast<GraphicsLayerCA>(*m_maskLayer).primaryLayer() : nullptr;
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2020-03-05 22:53:56 UTC (rev 257949)
@@ -126,6 +126,9 @@
WEBCORE_EXPORT void setShapeLayerWindRule(WindRule) override;
WEBCORE_EXPORT void setEventRegion(EventRegion&&) override;
+#if ENABLE(SCROLLING_THREAD)
+ WEBCORE_EXPORT void setScrollingNodeID(ScrollingNodeID) override;
+#endif
WEBCORE_EXPORT void suspendAnimations(MonotonicTime) override;
WEBCORE_EXPORT void resumeAnimations() override;
@@ -416,6 +419,9 @@
void updateContentsRects();
void updateMasksToBoundsRect();
void updateEventRegion();
+#if ENABLE(SCROLLING_THREAD)
+ void updateScrollingNode();
+#endif
void updateMaskLayer();
void updateReplicatedLayers();
@@ -536,6 +542,9 @@
UserInteractionEnabledChanged = 1LLU << 38,
NeedsComputeVisibleAndCoverageRect = 1LLU << 39,
EventRegionChanged = 1LLU << 40,
+#if ENABLE(SCROLLING_THREAD)
+ ScrollingNodeChanged = 1LLU << 41,
+#endif
};
typedef uint64_t LayerChangeFlags;
void addUncommittedChanges(LayerChangeFlags);
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2020-03-05 22:53:56 UTC (rev 257949)
@@ -235,8 +235,14 @@
virtual WindRule shapeWindRule() const = 0;
virtual void setShapeWindRule(WindRule) = 0;
- virtual void setEventRegion(const EventRegion&) = 0;
+ virtual void setEventRegion(const EventRegion&) { }
+ virtual bool eventRegionContainsPoint(IntPoint) const { return false; }
+#if ENABLE(SCROLLING_THREAD)
+ virtual ScrollingNodeID scrollingNodeID() const { return 0; }
+ virtual void setScrollingNodeID(ScrollingNodeID) { }
+#endif
+
virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h 2020-03-05 22:53:56 UTC (rev 257949)
@@ -168,8 +168,14 @@
GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
- void setEventRegion(const EventRegion&) override { }
+ void setEventRegion(const EventRegion&) override;
+ bool eventRegionContainsPoint(IntPoint) const override;
+#if ENABLE(SCROLLING_THREAD)
+ ScrollingNodeID scrollingNodeID() const override { return m_scrollingNodeID; }
+ void setScrollingNodeID(ScrollingNodeID nodeID) override { m_scrollingNodeID = nodeID; }
+#endif
+
GraphicsLayer::EmbeddedViewID embeddedViewID() const override;
TiledBacking* tiledBacking() override;
@@ -200,6 +206,10 @@
std::unique_ptr<PlatformCALayerList> m_customSublayers;
GraphicsLayer::CustomAppearance m_customAppearance { GraphicsLayer::CustomAppearance::None };
std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect;
+#if ENABLE(SCROLLING_THREAD)
+ ScrollingNodeID m_scrollingNodeID { 0 };
+#endif
+ EventRegion m_eventRegion;
bool m_wantsDeepColorBackingStore { false };
bool m_supportsSubpixelAntialiasedText { false };
bool m_backingStoreAttached { true };
Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2020-03-05 22:53:56 UTC (rev 257949)
@@ -1032,6 +1032,16 @@
#endif
}
+void PlatformCALayerCocoa::setEventRegion(const EventRegion& eventRegion)
+{
+ m_eventRegion = eventRegion;
+}
+
+bool PlatformCALayerCocoa::eventRegionContainsPoint(IntPoint point) const
+{
+ return m_eventRegion.contains(point);
+}
+
GraphicsLayer::EmbeddedViewID PlatformCALayerCocoa::embeddedViewID() const
{
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (257948 => 257949)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2020-03-05 22:53:56 UTC (rev 257949)
@@ -157,8 +157,6 @@
GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
void updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance) override { m_customAppearance = customAppearance; }
- void setEventRegion(const EventRegion&) override { }
-
GraphicsLayer::EmbeddedViewID embeddedViewID() const override;
TiledBacking* tiledBacking() override;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (257948 => 257949)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2020-03-05 22:53:56 UTC (rev 257949)
@@ -2046,6 +2046,11 @@
LOG_WITH_STREAM(Compositing, stream << "Detaching Scrolling node " << m_scrollingNodeID);
scrollingCoordinator->unparentChildrenAndDestroyNode(m_scrollingNodeID);
m_scrollingNodeID = 0;
+
+#if ENABLE(SCROLLING_THREAD)
+ if (m_scrollContainerLayer)
+ m_scrollContainerLayer->setScrollingNodeID(0);
+#endif
}
if (roles.contains(ScrollCoordinationRole::ScrollingProxy) && m_ancestorClippingStack) {
@@ -2069,9 +2074,41 @@
LOG_WITH_STREAM(Compositing, stream << "Detaching Positioned node " << m_positioningNodeID);
scrollingCoordinator->unparentChildrenAndDestroyNode(m_positioningNodeID);
m_positioningNodeID = 0;
+#if ENABLE(SCROLLING_THREAD)
+ m_graphicsLayer->setScrollingNodeID(0);
+#endif
}
}
+void RenderLayerBacking::setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollCoordinationRole role)
+{
+ switch (role) {
+ case ScrollCoordinationRole::Scrolling:
+ m_scrollingNodeID = nodeID;
+#if ENABLE(SCROLLING_THREAD)
+ if (m_scrollContainerLayer)
+ m_scrollContainerLayer->setScrollingNodeID(m_scrollingNodeID);
+#endif
+ break;
+ case ScrollCoordinationRole::ScrollingProxy:
+ // These nodeIDs are stored in m_ancestorClippingStack.
+ ASSERT_NOT_REACHED();
+ break;
+ case ScrollCoordinationRole::FrameHosting:
+ m_frameHostingNodeID = nodeID;
+ break;
+ case ScrollCoordinationRole::ViewportConstrained:
+ m_viewportConstrainedNodeID = nodeID;
+ break;
+ case ScrollCoordinationRole::Positioning:
+ m_positioningNodeID = nodeID;
+#if ENABLE(SCROLLING_THREAD)
+ m_graphicsLayer->setScrollingNodeID(m_positioningNodeID);
+#endif
+ break;
+ }
+}
+
ScrollingNodeID RenderLayerBacking::scrollingNodeIDForChildren() const
{
if (m_frameHostingNodeID)
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (257948 => 257949)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2020-03-05 22:53:56 UTC (rev 257949)
@@ -148,27 +148,7 @@
return 0;
}
- void setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollCoordinationRole role)
- {
- switch (role) {
- case ScrollCoordinationRole::Scrolling:
- m_scrollingNodeID = nodeID;
- break;
- case ScrollCoordinationRole::ScrollingProxy:
- // These nodeIDs are stored in m_ancestorClippingStack.
- ASSERT_NOT_REACHED();
- break;
- case ScrollCoordinationRole::FrameHosting:
- m_frameHostingNodeID = nodeID;
- break;
- case ScrollCoordinationRole::ViewportConstrained:
- m_viewportConstrainedNodeID = nodeID;
- break;
- case ScrollCoordinationRole::Positioning:
- m_positioningNodeID = nodeID;
- break;
- }
- }
+ void setScrollingNodeIDForRole(ScrollingNodeID, ScrollCoordinationRole);
ScrollingNodeID scrollingNodeIDForChildren() const;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (257948 => 257949)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-03-05 22:50:32 UTC (rev 257948)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-03-05 22:53:56 UTC (rev 257949)
@@ -3875,7 +3875,7 @@
m_overflowControlsHostLayer->setName("overflow controls host");
m_scrolledContentsLayer = GraphicsLayer::create(graphicsLayerFactory(), *this, GraphicsLayer::Type::ScrolledContents);
- m_scrolledContentsLayer->setName("scrolled contents");
+ m_scrolledContentsLayer->setName("frame scrolled contents");
m_scrolledContentsLayer->setAnchorPoint({ });
#if PLATFORM(IOS_FAMILY)
@@ -4223,6 +4223,12 @@
return 0;
backing->setScrollingNodeIDForRole(nodeID, role);
+
+#if ENABLE(SCROLLING_THREAD)
+ if (nodeType == ScrollingNodeType::Subframe)
+ m_clipLayer->setScrollingNodeID(nodeID);
+#endif
+
m_scrollingNodeToLayerMap.add(nodeID, makeWeakPtr(layer));
return nodeID;
@@ -4530,6 +4536,10 @@
return treeState.parentNodeID.valueOr(0);
}
entry.overflowScrollProxyNodeID = nodeID;
+#if ENABLE(SCROLLING_THREAD)
+ if (entry.clippingLayer)
+ entry.clippingLayer->setScrollingNodeID(nodeID);
+#endif
if (changes & ScrollingNodeChangeFlags::Layer)
scrollingCoordinator->setNodeLayers(entry.overflowScrollProxyNodeID, { entry.clippingLayer.get() });