⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 277358 in webkit


Ignore:
Timestamp:
May 11, 2021, 11:04:18 PM (5 years ago)
Author:
Cameron McCormack
Message:

Include reasons for compositing in showLayerTree output
https://bugs.webkit.org/show_bug.cgi?id=225640

Reviewed by Simon Fraser.

Source/WebCore:

Since it seems useful to know why a layer is composited.

The logging code was only including one reason, rather than the
whole set of reasons, and that's unchanged (except for the function
name to make that clearer), although we could also just make that
include all of the reasons too.

There were two reason strings missing, which are also added --
OverflowScrollPositioning and WillChange -- which the use of a
switch should help catch in the future.

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::logLayerInfo):
(WebCore::compositingReasonToString):
(WebCore::RenderLayerCompositor::logReasonsForCompositing):
(WebCore::operator<<):

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

LayoutTests:

  • fast/harness/render-tree-as-text-options-expected.txt:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r277345 r277358  
     12021-05-11  Cameron McCormack  <heycam@apple.com>
     2
     3        Include reasons for compositing in showLayerTree output
     4        https://bugs.webkit.org/show_bug.cgi?id=225640
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/harness/render-tree-as-text-options-expected.txt:
     9
    1102021-05-11  Toshio Ogasawara  <toshio.ogasawara@access-company.com>
    211
  • trunk/LayoutTests/fast/harness/render-tree-as-text-options-expected.txt

    r244599 r277358  
    1 layer at (0,0) size 800x600 (composited, bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
     1layer at (0,0) size 800x600 (composited [root], bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
    22  RenderView at (0,0) size 800x600
    33 positive z-order list (1)
    4   layer at (0,0) size 800x516 layerType: background only (composited, bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
     4  layer at (0,0) size 800x516 layerType: background only (composited [negative z-index children], bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
    55   negative z-order list (1)
    6     layer at (8,258) size 102x52 (composited, bounds=at (0,0) size 102x52, drawsContent=1, paints into ancestor=0)
     6    layer at (8,258) size 102x52 (composited [3D transform], bounds=at (0,0) size 102x52, drawsContent=1, paints into ancestor=0)
    77      RenderBlock (positioned) zI: -1 {DIV} at (8,258) size 102x52 [border: (1px solid #000000)]
    8   layer at (0,0) size 800x516 layerType: foreground only (composited, bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
     8  layer at (0,0) size 800x516 layerType: foreground only (composited [negative z-index children], bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
    99    RenderBlock {HTML} at (0,0) size 800x516
    1010      RenderBody {BODY} at (8,8) size 784x500
  • trunk/Source/WebCore/ChangeLog

    r277357 r277358  
     12021-05-11  Cameron McCormack  <heycam@apple.com>
     2
     3        Include reasons for compositing in showLayerTree output
     4        https://bugs.webkit.org/show_bug.cgi?id=225640
     5
     6        Reviewed by Simon Fraser.
     7
     8        Since it seems useful to know why a layer is composited.
     9
     10        The logging code was only including one reason, rather than the
     11        whole set of reasons, and that's unchanged (except for the function
     12        name to make that clearer), although we could also just make that
     13        include all of the reasons too.
     14
     15        There were two reason strings missing, which are also added --
     16        OverflowScrollPositioning and WillChange -- which the use of a
     17        switch should help catch in the future.
     18
     19        * rendering/RenderLayerCompositor.cpp:
     20        (WebCore::RenderLayerCompositor::logLayerInfo):
     21        (WebCore::compositingReasonToString):
     22        (WebCore::RenderLayerCompositor::logReasonsForCompositing):
     23        (WebCore::operator<<):
     24        * rendering/RenderLayerCompositor.h:
     25        * rendering/RenderTreeAsText.cpp:
     26
    1272021-05-11  Chris Dumez  <cdumez@apple.com>
    228
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r276744 r277358  
    15381538        logString.append(" z-index: ", layer.renderer().style().usedZIndex());
    15391539
    1540     logString.append(" (", logReasonsForCompositing(layer), ") ");
     1540    logString.append(" (", logOneReasonForCompositing(layer), ") ");
    15411541
    15421542    if (backing->graphicsLayer()->contentsOpaque() || backing->paintsIntoCompositedAncestor() || backing->foregroundLayer() || backing->backgroundLayer()) {
     
    27712771}
    27722772
     2773static const char* compositingReasonToString(CompositingReason reason)
     2774{
     2775    switch (reason) {
     2776    case CompositingReason::Transform3D: return "3D transform";
     2777    case CompositingReason::Video: return "video";
     2778    case CompositingReason::Canvas: return "canvas";
     2779    case CompositingReason::Plugin: return "plugin";
     2780    case CompositingReason::IFrame: return "iframe";
     2781    case CompositingReason::BackfaceVisibilityHidden: return "backface-visibility: hidden";
     2782    case CompositingReason::ClipsCompositingDescendants: return "clips compositing descendants";
     2783    case CompositingReason::Animation: return "animation";
     2784    case CompositingReason::Filters: return "filters";
     2785    case CompositingReason::PositionFixed: return "position: fixed";
     2786    case CompositingReason::PositionSticky: return "position: sticky";
     2787    case CompositingReason::OverflowScrolling: return "async overflow scrolling";
     2788    case CompositingReason::Stacking: return "stacking";
     2789    case CompositingReason::Overlap: return "overlap";
     2790    case CompositingReason::OverflowScrollPositioning: return "overflow scroll positioning";
     2791    case CompositingReason::NegativeZIndexChildren: return "negative z-index children";
     2792    case CompositingReason::TransformWithCompositedDescendants: return "transform with composited descendants";
     2793    case CompositingReason::OpacityWithCompositedDescendants: return "opacity with composited descendants";
     2794    case CompositingReason::MaskWithCompositedDescendants: return "mask with composited descendants";
     2795    case CompositingReason::ReflectionWithCompositedDescendants: return "reflection with composited descendants";
     2796    case CompositingReason::FilterWithCompositedDescendants: return "filter with composited descendants";
     2797    case CompositingReason::BlendingWithCompositedDescendants: return "blending with composited descendants";
     2798    case CompositingReason::IsolatesCompositedBlendingDescendants: return "isolates composited blending descendants";
     2799    case CompositingReason::Perspective: return "perspective";
     2800    case CompositingReason::Preserve3D: return "preserve-3d";
     2801    case CompositingReason::WillChange: return "will-change";
     2802    case CompositingReason::Root: return "root";
     2803    case CompositingReason::Model: return "model";
     2804    }
     2805    return "";
     2806}
     2807
    27732808#if !LOG_DISABLED
    2774 const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer& layer)
    2775 {
    2776     OptionSet<CompositingReason> reasons = reasonsForCompositing(layer);
    2777 
    2778     if (reasons & CompositingReason::Transform3D)
    2779         return "3D transform";
    2780 
    2781     if (reasons & CompositingReason::Video)
    2782         return "video";
    2783 
    2784     if (reasons & CompositingReason::Canvas)
    2785         return "canvas";
    2786 
    2787     if (reasons & CompositingReason::Plugin)
    2788         return "plugin";
    2789 
    2790     if (reasons & CompositingReason::IFrame)
    2791         return "iframe";
    2792 
    2793     if (reasons & CompositingReason::BackfaceVisibilityHidden)
    2794         return "backface-visibility: hidden";
    2795 
    2796     if (reasons & CompositingReason::ClipsCompositingDescendants)
    2797         return "clips compositing descendants";
    2798 
    2799     if (reasons & CompositingReason::Animation)
    2800         return "animation";
    2801 
    2802     if (reasons & CompositingReason::Filters)
    2803         return "filters";
    2804 
    2805     if (reasons & CompositingReason::PositionFixed)
    2806         return "position: fixed";
    2807 
    2808     if (reasons & CompositingReason::PositionSticky)
    2809         return "position: sticky";
    2810 
    2811     if (reasons & CompositingReason::OverflowScrolling)
    2812         return "async overflow scrolling";
    2813 
    2814     if (reasons & CompositingReason::Stacking)
    2815         return "stacking";
    2816 
    2817     if (reasons & CompositingReason::Overlap)
    2818         return "overlap";
    2819 
    2820     if (reasons & CompositingReason::NegativeZIndexChildren)
    2821         return "negative z-index children";
    2822 
    2823     if (reasons & CompositingReason::TransformWithCompositedDescendants)
    2824         return "transform with composited descendants";
    2825 
    2826     if (reasons & CompositingReason::OpacityWithCompositedDescendants)
    2827         return "opacity with composited descendants";
    2828 
    2829     if (reasons & CompositingReason::MaskWithCompositedDescendants)
    2830         return "mask with composited descendants";
    2831 
    2832     if (reasons & CompositingReason::ReflectionWithCompositedDescendants)
    2833         return "reflection with composited descendants";
    2834 
    2835     if (reasons & CompositingReason::FilterWithCompositedDescendants)
    2836         return "filter with composited descendants";
    2837 
    2838 #if ENABLE(CSS_COMPOSITING)
    2839     if (reasons & CompositingReason::BlendingWithCompositedDescendants)
    2840         return "blending with composited descendants";
    2841 
    2842     if (reasons & CompositingReason::IsolatesCompositedBlendingDescendants)
    2843         return "isolates composited blending descendants";
    2844 #endif
    2845 
    2846     if (reasons & CompositingReason::Perspective)
    2847         return "perspective";
    2848 
    2849     if (reasons & CompositingReason::Preserve3D)
    2850         return "preserve-3d";
    2851 
    2852     if (reasons & CompositingReason::Root)
    2853         return "root";
    2854 
    2855     if (reasons & CompositingReason::Model)
    2856         return "model";
    2857 
     2809const char* RenderLayerCompositor::logOneReasonForCompositing(const RenderLayer& layer)
     2810{
     2811    for (auto reason : reasonsForCompositing(layer))
     2812        return compositingReasonToString(reason);
    28582813    return "";
    28592814}
     
    50565011}
    50575012
     5013TextStream& operator<<(TextStream& ts, CompositingReason compositingReason)
     5014{
     5015    return ts << compositingReasonToString(compositingReason);
     5016}
     5017
    50585018#if PLATFORM(IOS_FAMILY)
    50595019typedef HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>> LayerMap;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r276085 r277358  
    570570
    571571#if !LOG_DISABLED
    572     const char* logReasonsForCompositing(const RenderLayer&);
     572    const char* logOneReasonForCompositing(const RenderLayer&);
    573573    void logLayerInfo(const RenderLayer&, const char*, int depth);
    574574#endif
     
    655655WTF::TextStream& operator<<(WTF::TextStream&, CompositingUpdateType);
    656656WTF::TextStream& operator<<(WTF::TextStream&, CompositingPolicy);
     657WTF::TextStream& operator<<(WTF::TextStream&, CompositingReason);
    657658
    658659} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r276576 r277358  
    690690    if (behavior.contains(RenderAsTextFlag::ShowCompositedLayers)) {
    691691        if (layer.isComposited()) {
    692             ts << " (composited, bounds=" << layer.backing()->compositedBounds() << ", drawsContent=" << layer.backing()->graphicsLayer()->drawsContent()
     692            ts << " (composited " << layer.compositor().reasonsForCompositing(layer)
     693                << ", bounds=" << layer.backing()->compositedBounds()
     694                << ", drawsContent=" << layer.backing()->graphicsLayer()->drawsContent()
    693695                << ", paints into ancestor=" << layer.backing()->paintsIntoCompositedAncestor() << ")";
    694696        } else if (layer.paintsIntoProvidedBacking())
Note: See TracChangeset for help on using the changeset viewer.