Changeset 216103 in webkit


Ignore:
Timestamp:
May 2, 2017, 4:06:09 PM (8 years ago)
Author:
Simon Fraser
Message:

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):

Location:
trunk/Source/WebCore
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r216102 r216103  
     12017-05-02  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Improve scrolling tree logging
     4        https://bugs.webkit.org/show_bug.cgi?id=171574
     5
     6        Reviewed by Tim Horton.
     7
     8        Make a call to showScrollingStateTree() print debugging-related information like node and layer IDs.
     9        Required fixing scrolling state tree nodes to respect ScrollingStateTreeAsTextBehavior, and fixing
     10        fixed and sticky nodes to call super.
     11
     12        Also enhance compositing logging to show layer IDs, and to log for layer scrolling tree registration.
     13
     14        * page/scrolling/AsyncScrollingCoordinator.cpp:
     15        (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
     16        * page/scrolling/AsyncScrollingCoordinator.h:
     17        * page/scrolling/ScrollingCoordinator.cpp:
     18        (WebCore::ScrollingCoordinator::scrollingStateTreeAsText):
     19        * page/scrolling/ScrollingCoordinator.h:
     20        * page/scrolling/ScrollingStateFixedNode.cpp:
     21        (WebCore::ScrollingStateFixedNode::dumpProperties):
     22        * page/scrolling/ScrollingStateNode.cpp:
     23        (WebCore::ScrollingStateNode::dumpProperties):
     24        (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
     25        * page/scrolling/ScrollingStateNode.h:
     26        * page/scrolling/ScrollingStateScrollingNode.cpp:
     27        (WebCore::ScrollingStateScrollingNode::dumpProperties):
     28        * page/scrolling/ScrollingStateStickyNode.cpp:
     29        (WebCore::ScrollingStateStickyNode::dumpProperties):
     30        * page/scrolling/ScrollingStateTree.cpp:
     31        (showScrollingStateTree):
     32        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
     33        (WebCore::ScrollingCoordinatorMac::commitTreeState):
     34        * rendering/RenderLayerBacking.cpp:
     35        (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
     36        * rendering/RenderLayerCompositor.cpp:
     37        (WebCore::RenderLayerCompositor::logLayerInfo):
     38        (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
     39
    1402017-05-02  Daniel Bates  <dabates@apple.com>
    241
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r215160 r216103  
    627627}
    628628
    629 String AsyncScrollingCoordinator::scrollingStateTreeAsText() const
     629String AsyncScrollingCoordinator::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior behavior) const
    630630{
    631631    if (m_scrollingStateTree->rootStateNode()) {
    632632        if (m_eventTrackingRegionsDirty)
    633633            m_scrollingStateTree->rootStateNode()->setEventTrackingRegions(absoluteEventTrackingRegions());
    634         return m_scrollingStateTree->rootStateNode()->scrollingStateTreeAsText();
     634        return m_scrollingStateTree->rootStateNode()->scrollingStateTreeAsText(behavior);
    635635    }
    636636
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r211033 r216103  
    7777    void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, std::optional<FloatPoint> layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction);
    7878
    79     WEBCORE_EXPORT String scrollingStateTreeAsText() const override;
     79    WEBCORE_EXPORT String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const override;
    8080    WEBCORE_EXPORT void willCommitTree() override;
    8181
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r214082 r216103  
    389389}
    390390
    391 String ScrollingCoordinator::scrollingStateTreeAsText() const
     391String ScrollingCoordinator::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior) const
    392392{
    393393    return String();
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r210560 r216103  
    5454enum ScrollingNodeType { FrameScrollingNode, OverflowScrollingNode, FixedNode, StickyNode };
    5555
     56enum ScrollingStateTreeAsTextBehaviorFlags {
     57    ScrollingStateTreeAsTextBehaviorNormal                  = 0,
     58    ScrollingStateTreeAsTextBehaviorIncludeLayerIDs         = 1 << 0,
     59    ScrollingStateTreeAsTextBehaviorIncludeNodeIDs          = 1 << 1,
     60    ScrollingStateTreeAsTextBehaviorIncludeLayerPositions   = 1 << 2,
     61    ScrollingStateTreeAsTextBehaviorDebug                   = ScrollingStateTreeAsTextBehaviorIncludeLayerIDs | ScrollingStateTreeAsTextBehaviorIncludeNodeIDs | ScrollingStateTreeAsTextBehaviorIncludeLayerPositions
     62};
     63typedef unsigned ScrollingStateTreeAsTextBehavior;
     64
    5665class Document;
    5766class Frame;
     
    182191    virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, const ScrollingGeometry* = nullptr) { }
    183192    virtual void reconcileViewportConstrainedLayerPositions(const LayoutRect&, ScrollingLayerPositionAction) { }
    184     virtual String scrollingStateTreeAsText() const;
     193    virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
    185194    virtual bool isRubberBandInProgress() const { return false; }
    186195    virtual bool isScrollSnapInProgress() const { return false; }
  • trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp

    r208927 r216103  
    9494}
    9595
    96 void ScrollingStateFixedNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior) const
     96void ScrollingStateFixedNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
    9797{
    9898    ts << "(" << "Fixed node" << "\n";
     99    ScrollingStateNode::dumpProperties(ts, indent, behavior);
    99100
    100101    if (m_constraints.anchorEdges()) {
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp

    r211033 r216103  
    113113}
    114114
     115void ScrollingStateNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
     116{
     117    if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs) {
     118        writeIndent(ts, indent + 1);
     119        ts << "(nodeID " << scrollingNodeID() << ")\n";
     120    }
     121   
     122    if (behavior & ScrollingStateTreeAsTextBehaviorIncludeLayerIDs) {
     123        writeIndent(ts, indent + 1);
     124        ts << "(layerID " << layer().layerID() << ")\n";
     125    }
     126}
     127
    115128void ScrollingStateNode::dump(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
    116129{
     
    132145}
    133146
    134 String ScrollingStateNode::scrollingStateTreeAsText() const
     147String ScrollingStateNode::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior behavior) const
    135148{
    136149    TextStream ts(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect);
    137150
    138     dump(ts, 0, ScrollingStateTreeAsTextBehaviorNormal);
     151    dump(ts, 0, behavior);
    139152    return ts.release();
    140153}
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h

    r211033 r216103  
    4040class TextStream;
    4141
    42 enum ScrollingStateTreeAsTextBehaviorFlags {
    43     ScrollingStateTreeAsTextBehaviorNormal                  = 0,
    44     ScrollingStateTreeAsTextBehaviorIncludeLayerIDs         = 1 << 0,
    45     ScrollingStateTreeAsTextBehaviorIncludeNodeIDs          = 1 << 1,
    46     ScrollingStateTreeAsTextBehaviorIncludeLayerPositions   = 1 << 2,
    47     ScrollingStateTreeAsTextBehaviorDebug                   = ScrollingStateTreeAsTextBehaviorIncludeLayerIDs | ScrollingStateTreeAsTextBehaviorIncludeNodeIDs | ScrollingStateTreeAsTextBehaviorIncludeLayerPositions
    48 };
    49 typedef unsigned ScrollingStateTreeAsTextBehavior;
    50 
    5142// Used to allow ScrollingStateNodes to refer to layers in various contexts:
    5243// a) Async scrolling, main thread: ScrollingStateNode holds onto a GraphicsLayer, and uses m_layerID
     
    241232    void appendChild(Ref<ScrollingStateNode>&&);
    242233
    243     String scrollingStateTreeAsText() const;
     234    String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
    244235
    245236protected:
    246237    ScrollingStateNode(const ScrollingStateNode&, ScrollingStateTree&);
    247238
     239    virtual void dumpProperties(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const;
     240   
    248241private:
    249242    void dump(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const;
    250 
    251     virtual void dumpProperties(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const = 0;
    252243
    253244    const ScrollingNodeType m_nodeType;
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp

    r210560 r216103  
    186186}
    187187
    188 void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior) const
    189 {
     188void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
     189{
     190    ScrollingStateNode::dumpProperties(ts, indent, behavior);
     191   
    190192    if (m_scrollPosition != FloatPoint()) {
    191193        writeIndent(ts, indent + 1);
  • trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp

    r208927 r216103  
    9494}
    9595
    96 void ScrollingStateStickyNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior) const
     96void ScrollingStateStickyNode::dumpProperties(TextStream& ts, int indent, ScrollingStateTreeAsTextBehavior behavior) const
    9797{
    9898    ts << "(" << "Sticky node" << "\n";
     99    ScrollingStateNode::dumpProperties(ts, indent, behavior);
    99100
    100101    if (m_constraints.anchorEdges()) {
  • trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp

    r211033 r216103  
    277277    }
    278278
    279     String output = rootNode->scrollingStateTreeAsText();
     279    String output = rootNode->scrollingStateTreeAsText(WebCore::ScrollingStateTreeAsTextBehaviorDebug);
    280280    fprintf(stderr, "%s\n", output.utf8().data());
    281281}
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r215160 r216103  
    118118        return;
    119119
    120     LOG(Scrolling, "%s", scrollingStateTreeAsText().utf8().data());
     120    LOG(Scrolling, "%s", scrollingStateTreeAsText(ScrollingStateTreeAsTextBehaviorDebug).utf8().data());
    121121
    122122    RefPtr<ThreadedScrollingTree> threadedScrollingTree = downcast<ThreadedScrollingTree>(scrollingTree());
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r215181 r216103  
    4545#include "InspectorInstrumentation.h"
    4646#include "KeyframeList.h"
     47#include "Logging.h"
    4748#include "MainFrame.h"
    4849#include "Page.h"
     
    17811782
    17821783    if ((roles & Scrolling) && m_scrollingNodeID) {
     1784        LOG(Compositing, "Detaching Scrolling node %llu", m_scrollingNodeID);
    17831785        scrollingCoordinator->detachFromStateTree(m_scrollingNodeID);
    17841786        m_scrollingNodeID = 0;
     
    17861788   
    17871789    if ((roles & ViewportConstrained) && m_viewportConstrainedNodeID) {
     1790        LOG(Compositing, "Detaching ViewportConstrained node %llu", m_viewportConstrainedNodeID);
    17881791        scrollingCoordinator->detachFromStateTree(m_viewportConstrainedNodeID);
    17891792        m_viewportConstrainedNodeID = 0;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r216047 r216103  
    811811   
    812812    StringBuilder logString;
    813     logString.append(String::format("%*p (%.3f,%.3f-%.3f,%.3f) %.2fKB", 12 + depth * 2, &layer,
     813    logString.append(String::format("%*p id %llu (%.3f,%.3f-%.3f,%.3f) %.2fKB", 12 + depth * 2, &layer, backing->graphicsLayer()->primaryLayerID(),
    814814        absoluteBounds.x().toFloat(), absoluteBounds.y().toFloat(), absoluteBounds.maxX().toFloat(), absoluteBounds.maxY().toFloat(),
    815815        backing->backingStoreMemoryEstimate() / 1024));
     
    39053905        if (!nodeID)
    39063906            return;
     3907           
     3908        LOG(Compositing, "Registering ViewportConstrained scrolling node %llu (layer %llu) as child of %llu", nodeID, backing->graphicsLayer()->primaryLayerID(), parentNodeID);
    39073909
    39083910        switch (nodeType) {
     
    39213923    } else
    39223924        detachScrollCoordinatedLayer(layer, ViewportConstrained);
    3923 
     3925       
    39243926    if (reasons & Scrolling) {
    39253927        if (isRootLayer)
     
    39493951            scrollingGeometry.currentVerticalSnapPointIndex = layer.currentVerticalSnapPointIndex();
    39503952#endif
     3953
     3954            LOG(Compositing, "Registering Scrolling scrolling node %llu (layer %llu) as child of %llu", nodeID, backing->graphicsLayer()->primaryLayerID(), parentNodeID);
     3955
    39513956            scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry);
    39523957        }
Note: See TracChangeset for help on using the changeset viewer.