Title: [245219] trunk/Source/WebCore
Revision
245219
Author
[email protected]
Date
2019-05-12 20:07:52 -0700 (Sun, 12 May 2019)

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (245218 => 245219)


--- trunk/Source/WebCore/ChangeLog	2019-05-13 03:01:25 UTC (rev 245218)
+++ trunk/Source/WebCore/ChangeLog	2019-05-13 03:07:52 UTC (rev 245219)
@@ -1,3 +1,25 @@
+2019-05-02  Simon Fraser  <[email protected]>
+
+        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:
+
 2019-05-12  Simon Fraser  <[email protected]>
 
         Refactor composited backing-sharing code

Modified: trunk/Source/WebCore/platform/Logging.h (245218 => 245219)


--- trunk/Source/WebCore/platform/Logging.h	2019-05-13 03:01:25 UTC (rev 245218)
+++ trunk/Source/WebCore/platform/Logging.h	2019-05-13 03:07:52 UTC (rev 245219)
@@ -42,6 +42,7 @@
     M(Animations) \
     M(ApplePay) \
     M(Archives) \
+    M(ClipRects) \
     M(Compositing) \
     M(ContentFiltering) \
     M(ContentObservation) \

Modified: trunk/Source/WebCore/rendering/ClipRect.cpp (245218 => 245219)


--- trunk/Source/WebCore/rendering/ClipRect.cpp	2019-05-13 03:01:25 UTC (rev 245218)
+++ trunk/Source/WebCore/rendering/ClipRect.cpp	2019-05-13 03:07:52 UTC (rev 245219)
@@ -38,4 +38,17 @@
     return hitTestLocation.intersects(m_rect);
 }
 
+TextStream& operator<<(TextStream& ts, const ClipRect& clipRect)
+{
+    ts << "rect ";
+    if (clipRect.isInfinite())
+        ts << "infinite";
+    else
+        ts << clipRect.rect();
+
+    if (clipRect.affectedByRadius())
+        ts << " affected by radius";
+    return ts;
 }
+
+}

Modified: trunk/Source/WebCore/rendering/ClipRect.h (245218 => 245219)


--- trunk/Source/WebCore/rendering/ClipRect.h	2019-05-13 03:01:25 UTC (rev 245218)
+++ trunk/Source/WebCore/rendering/ClipRect.h	2019-05-13 03:07:52 UTC (rev 245219)
@@ -27,6 +27,10 @@
 
 #include "LayoutRect.h"
 
+namespace WTF {
+class TextStream;
+}
+
 namespace WebCore {
 
 class HitTestLocation;
@@ -103,4 +107,6 @@
     return c;
 }
 
+WTF::TextStream& operator<<(WTF::TextStream&, const ClipRect&);
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (245218 => 245219)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-05-13 03:01:25 UTC (rev 245218)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-05-13 03:07:52 UTC (rev 245219)
@@ -268,6 +268,24 @@
 #endif
 }
 
+#if !LOG_DISABLED
+static TextStream& operator<<(TextStream& ts, const ClipRects& clipRects)
+{
+    TextStream::GroupScope scope(ts);
+    ts << indent << "ClipRects\n";
+    ts << indent << "  overflow  : " << clipRects.overflowClipRect() << "\n";
+    ts << indent << "  fixed     : " << clipRects.fixedClipRect() << "\n";
+    ts << indent << "  positioned: " << clipRects.posClipRect() << "\n";
+
+    return ts;
+}
+
+static bool clipRectsLogEnabled()
+{
+    return LogClipRects.state == WTFLogChannelState::On;
+}
+#endif
+
 RenderLayer::RenderLayer(RenderLayerModelObject& rendererLayerModelObject)
     : m_isRenderViewLayer(rendererLayerModelObject.isRenderView())
     , m_forcedStackingContext(rendererLayerModelObject.isMedia())
@@ -5602,6 +5620,11 @@
             clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));
         }
     }
+
+#if !LOG_DISABLED
+    if (clipRectsLogEnabled())
+        LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " calculateClipRects " << clipRects);
+#endif
 }
 
 Ref<ClipRects> RenderLayer::parentClipRects(const ClipRectsContext& clipRectsContext) const
@@ -5646,6 +5669,11 @@
     // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite.
     if (parentRects->fixed() && &clipRectsContext.rootLayer->renderer() == &view && !backgroundClipRect.isInfinite())
         backgroundClipRect.moveBy(view.frameView().scrollPositionForFixedPosition());
+
+#if !LOG_DISABLED
+    if (clipRectsLogEnabled())
+        LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " backgroundClipRect with context " << clipRectsContext << " returning " << backgroundClipRect);
+#endif
     return backgroundClipRect;
 }
 
@@ -6808,6 +6836,21 @@
 #endif
 }
 
+TextStream& operator<<(WTF::TextStream& ts, ClipRectsType clipRectsType)
+{
+    switch (clipRectsType) {
+    case PaintingClipRects: ts << "painting"; break;
+    case RootRelativeClipRects: ts << "root-relative"; break;
+    case AbsoluteClipRects: ts << "absolute"; break;
+    case TemporaryClipRects: ts << "temporary"; break;
+    case NumCachedClipRectsTypes:
+    case AllClipRectTypes:
+        ts << "?";
+        break;
+    }
+    return ts;
+}
+
 TextStream& operator<<(TextStream& ts, const RenderLayer& layer)
 {
     ts << "RenderLayer " << &layer << " " << layer.size();
@@ -6826,6 +6869,15 @@
     return ts;
 }
 
+TextStream& operator<<(TextStream& ts, const RenderLayer::ClipRectsContext& context)
+{
+    ts.dumpProperty("root layer:", context.rootLayer);
+    ts.dumpProperty("type:", context.clipRectsType);
+    ts.dumpProperty("overflow-clip:", context.respectOverflowClip == IgnoreOverflowClip ? "ignore" : "respect");
+    
+    return ts;
+}
+
 } // namespace WebCore
 
 #if ENABLE(TREE_DEBUGGING)

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (245218 => 245219)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2019-05-13 03:01:25 UTC (rev 245218)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2019-05-13 03:07:52 UTC (rev 245219)
@@ -1384,7 +1384,9 @@
 
 bool compositedWithOwnBackingStore(const RenderLayer&);
 
+WTF::TextStream& operator<<(WTF::TextStream&, ClipRectsType);
 WTF::TextStream& operator<<(WTF::TextStream&, const RenderLayer&);
+WTF::TextStream& operator<<(WTF::TextStream&, const RenderLayer::ClipRectsContext&);
 
 } // namespace WebCore
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to