Diff
Modified: trunk/Source/WebCore/ChangeLog (216102 => 216103)
--- trunk/Source/WebCore/ChangeLog 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/ChangeLog 2017-05-02 23:06:09 UTC (rev 216103)
@@ -1,3 +1,42 @@
+2017-05-02 Simon Fraser <[email protected]>
+
+ Improve scrolling tree logging
+ https://bugs.webkit.org/show_bug.cgi?id=171574
+
+ Reviewed by Tim Horton.
+
+ Make a call to showScrollingStateTree() print debugging-related information like node and layer IDs.
+ Required fixing scrolling state tree nodes to respect ScrollingStateTreeAsTextBehavior, and fixing
+ fixed and sticky nodes to call super.
+
+ Also enhance compositing logging to show layer IDs, and to log for layer scrolling tree registration.
+
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::scrollingStateTreeAsText):
+ * page/scrolling/ScrollingCoordinator.h:
+ * page/scrolling/ScrollingStateFixedNode.cpp:
+ (WebCore::ScrollingStateFixedNode::dumpProperties):
+ * page/scrolling/ScrollingStateNode.cpp:
+ (WebCore::ScrollingStateNode::dumpProperties):
+ (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
+ * page/scrolling/ScrollingStateNode.h:
+ * page/scrolling/ScrollingStateScrollingNode.cpp:
+ (WebCore::ScrollingStateScrollingNode::dumpProperties):
+ * page/scrolling/ScrollingStateStickyNode.cpp:
+ (WebCore::ScrollingStateStickyNode::dumpProperties):
+ * page/scrolling/ScrollingStateTree.cpp:
+ (showScrollingStateTree):
+ * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+ (WebCore::ScrollingCoordinatorMac::commitTreeState):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::logLayerInfo):
+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
+
2017-05-02 Daniel Bates <[email protected]>
Using StringView.split() instead of String.split() in some places
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -626,12 +626,12 @@
return m_page->mainFrame().settings().visualViewportEnabled();
}
-String AsyncScrollingCoordinator::scrollingStateTreeAsText() const
+String AsyncScrollingCoordinator::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior behavior) const
{
if (m_scrollingStateTree->rootStateNode()) {
if (m_eventTrackingRegionsDirty)
m_scrollingStateTree->rootStateNode()->setEventTrackingRegions(absoluteEventTrackingRegions());
- return m_scrollingStateTree->rootStateNode()->scrollingStateTreeAsText();
+ return m_scrollingStateTree->rootStateNode()->scrollingStateTreeAsText(behavior);
}
return String();
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2017-05-02 23:06:09 UTC (rev 216103)
@@ -76,7 +76,7 @@
void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, std::optional<FloatPoint> layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction);
- WEBCORE_EXPORT String scrollingStateTreeAsText() const override;
+ WEBCORE_EXPORT String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const override;
WEBCORE_EXPORT void willCommitTree() override;
bool eventTrackingRegionsDirty() const { return m_eventTrackingRegionsDirty; }
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -388,7 +388,7 @@
return uniqueScrollLayerID++;
}
-String ScrollingCoordinator::scrollingStateTreeAsText() const
+String ScrollingCoordinator::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior) const
{
return String();
}
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2017-05-02 23:06:09 UTC (rev 216103)
@@ -53,6 +53,15 @@
enum ScrollingNodeType { FrameScrollingNode, OverflowScrollingNode, FixedNode, StickyNode };
+enum ScrollingStateTreeAsTextBehaviorFlags {
+ ScrollingStateTreeAsTextBehaviorNormal = 0,
+ ScrollingStateTreeAsTextBehaviorIncludeLayerIDs = 1 << 0,
+ ScrollingStateTreeAsTextBehaviorIncludeNodeIDs = 1 << 1,
+ ScrollingStateTreeAsTextBehaviorIncludeLayerPositions = 1 << 2,
+ ScrollingStateTreeAsTextBehaviorDebug = ScrollingStateTreeAsTextBehaviorIncludeLayerIDs | ScrollingStateTreeAsTextBehaviorIncludeNodeIDs | ScrollingStateTreeAsTextBehaviorIncludeLayerPositions
+};
+typedef unsigned ScrollingStateTreeAsTextBehavior;
+
class Document;
class Frame;
class FrameView;
@@ -181,7 +190,7 @@
virtual void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, GraphicsLayer* /*counterScrollingLayer*/, GraphicsLayer* /*insetClipLayer*/, const ScrollingGeometry* = nullptr) { }
virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, const ScrollingGeometry* = nullptr) { }
virtual void reconcileViewportConstrainedLayerPositions(const LayoutRect&, ScrollingLayerPositionAction) { }
- virtual String scrollingStateTreeAsText() const;
+ virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
virtual bool isRubberBandInProgress() const { return false; }
virtual bool isScrollSnapInProgress() const { return false; }
virtual void updateScrollSnapPropertiesWithFrameView(const FrameView&) { }
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -93,9 +93,10 @@
}
}
-void ScrollingStateFixedNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior) const
+void ScrollingStateFixedNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
{
ts << "(" << "Fixed node" << "\n";
+ ScrollingStateNode::dumpProperties(ts, indent, behavior);
if (m_constraints.anchorEdges()) {
writeIndent(ts, indent + 1);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -112,6 +112,19 @@
setPropertyChanged(ScrollLayer);
}
+void ScrollingStateNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
+{
+ if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs) {
+ writeIndent(ts, indent + 1);
+ ts << "(nodeID " << scrollingNodeID() << ")\n";
+ }
+
+ if (behavior & ScrollingStateTreeAsTextBehaviorIncludeLayerIDs) {
+ writeIndent(ts, indent + 1);
+ ts << "(layerID " << layer().layerID() << ")\n";
+ }
+}
+
void ScrollingStateNode::dump(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
{
writeIndent(ts, indent);
@@ -131,11 +144,11 @@
ts << ")\n";
}
-String ScrollingStateNode::scrollingStateTreeAsText() const
+String ScrollingStateNode::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior behavior) const
{
TextStream ts(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect);
- dump(ts, 0, ScrollingStateTreeAsTextBehaviorNormal);
+ dump(ts, 0, behavior);
return ts.release();
}
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2017-05-02 23:06:09 UTC (rev 216103)
@@ -39,15 +39,6 @@
class ScrollingStateTree;
class TextStream;
-enum ScrollingStateTreeAsTextBehaviorFlags {
- ScrollingStateTreeAsTextBehaviorNormal = 0,
- ScrollingStateTreeAsTextBehaviorIncludeLayerIDs = 1 << 0,
- ScrollingStateTreeAsTextBehaviorIncludeNodeIDs = 1 << 1,
- ScrollingStateTreeAsTextBehaviorIncludeLayerPositions = 1 << 2,
- ScrollingStateTreeAsTextBehaviorDebug = ScrollingStateTreeAsTextBehaviorIncludeLayerIDs | ScrollingStateTreeAsTextBehaviorIncludeNodeIDs | ScrollingStateTreeAsTextBehaviorIncludeLayerPositions
-};
-typedef unsigned ScrollingStateTreeAsTextBehavior;
-
// Used to allow ScrollingStateNodes to refer to layers in various contexts:
// a) Async scrolling, main thread: ScrollingStateNode holds onto a GraphicsLayer, and uses m_layerID
// to detect whether that GraphicsLayer's underlying PlatformLayer changed.
@@ -240,16 +231,16 @@
void appendChild(Ref<ScrollingStateNode>&&);
- String scrollingStateTreeAsText() const;
+ String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
protected:
ScrollingStateNode(const ScrollingStateNode&, ScrollingStateTree&);
+ virtual void dumpProperties(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const;
+
private:
void dump(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const;
- virtual void dumpProperties(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const = 0;
-
const ScrollingNodeType m_nodeType;
ScrollingNodeID m_nodeID;
ChangedProperties m_changedProperties;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -185,8 +185,10 @@
setPropertyChanged(ExpectsWheelEventTestTrigger);
}
-void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior) const
+void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
{
+ ScrollingStateNode::dumpProperties(ts, indent, behavior);
+
if (m_scrollPosition != FloatPoint()) {
writeIndent(ts, indent + 1);
ts << "(scroll position "
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -93,9 +93,10 @@
}
}
-void ScrollingStateStickyNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior) const
+void ScrollingStateStickyNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
{
ts << "(" << "Sticky node" << "\n";
+ ScrollingStateNode::dumpProperties(ts, indent, behavior);
if (m_constraints.anchorEdges()) {
writeIndent(ts, indent + 1);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -276,7 +276,7 @@
return;
}
- String output = rootNode->scrollingStateTreeAsText();
+ String output = rootNode->scrollingStateTreeAsText(WebCore::ScrollingStateTreeAsTextBehaviorDebug);
fprintf(stderr, "%s\n", output.utf8().data());
}
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (216102 => 216103)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2017-05-02 23:06:09 UTC (rev 216103)
@@ -117,7 +117,7 @@
if (!scrollingStateTree()->hasChangedProperties())
return;
- LOG(Scrolling, "%s", scrollingStateTreeAsText().utf8().data());
+ LOG(Scrolling, "%s", scrollingStateTreeAsText(ScrollingStateTreeAsTextBehaviorDebug).utf8().data());
RefPtr<ThreadedScrollingTree> threadedScrollingTree = downcast<ThreadedScrollingTree>(scrollingTree());
ScrollingStateTree* unprotectedTreeState = scrollingStateTree()->commit(LayerRepresentation::PlatformLayerRepresentation).release();
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (216102 => 216103)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -44,6 +44,7 @@
#include "HTMLPlugInElement.h"
#include "InspectorInstrumentation.h"
#include "KeyframeList.h"
+#include "Logging.h"
#include "MainFrame.h"
#include "Page.h"
#include "PluginViewBase.h"
@@ -1780,11 +1781,13 @@
return;
if ((roles & Scrolling) && m_scrollingNodeID) {
+ LOG(Compositing, "Detaching Scrolling node %llu", m_scrollingNodeID);
scrollingCoordinator->detachFromStateTree(m_scrollingNodeID);
m_scrollingNodeID = 0;
}
if ((roles & ViewportConstrained) && m_viewportConstrainedNodeID) {
+ LOG(Compositing, "Detaching ViewportConstrained node %llu", m_viewportConstrainedNodeID);
scrollingCoordinator->detachFromStateTree(m_viewportConstrainedNodeID);
m_viewportConstrainedNodeID = 0;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (216102 => 216103)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-05-02 22:51:40 UTC (rev 216102)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-05-02 23:06:09 UTC (rev 216103)
@@ -810,7 +810,7 @@
absoluteBounds.move(layer.offsetFromAncestor(m_renderView.layer()));
StringBuilder logString;
- logString.append(String::format("%*p (%.3f,%.3f-%.3f,%.3f) %.2fKB", 12 + depth * 2, &layer,
+ logString.append(String::format("%*p id %llu (%.3f,%.3f-%.3f,%.3f) %.2fKB", 12 + depth * 2, &layer, backing->graphicsLayer()->primaryLayerID(),
absoluteBounds.x().toFloat(), absoluteBounds.y().toFloat(), absoluteBounds.maxX().toFloat(), absoluteBounds.maxY().toFloat(),
backing->backingStoreMemoryEstimate() / 1024));
@@ -3904,6 +3904,8 @@
ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID);
if (!nodeID)
return;
+
+ LOG(Compositing, "Registering ViewportConstrained scrolling node %llu (layer %llu) as child of %llu", nodeID, backing->graphicsLayer()->primaryLayerID(), parentNodeID);
switch (nodeType) {
case FixedNode:
@@ -3920,7 +3922,7 @@
parentNodeID = nodeID;
} else
detachScrollCoordinatedLayer(layer, ViewportConstrained);
-
+
if (reasons & Scrolling) {
if (isRootLayer)
updateScrollCoordinationForThisFrame(parentNodeID);
@@ -3948,6 +3950,9 @@
scrollingGeometry.currentHorizontalSnapPointIndex = layer.currentHorizontalSnapPointIndex();
scrollingGeometry.currentVerticalSnapPointIndex = layer.currentVerticalSnapPointIndex();
#endif
+
+ LOG(Compositing, "Registering Scrolling scrolling node %llu (layer %llu) as child of %llu", nodeID, backing->graphicsLayer()->primaryLayerID(), parentNodeID);
+
scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry);
}
} else