Changeset 237139 in webkit


Ignore:
Timestamp:
Oct 15, 2018, 1:09:15 PM (7 years ago)
Author:
Simon Fraser
Message:

Add compact logging for the paint-order RenderLayer tree
https://bugs.webkit.org/show_bug.cgi?id=190592

Reviewed by Zalan Bujtas.

Add a way to dump the RenderLayer tree in paint order, which will be extended in future
to show more dirty bit state.

  • rendering/RenderLayer.cpp:

(WebCore::outputPaintOrderTreeLegend):
(WebCore::outputIdent):
(WebCore::outputPaintOrderTreeRecursive):
(WebCore::showPaintOrderTree):

  • rendering/RenderLayer.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r237138 r237139  
     12018-10-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add compact logging for the paint-order RenderLayer tree
     4        https://bugs.webkit.org/show_bug.cgi?id=190592
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Add a way to dump the RenderLayer tree in paint order, which will be extended in future
     9        to show more dirty bit state.
     10
     11        * rendering/RenderLayer.cpp:
     12        (WebCore::outputPaintOrderTreeLegend):
     13        (WebCore::outputIdent):
     14        (WebCore::outputPaintOrderTreeRecursive):
     15        (WebCore::showPaintOrderTree):
     16        * rendering/RenderLayer.h:
     17
    1182018-10-15  Alex Christensen  <achristensen@webkit.org>
    219
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r237124 r237139  
    65816581}
    65826582
     6583static void outputPaintOrderTreeLegend(TextStream& stream)
     6584{
     6585    stream.nextLine();
     6586    stream << "(S)tacking Context, (N)ormal flow only, (O)verflow clip, (A)lpha (opacity or mask), (T)ransform-ish, (F)ilter, Fi(X)ed position, (C)omposited\n"
     6587        "Dirty (z)-lists, Dirty (n)ormal flow lists";
     6588    stream.nextLine();
     6589}
     6590
     6591static void outputIdent(TextStream& stream, unsigned depth)
     6592{
     6593    unsigned i = 0;
     6594    while (++i <= depth * 2)
     6595        stream << " ";
     6596}
     6597
     6598static void outputPaintOrderTreeRecursive(TextStream& stream, const WebCore::RenderLayer& layer, const char* prefix, unsigned depth = 0)
     6599{
     6600    stream << (layer.isStackingContext() ? "S" : "-");
     6601    stream << (layer.isNormalFlowOnly() ? "N" : "-");
     6602    stream << (layer.renderer().hasOverflowClip() ? "O" : "-");
     6603    stream << (layer.isTransparent() ? "A" : "-");
     6604    stream << (layer.renderer().hasTransformRelatedProperty() ? "T" : "-");
     6605    stream << (layer.hasFilter() ? "F" : "-");
     6606    stream << (layer.renderer().isFixedPositioned() ? "X" : "-");
     6607    stream << (layer.isComposited() ? "C" : "-");
     6608
     6609    stream << " ";
     6610
     6611    stream << (layer.zOrderListsDirty() ? "z" : "-");
     6612    stream << (layer.normalFlowListDirty() ? "n" : "-");
     6613
     6614    outputIdent(stream, depth);
     6615
     6616    stream << prefix;
     6617
     6618    auto layerRect = layer.rect();
     6619
     6620    stream << &layer << " " << layerRect;
     6621    stream.nextLine();
     6622
     6623    const_cast<WebCore::RenderLayer&>(layer).updateLayerListsIfNeeded();
     6624
     6625    for (auto* child : layer.negativeZOrderLayers())
     6626        outputPaintOrderTreeRecursive(stream, *child, "- ", depth + 1);
     6627
     6628    for (auto* child : layer.normalFlowLayers())
     6629        outputPaintOrderTreeRecursive(stream, *child, "n ", depth + 1);
     6630
     6631    for (auto* child : layer.positiveZOrderLayers())
     6632        outputPaintOrderTreeRecursive(stream, *child, "+ ", depth + 1);
     6633}
     6634
     6635void showPaintOrderTree(const WebCore::RenderLayer* layer)
     6636{
     6637    TextStream stream;
     6638    outputPaintOrderTreeLegend(stream);
     6639    if (layer)
     6640        outputPaintOrderTreeRecursive(stream, *layer, "");
     6641   
     6642    WTFLogAlways("%s", stream.release().utf8().data());
     6643}
     6644
    65836645#endif
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r237124 r237139  
    183183    void dirtyStackingContextZOrderLists();
    184184
     185    bool normalFlowListDirty() const { return m_normalFlowListDirty; }
     186    bool zOrderListsDirty() const { return m_zOrderListsDirty; }
     187
    185188    class LayerList {
    186189        friend class RenderLayer;
     
    12251228// Outside the WebCore namespace for ease of invocation from lldb.
    12261229void showLayerTree(const WebCore::RenderLayer*);
     1230void showPaintOrderTree(const WebCore::RenderLayer*);
    12271231void showLayerTree(const WebCore::RenderObject*);
    12281232#endif
Note: See TracChangeset for help on using the changeset viewer.