Changeset 245219 in webkit


Ignore:
Timestamp:
May 12, 2019 8:07:52 PM (5 years ago)
Author:
Simon Fraser
Message:

Add logging for RenderLayer clip rects
https://bugs.webkit.org/show_bug.cgi?id=197547

Reviewed by Zalan Bujtas.

Add a ClipRects log channel, and stream output for ClipRect and ClipRects.

The ClipRect code is performance sensitive, even in debug, so guard the log sites
with clipRectsLogEnabled() because the macro still evaluates its arguments even if
the channel is disabled (we need some better way to log that doesn't do this).

  • platform/Logging.h:
  • rendering/ClipRect.cpp:

(WebCore::operator<<):

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

(WebCore::operator<<):
(WebCore::RenderLayer::calculateClipRects const):

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r245218 r245219  
     12019-05-02  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add logging for RenderLayer clip rects
     4        https://bugs.webkit.org/show_bug.cgi?id=197547
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Add a ClipRects log channel, and stream output for ClipRect and ClipRects.
     9
     10        The ClipRect code is performance sensitive, even in debug, so guard the log sites
     11        with clipRectsLogEnabled() because the macro still evaluates its arguments even if
     12        the channel is disabled (we need some better way to log that doesn't do this).
     13
     14        * platform/Logging.h:
     15        * rendering/ClipRect.cpp:
     16        (WebCore::operator<<):
     17        * rendering/ClipRect.h:
     18        * rendering/RenderLayer.cpp:
     19        (WebCore::operator<<):
     20        (WebCore::RenderLayer::calculateClipRects const):
     21        * rendering/RenderLayer.h:
     22
    1232019-05-12  Simon Fraser  <simon.fraser@apple.com>
    224
  • trunk/Source/WebCore/platform/Logging.h

    r245019 r245219  
    4343    M(ApplePay) \
    4444    M(Archives) \
     45    M(ClipRects) \
    4546    M(Compositing) \
    4647    M(ContentFiltering) \
  • trunk/Source/WebCore/rendering/ClipRect.cpp

    r245019 r245219  
    3939}
    4040
     41TextStream& operator<<(TextStream& ts, const ClipRect& clipRect)
     42{
     43    ts << "rect ";
     44    if (clipRect.isInfinite())
     45        ts << "infinite";
     46    else
     47        ts << clipRect.rect();
     48
     49    if (clipRect.affectedByRadius())
     50        ts << " affected by radius";
     51    return ts;
    4152}
     53
     54}
  • trunk/Source/WebCore/rendering/ClipRect.h

    r245019 r245219  
    2727
    2828#include "LayoutRect.h"
     29
     30namespace WTF {
     31class TextStream;
     32}
    2933
    3034namespace WebCore {
     
    104108}
    105109
     110WTF::TextStream& operator<<(WTF::TextStream&, const ClipRect&);
     111
    106112} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r245212 r245219  
    269269}
    270270
     271#if !LOG_DISABLED
     272static TextStream& operator<<(TextStream& ts, const ClipRects& clipRects)
     273{
     274    TextStream::GroupScope scope(ts);
     275    ts << indent << "ClipRects\n";
     276    ts << indent << "  overflow  : " << clipRects.overflowClipRect() << "\n";
     277    ts << indent << "  fixed     : " << clipRects.fixedClipRect() << "\n";
     278    ts << indent << "  positioned: " << clipRects.posClipRect() << "\n";
     279
     280    return ts;
     281}
     282
     283static bool clipRectsLogEnabled()
     284{
     285    return LogClipRects.state == WTFLogChannelState::On;
     286}
     287#endif
     288
    271289RenderLayer::RenderLayer(RenderLayerModelObject& rendererLayerModelObject)
    272290    : m_isRenderViewLayer(rendererLayerModelObject.isRenderView())
     
    56035621        }
    56045622    }
     5623
     5624#if !LOG_DISABLED
     5625    if (clipRectsLogEnabled())
     5626        LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " calculateClipRects " << clipRects);
     5627#endif
    56055628}
    56065629
     
    56475670    if (parentRects->fixed() && &clipRectsContext.rootLayer->renderer() == &view && !backgroundClipRect.isInfinite())
    56485671        backgroundClipRect.moveBy(view.frameView().scrollPositionForFixedPosition());
     5672
     5673#if !LOG_DISABLED
     5674    if (clipRectsLogEnabled())
     5675        LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " backgroundClipRect with context " << clipRectsContext << " returning " << backgroundClipRect);
     5676#endif
    56495677    return backgroundClipRect;
    56505678}
     
    68096837}
    68106838
     6839TextStream& operator<<(WTF::TextStream& ts, ClipRectsType clipRectsType)
     6840{
     6841    switch (clipRectsType) {
     6842    case PaintingClipRects: ts << "painting"; break;
     6843    case RootRelativeClipRects: ts << "root-relative"; break;
     6844    case AbsoluteClipRects: ts << "absolute"; break;
     6845    case TemporaryClipRects: ts << "temporary"; break;
     6846    case NumCachedClipRectsTypes:
     6847    case AllClipRectTypes:
     6848        ts << "?";
     6849        break;
     6850    }
     6851    return ts;
     6852}
     6853
    68116854TextStream& operator<<(TextStream& ts, const RenderLayer& layer)
    68126855{
     
    68276870}
    68286871
     6872TextStream& operator<<(TextStream& ts, const RenderLayer::ClipRectsContext& context)
     6873{
     6874    ts.dumpProperty("root layer:", context.rootLayer);
     6875    ts.dumpProperty("type:", context.clipRectsType);
     6876    ts.dumpProperty("overflow-clip:", context.respectOverflowClip == IgnoreOverflowClip ? "ignore" : "respect");
     6877   
     6878    return ts;
     6879}
     6880
    68296881} // namespace WebCore
    68306882
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r245205 r245219  
    13851385bool compositedWithOwnBackingStore(const RenderLayer&);
    13861386
     1387WTF::TextStream& operator<<(WTF::TextStream&, ClipRectsType);
    13871388WTF::TextStream& operator<<(WTF::TextStream&, const RenderLayer&);
     1389WTF::TextStream& operator<<(WTF::TextStream&, const RenderLayer::ClipRectsContext&);
    13881390
    13891391} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.