Changeset 215964 in webkit


Ignore:
Timestamp:
Apr 28, 2017, 5:48:11 PM (8 years ago)
Author:
Simon Fraser
Message:

Enhance showLayerTree() to show fragments
https://bugs.webkit.org/show_bug.cgi?id=171469

Reviewed by Zalan Bujtas.

Have showLayerTree() dump fragments, like:

normal flow list(1)

layer 0x11c1879c0 at (0,0) size 700x1858 backgroundClip at (0,0) size 2120x779 clip at (0,0) size 2120x779

fragment 0: bounds in layer at (0,0) size 700x1858 fragment bounds at (0,0) size 700x779
fragment 1: bounds in layer at (710,-779) size 700x1858 fragment bounds at (710,0) size 700x779
fragment 2: bounds in layer at (1420,-1558) size 700x1858 fragment bounds at (1420,0) size 700x300

RenderMultiColumnFlowThread 0x11f1f3340 at (0,0) size 700x1858

We want these to show before the child renderers, so factor that code into writeLayerRenderers().

Overloading of write() for layers doesn't help anyone, so call it writeLayer() for searchability.

  • rendering/RenderLayer.cpp:

(WebCore::showLayerTree):

  • rendering/RenderLayer.h:
  • rendering/RenderTreeAsText.cpp:

(WebCore::writeLayer):
(WebCore::writeLayerRenderers):
(WebCore::writeLayers):

  • rendering/RenderTreeAsText.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r215963 r215964  
     12017-04-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enhance showLayerTree() to show fragments
     4        https://bugs.webkit.org/show_bug.cgi?id=171469
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Have showLayerTree() dump fragments, like:
     9
     10             normal flow list(1)
     11              layer 0x11c1879c0 at (0,0) size 700x1858 backgroundClip at (0,0) size 2120x779 clip at (0,0) size 2120x779
     12                   fragment 0: bounds in layer at (0,0) size 700x1858 fragment bounds at (0,0) size 700x779
     13                   fragment 1: bounds in layer at (710,-779) size 700x1858 fragment bounds at (710,0) size 700x779
     14                   fragment 2: bounds in layer at (1420,-1558) size 700x1858 fragment bounds at (1420,0) size 700x300
     15                RenderMultiColumnFlowThread 0x11f1f3340 at (0,0) size 700x1858
     16
     17        We want these to show before the child renderers, so factor that code into writeLayerRenderers().
     18       
     19        Overloading of write() for layers doesn't help anyone, so call it writeLayer() for searchability.
     20
     21        * rendering/RenderLayer.cpp:
     22        (WebCore::showLayerTree):
     23        * rendering/RenderLayer.h:
     24        * rendering/RenderTreeAsText.cpp:
     25        (WebCore::writeLayer):
     26        (WebCore::writeLayerRenderers):
     27        (WebCore::writeLayers):
     28        * rendering/RenderTreeAsText.h:
     29
    1302017-04-28  Simon Fraser  <simon.fraser@apple.com>
    231
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r214819 r215964  
    72057205        return;
    72067206
    7207     WTF::String output = externalRepresentation(&layer->renderer().frame(), WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers | WebCore::RenderAsTextShowAddresses | WebCore::RenderAsTextShowIDAndClass | WebCore::RenderAsTextDontUpdateLayout | WebCore::RenderAsTextShowLayoutState | WebCore::RenderAsTextShowOverflow | WebCore::RenderAsTextShowSVGGeometry);
     7207    WTF::String output = externalRepresentation(&layer->renderer().frame(), WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers | WebCore::RenderAsTextShowAddresses | WebCore::RenderAsTextShowIDAndClass | WebCore::RenderAsTextDontUpdateLayout | WebCore::RenderAsTextShowLayoutState | WebCore::RenderAsTextShowOverflow | WebCore::RenderAsTextShowSVGGeometry | WebCore::RenderAsTextShowLayerFragments);
    72087208    fprintf(stderr, "%s\n", output.utf8().data());
    72097209}
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r213466 r215964  
    529529        ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutSize& offsetFromRoot) const;
    530530
     531    // Public just for RenderTreeAsText.
     532    void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
     533        PaginationInclusionMode,
     534        ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip, const LayoutSize& offsetFromRoot,
     535        const LayoutRect* layerBoundingBox = nullptr, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
     536       
    531537    LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
    532538    LayoutRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space.
     
    831837    void paintList(Vector<RenderLayer*>*, GraphicsContext&, const LayerPaintingInfo&, PaintLayerFlags);
    832838
    833     void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
    834         PaginationInclusionMode,
    835         ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip, const LayoutSize& offsetFromRoot,
    836         const LayoutRect* layerBoundingBox = nullptr, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
    837839    void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo&, PaintLayerFlags, bool shouldPaintContent, const LayoutSize& offsetFromRoot);
    838840    void paintBackgroundForFragments(const LayerFragments&, GraphicsContext&, GraphicsContext& transparencyLayerContext,
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r215963 r215964  
    611611};
    612612
    613 static void write(TextStream& ts, const RenderLayer& layer, const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const LayoutRect& clipRect,
     613static void writeLayer(TextStream& ts, const RenderLayer& layer, const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const LayoutRect& clipRect,
    614614    LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
    615615{
     
    673673   
    674674    ts << "\n";
    675 
     675}
     676
     677static void writeLayerRenderers(TextStream& ts, const RenderLayer& layer, LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
     678{
    676679    if (paintPhase != LayerPaintPhaseBackground)
    677680        write(ts, layer.renderer(), indent + 1, behavior);
     
    771774    ClipRect damageRect;
    772775    ClipRect clipRectToApply;
    773     layer.calculateRects(RenderLayer::ClipRectsContext(&rootLayer, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, layer.offsetFromAncestor(&rootLayer));
     776    LayoutSize offsetFromRoot = layer.offsetFromAncestor(&rootLayer);
     777    layer.calculateRects(RenderLayer::ClipRectsContext(&rootLayer, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, offsetFromRoot);
    774778
    775779    // Ensure our lists are up-to-date.
     
    779783    Vector<RenderLayer*>* negativeZOrderList = layer.negZOrderList();
    780784    bool paintsBackgroundSeparately = negativeZOrderList && negativeZOrderList->size() > 0;
    781     if (shouldPaint && paintsBackgroundSeparately)
    782         write(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), LayerPaintPhaseBackground, indent, behavior);
    783 
     785    if (shouldPaint && paintsBackgroundSeparately) {
     786        writeLayer(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), LayerPaintPhaseBackground, indent, behavior);
     787        writeLayerRenderers(ts, layer, paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
     788    }
     789       
    784790    if (negativeZOrderList) {
    785791        int currIndent = indent;
     
    794800    }
    795801
    796     if (shouldPaint)
    797         write(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
    798 
     802    if (shouldPaint) {
     803        writeLayer(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
     804       
     805        if (behavior & RenderAsTextShowLayerFragments) {
     806            LayerFragments layerFragments;
     807            layer.collectFragments(layerFragments, &rootLayer, paintDirtyRect, RenderLayer::PaginationInclusionMode::ExcludeCompositedPaginatedLayers, TemporaryClipRects, IgnoreOverlayScrollbarSize, RespectOverflowClip, offsetFromRoot);
     808           
     809            if (layerFragments.size() > 1) {
     810                for (unsigned i = 0; i < layerFragments.size(); ++i) {
     811                    const auto& fragment = layerFragments[i];
     812                    writeIndent(ts, indent + 2);
     813                    ts << " fragment " << i << ": bounds in layer " << fragment.layerBounds << " fragment bounds " << fragment.boundingBox << "\n";
     814                }
     815            }
     816        }
     817       
     818        writeLayerRenderers(ts, layer, paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
     819    }
     820   
    799821    if (Vector<RenderLayer*>* normalFlowList = layer.normalFlowList()) {
    800822        int currIndent = indent;
  • trunk/Source/WebCore/rendering/RenderTreeAsText.h

    r208668 r215964  
    4747    RenderAsTextShowOverflow            = 1 << 8, // Print layout and visual overflow.
    4848    RenderAsTextShowSVGGeometry         = 1 << 9, // Print additional geometry for SVG objects.
     49    RenderAsTextShowLayerFragments      = 1 << 10, // Print additional info about fragmented RenderLayers
    4950};
    5051typedef unsigned RenderAsTextBehavior;
Note: See TracChangeset for help on using the changeset viewer.