Title: [281238] trunk/Source
Revision
281238
Author
simon.fra...@apple.com
Date
2021-08-19 08:47:35 -0700 (Thu, 19 Aug 2021)

Log Message

Remove duplicate LayerTreeAsText enums and use an OptionSet<>
https://bugs.webkit.org/show_bug.cgi?id=229226

Reviewed by Antti Koivisto.

GraphicsLayerClient had enum LayerTreeAsTextBehaviorFlags and Frame had an anonymous
enum and typedef unsigned LayerTreeFlags. Clean up by adding LayerTreeAsTextOptions.h
and using OptionSet<LayerTreeAsTextOptions> everywhere.

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* page/Frame.h:
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::shouldSkipLayerInDump const):
* page/PageOverlayController.h:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::dumpLayer const):
(WebCore::dumpChildren):
(WebCore::GraphicsLayer::dumpProperties const):
(WebCore::GraphicsLayer::layerTreeAsText const):
(showGraphicsLayerTree):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::dumpLayer):
(WebCore::GraphicsLayer::layerTreeAsText):
(WebCore::GraphicsLayer::dumpAdditionalProperties const):
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::shouldSkipLayerInDump const):
(WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
* platform/graphics/LayerTreeAsTextOptions.h: Added.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::dumpInnerLayer):
(WebCore::CoordinatedGraphicsLayer::dumpAdditionalProperties const):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldSkipLayerInDump const):
(WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerTreeAsText):
* rendering/RenderLayerCompositor.h:
* testing/Internals.cpp:
(WebCore::toLayerTreeAsTextOptions):
(WebCore::Internals::layerTreeAsText const):
(WebCore::Internals::pageOverlayLayerTreeAsText const):
(WebCore::toLayerTreeFlags): Deleted.
* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::layerTreeAsText):
* testing/MockPageOverlayClient.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281237 => 281238)


--- trunk/Source/WebCore/ChangeLog	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/ChangeLog	2021-08-19 15:47:35 UTC (rev 281238)
@@ -1,5 +1,59 @@
 2021-08-19  Simon Fraser  <simon.fra...@apple.com>
 
+        Remove duplicate LayerTreeAsText enums and use an OptionSet<>
+        https://bugs.webkit.org/show_bug.cgi?id=229226
+
+        Reviewed by Antti Koivisto.
+
+        GraphicsLayerClient had enum LayerTreeAsTextBehaviorFlags and Frame had an anonymous
+        enum and typedef unsigned LayerTreeFlags. Clean up by adding LayerTreeAsTextOptions.h
+        and using OptionSet<LayerTreeAsTextOptions> everywhere.
+
+        * Headers.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/Frame.h:
+        * page/PageOverlayController.cpp:
+        (WebCore::PageOverlayController::shouldSkipLayerInDump const):
+        * page/PageOverlayController.h:
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::dumpLayer const):
+        (WebCore::dumpChildren):
+        (WebCore::GraphicsLayer::dumpProperties const):
+        (WebCore::GraphicsLayer::layerTreeAsText const):
+        (showGraphicsLayerTree):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::dumpLayer):
+        (WebCore::GraphicsLayer::layerTreeAsText):
+        (WebCore::GraphicsLayer::dumpAdditionalProperties const):
+        * platform/graphics/GraphicsLayerClient.h:
+        (WebCore::GraphicsLayerClient::shouldSkipLayerInDump const):
+        (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
+        * platform/graphics/LayerTreeAsTextOptions.h: Added.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::dumpInnerLayer):
+        (WebCore::CoordinatedGraphicsLayer::dumpAdditionalProperties const):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::shouldSkipLayerInDump const):
+        (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::layerTreeAsText):
+        * rendering/RenderLayerCompositor.h:
+        * testing/Internals.cpp:
+        (WebCore::toLayerTreeAsTextOptions):
+        (WebCore::Internals::layerTreeAsText const):
+        (WebCore::Internals::pageOverlayLayerTreeAsText const):
+        (WebCore::toLayerTreeFlags): Deleted.
+        * testing/MockPageOverlayClient.cpp:
+        (WebCore::MockPageOverlayClient::layerTreeAsText):
+        * testing/MockPageOverlayClient.h:
+
+2021-08-19  Simon Fraser  <simon.fra...@apple.com>
+
         Use an enum for the forVisitedLink argument to BuilderState::colorFromPrimitiveValue()
         https://bugs.webkit.org/show_bug.cgi?id=229224
 

Modified: trunk/Source/WebCore/Headers.cmake (281237 => 281238)


--- trunk/Source/WebCore/Headers.cmake	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/Headers.cmake	2021-08-19 15:47:35 UTC (rev 281238)
@@ -1280,6 +1280,7 @@
     platform/graphics/IntRectHash.h
     platform/graphics/IntSize.h
     platform/graphics/IntSizeHash.h
+    platform/graphics/LayerTreeAsTextOptions.h
     platform/graphics/LayoutPoint.h
     platform/graphics/LayoutRect.h
     platform/graphics/LayoutSize.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (281237 => 281238)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-08-19 15:47:35 UTC (rev 281238)
@@ -316,6 +316,7 @@
 		0F4966AB1DB40C4300A274BB /* JSDOMPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A51DB40C4300A274BB /* JSDOMPoint.h */; };
 		0F4966AD1DB40C4300A274BB /* JSDOMPointInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */; };
 		0F4966AF1DB40C4300A274BB /* JSDOMPointReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */; };
+		0F4D5D1826CCC4AE00A9DFC1 /* LayerTreeAsTextOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F736ECA26CCB97A000AD7CA /* LayerTreeAsTextOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F53FB84213B7A6400C40D34 /* RenderLayerScrollableArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F53FB84213B786400C40D34 /* RenderLayerScrollableArea.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F54DCE61881051D003EEDBB /* TextAutoSizing.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCE41881051D003EEDBB /* TextAutoSizing.h */; };
 		0F54DD081881D5F5003EEDBB /* Touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F54DD051881D5F5003EEDBB /* Touch.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6227,6 +6228,7 @@
 		0F6B7077237BC12F0052CA47 /* CSSUnits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSUnits.h; sourceTree = "<group>"; };
 		0F6B7079237BC12F0052CA47 /* CSSUnits.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnits.cpp; sourceTree = "<group>"; };
 		0F70495D211B524200369968 /* ActivityState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ActivityState.cpp; sourceTree = "<group>"; };
+		0F736ECA26CCB97A000AD7CA /* LayerTreeAsTextOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayerTreeAsTextOptions.h; sourceTree = "<group>"; };
 		0F73B765222B327F00805316 /* ScrollingStateScrollingNodeMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingStateScrollingNodeMac.mm; sourceTree = "<group>"; };
 		0F790F3D2517CE6D009BA034 /* DisplayView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayView.cpp; sourceTree = "<group>"; };
 		0F790F3F2517CE6D009BA034 /* DisplayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayView.h; sourceTree = "<group>"; };
@@ -26654,6 +26656,7 @@
 				B27535470B053814002CE64F /* IntSize.h */,
 				B27535480B053814002CE64F /* IntSizeHash.h */,
 				65CC6BED16014EC0000ED27D /* Latin1TextIterator.h */,
+				0F736ECA26CCB97A000AD7CA /* LayerTreeAsTextOptions.h */,
 				0F36E7361BD1837A002DB891 /* LayoutPoint.cpp */,
 				141DC04B164834B900371E5A /* LayoutPoint.h */,
 				141DC04C164834B900371E5A /* LayoutRect.cpp */,
@@ -33404,6 +33407,7 @@
 				0FEC120C22BF2CD2004E9D35 /* LayerAncestorClippingStack.h in Headers */,
 				580371641A66F1D300BAF519 /* LayerFragment.h in Headers */,
 				7AA3A6A0194B59B6001CBD24 /* LayerPool.h in Headers */,
+				0F4D5D1826CCC4AE00A9DFC1 /* LayerTreeAsTextOptions.h in Headers */,
 				115CFA97208B952B001E6991 /* LayoutBox.h in Headers */,
 				11310CF620BA4A560065A8D0 /* LayoutChildIterator.h in Headers */,
 				1199FA46208E35A3002358CC /* LayoutContainerBox.h in Headers */,

Modified: trunk/Source/WebCore/page/Frame.h (281237 => 281238)


--- trunk/Source/WebCore/page/Frame.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/page/Frame.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -113,22 +113,6 @@
 using NodeQualifier = Function<Node* (const HitTestResult&, Node* terminationNode, IntRect* nodeBounds)>;
 #endif
 
-enum {
-    LayerTreeFlagsIncludeDebugInfo              = 1 << 0,
-    LayerTreeFlagsIncludeVisibleRects           = 1 << 1,
-    LayerTreeFlagsIncludeTileCaches             = 1 << 2,
-    LayerTreeFlagsIncludeRepaintRects           = 1 << 3,
-    LayerTreeFlagsIncludePaintingPhases         = 1 << 4,
-    LayerTreeFlagsIncludeContentLayers          = 1 << 5,
-    LayerTreeFlagsIncludeAcceleratesDrawing     = 1 << 6,
-    LayerTreeFlagsIncludeClipping               = 1 << 7,
-    LayerTreeFlagsIncludeBackingStoreAttached   = 1 << 8,
-    LayerTreeFlagsIncludeRootLayerProperties    = 1 << 9,
-    LayerTreeFlagsIncludeEventRegion            = 1 << 10,
-    LayerTreeFlagsIncludeDeepColor              = 1 << 11,
-};
-typedef unsigned LayerTreeFlags;
-
 // FIXME: Rename Frame to LocalFrame and AbstractFrame to Frame.
 class Frame final : public AbstractFrame {
 public:

Modified: trunk/Source/WebCore/page/PageOverlayController.cpp (281237 => 281238)


--- trunk/Source/WebCore/page/PageOverlayController.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/page/PageOverlayController.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -429,9 +429,9 @@
         layer->setBackgroundColor(overlay.backgroundColor());
 }
 
-bool PageOverlayController::shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior behavior) const
+bool PageOverlayController::shouldSkipLayerInDump(const GraphicsLayer*, OptionSet<LayerTreeAsTextOptions> options) const
 {
-    return !(behavior & LayerTreeAsTextIncludePageOverlayLayers);
+    return !options.contains(LayerTreeAsTextOptions::IncludePageOverlayLayers);
 }
 
 void PageOverlayController::tiledBackingUsageChanged(const GraphicsLayer* graphicsLayer, bool usingTiledBacking)

Modified: trunk/Source/WebCore/page/PageOverlayController.h (281237 => 281238)


--- trunk/Source/WebCore/page/PageOverlayController.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/page/PageOverlayController.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -95,7 +95,7 @@
     void notifyFlushRequired(const GraphicsLayer*) override;
     void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect& clipRect, GraphicsLayerPaintBehavior) override;
     float deviceScaleFactor() const override;
-    bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const override;
+    bool shouldSkipLayerInDump(const GraphicsLayer*, OptionSet<LayerTreeAsTextOptions>) const override;
     void tiledBackingUsageChanged(const GraphicsLayer*, bool) override;
 
     Page& m_page;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (281237 => 281238)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -826,36 +826,36 @@
         traverse(*maskLayer, traversalFunc);
 }
 
-void GraphicsLayer::dumpLayer(TextStream& ts, LayerTreeAsTextBehavior behavior) const
+void GraphicsLayer::dumpLayer(TextStream& ts, OptionSet<LayerTreeAsTextOptions> options) const
 {
     ts << indent << "(" << "GraphicsLayer";
 
-    if (behavior & LayerTreeAsTextDebug) {
+    if (options & LayerTreeAsTextOptions::Debug) {
         ts << " " << static_cast<void*>(const_cast<GraphicsLayer*>(this));
         ts << " \"" << m_name << "\"";
     }
 
     ts << "\n";
-    dumpProperties(ts, behavior);
+    dumpProperties(ts, options);
     ts << indent << ")\n";
 }
 
-static void dumpChildren(TextStream& ts, const Vector<Ref<GraphicsLayer>>& children, unsigned& totalChildCount, LayerTreeAsTextBehavior behavior)
+static void dumpChildren(TextStream& ts, const Vector<Ref<GraphicsLayer>>& children, unsigned& totalChildCount, OptionSet<LayerTreeAsTextOptions> options)
 {
     totalChildCount += children.size();
     for (auto& child : children) {
-        if ((behavior & LayerTreeAsTextDebug) || !child->client().shouldSkipLayerInDump(child.ptr(), behavior)) {
+        if ((options & LayerTreeAsTextOptions::Debug) || !child->client().shouldSkipLayerInDump(child.ptr(), options)) {
             TextStream::IndentScope indentScope(ts);
-            child->dumpLayer(ts, behavior);
+            child->dumpLayer(ts, options);
             continue;
         }
 
         totalChildCount--;
-        dumpChildren(ts, child->children(), totalChildCount, behavior);
+        dumpChildren(ts, child->children(), totalChildCount, options);
     }
 }
 
-void GraphicsLayer::dumpProperties(TextStream& ts, LayerTreeAsTextBehavior behavior) const
+void GraphicsLayer::dumpProperties(TextStream& ts, OptionSet<LayerTreeAsTextOptions> options) const
 {
     TextStream::IndentScope indentScope(ts);
     if (!m_offsetFromRenderer.isZero())
@@ -901,13 +901,13 @@
     if (m_supportsSubpixelAntialiasedText)
         ts << indent << "(supports subpixel antialiased text " << m_supportsSubpixelAntialiasedText << ")\n";
 
-    if (m_masksToBounds && behavior & LayerTreeAsTextIncludeClipping)
+    if (m_masksToBounds && options & LayerTreeAsTextOptions::IncludeClipping)
         ts << indent << "(clips " << m_masksToBounds << ")\n";
 
     if (m_preserves3D)
         ts << indent << "(preserves3D " << m_preserves3D << ")\n";
 
-    if (m_drawsContent && client().shouldDumpPropertyForLayer(this, "drawsContent", behavior))
+    if (m_drawsContent && client().shouldDumpPropertyForLayer(this, "drawsContent", options))
         ts << indent << "(drawsContent " << m_drawsContent << ")\n";
 
     if (!m_contentsVisible)
@@ -916,16 +916,16 @@
     if (!m_backfaceVisibility)
         ts << indent << "(backfaceVisibility " << (m_backfaceVisibility ? "visible" : "hidden") << ")\n";
 
-    if (behavior & LayerTreeAsTextDebug)
+    if (options & LayerTreeAsTextOptions::Debug)
         ts << indent << "(primary-layer-id " << primaryLayerID() << ")\n";
 
-    if (m_backgroundColor.isValid() && client().shouldDumpPropertyForLayer(this, "backgroundColor", behavior))
+    if (m_backgroundColor.isValid() && client().shouldDumpPropertyForLayer(this, "backgroundColor", options))
         ts << indent << "(backgroundColor " << serializationForRenderTreeAsText(m_backgroundColor) << ")\n";
 
-    if (behavior & LayerTreeAsTextIncludeAcceleratesDrawing && m_acceleratesDrawing)
+    if (options & LayerTreeAsTextOptions::IncludeAcceleratesDrawing && m_acceleratesDrawing)
         ts << indent << "(acceleratesDrawing " << m_acceleratesDrawing << ")\n";
 
-    if (behavior & LayerTreeAsTextIncludeBackingStoreAttached)
+    if (options & LayerTreeAsTextOptions::IncludeBackingStoreAttached)
         ts << indent << "(backingStoreAttached " << backingStoreAttachedForTesting() << ")\n";
 
     if (m_transform && !m_transform->isIdentity()) {
@@ -948,32 +948,32 @@
 
     if (m_maskLayer) {
         ts << indent << "(mask layer";
-        if (behavior & LayerTreeAsTextDebug)
+        if (options & LayerTreeAsTextOptions::Debug)
             ts << " " << m_maskLayer.get();
         ts << ")\n";
 
         TextStream::IndentScope indentScope(ts);
-        m_maskLayer->dumpLayer(ts, behavior);
+        m_maskLayer->dumpLayer(ts, options);
     }
 
     if (m_replicaLayer) {
         ts << indent << "(replica layer";
-        if (behavior & LayerTreeAsTextDebug)
+        if (options & LayerTreeAsTextOptions::Debug)
             ts << " " << m_replicaLayer.get();
         ts << ")\n";
 
         TextStream::IndentScope indentScope(ts);
-        m_replicaLayer->dumpLayer(ts, behavior);
+        m_replicaLayer->dumpLayer(ts, options);
     }
 
     if (m_replicatedLayer) {
         ts << indent << "(replicated layer";
-        if (behavior & LayerTreeAsTextDebug)
+        if (options & LayerTreeAsTextOptions::Debug)
             ts << " " << m_replicatedLayer;
         ts << ")\n";
     }
 
-    if (behavior & LayerTreeAsTextIncludeRepaintRects && repaintRectMap().contains(this) && !repaintRectMap().get(this).isEmpty() && client().shouldDumpPropertyForLayer(this, "repaintRects", behavior)) {
+    if (options & LayerTreeAsTextOptions::IncludeRepaintRects && repaintRectMap().contains(this) && !repaintRectMap().get(this).isEmpty() && client().shouldDumpPropertyForLayer(this, "repaintRects", options)) {
         ts << indent << "(repaint rects\n";
         for (size_t i = 0; i < repaintRectMap().get(this).size(); ++i) {
             if (repaintRectMap().get(this)[i].isEmpty())
@@ -990,20 +990,20 @@
         ts << indent << ")\n";
     }
 
-    if (behavior & LayerTreeAsTextIncludeEventRegion && !m_eventRegion.isEmpty()) {
+    if (options & LayerTreeAsTextOptions::IncludeEventRegion && !m_eventRegion.isEmpty()) {
         ts << indent << "(event region" << m_eventRegion;
         ts << indent << ")\n";
     }
     
 #if ENABLE(SCROLLING_THREAD)
-    if ((behavior & LayerTreeAsTextDebug) && m_scrollingNodeID)
+    if ((options & LayerTreeAsTextOptions::Debug) && m_scrollingNodeID)
         ts << indent << "(scrolling node " << m_scrollingNodeID << ")\n";
 #endif
 
-    if (behavior & LayerTreeAsTextIncludePaintingPhases && paintingPhase())
+    if (options & LayerTreeAsTextOptions::IncludePaintingPhases && paintingPhase())
         ts << indent << "(paintingPhases " << paintingPhase() << ")\n";
 
-    dumpAdditionalProperties(ts, behavior);
+    dumpAdditionalProperties(ts, options);
     
     if (m_children.size()) {
         TextStream childrenStream;
@@ -1010,7 +1010,7 @@
         
         childrenStream.increaseIndent(ts.indent());
         unsigned totalChildCount = 0;
-        dumpChildren(childrenStream, m_children, totalChildCount, behavior);
+        dumpChildren(childrenStream, m_children, totalChildCount, options);
 
         if (totalChildCount) {
             ts << indent << "(children " << totalChildCount << "\n";
@@ -1058,11 +1058,11 @@
     return ts;
 }
 
-String GraphicsLayer::layerTreeAsText(LayerTreeAsTextBehavior behavior) const
+String GraphicsLayer::layerTreeAsText(OptionSet<LayerTreeAsTextOptions> options) const
 {
     TextStream ts(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect);
 
-    dumpLayer(ts, behavior);
+    dumpLayer(ts, options);
     return ts.release();
 }
 
@@ -1074,7 +1074,7 @@
     if (!layer)
         return;
 
-    String output = layer->layerTreeAsText(WebCore::LayerTreeAsTextShowAll);
+    String output = layer->layerTreeAsText(WebCore::AllLayerTreeAsTextOptions);
     WTFLogAlways("%s\n", output.utf8().data());
 }
 #endif

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (281237 => 281238)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -540,7 +540,7 @@
     virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
     CompositingCoordinatesOrientation contentsOrientation() const { return m_contentsOrientation; }
 
-    void dumpLayer(WTF::TextStream&, LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const;
+    void dumpLayer(WTF::TextStream&, OptionSet<LayerTreeAsTextOptions> = { }) const;
 
     virtual void setShowDebugBorder(bool show) { m_showDebugBorder = show; }
     bool isShowingDebugBorder() const { return m_showDebugBorder; }
@@ -600,7 +600,7 @@
 
     // Return a string with a human readable form of the layer tree, If debug is true
     // pointers for the layers and timing data will be included in the returned string.
-    WEBCORE_EXPORT String layerTreeAsText(LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const;
+    WEBCORE_EXPORT String layerTreeAsText(OptionSet<LayerTreeAsTextOptions> = { }) const;
 
     // For testing.
     virtual String displayListAsText(DisplayList::AsTextFlags) const { return String(); }
@@ -679,8 +679,8 @@
 #endif
 
 
-    void dumpProperties(WTF::TextStream&, LayerTreeAsTextBehavior) const;
-    virtual void dumpAdditionalProperties(WTF::TextStream&, LayerTreeAsTextBehavior) const { }
+    void dumpProperties(WTF::TextStream&, OptionSet<LayerTreeAsTextOptions>) const;
+    virtual void dumpAdditionalProperties(WTF::TextStream&, OptionSet<LayerTreeAsTextOptions>) const { }
 
     WEBCORE_EXPORT virtual void getDebugBorderInfo(Color&, float& width) const;
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (281237 => 281238)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "LayerTreeAsTextOptions.h"
 #include "TiledBacking.h"
 #include "TransformationMatrix.h"
 #include <wtf/Forward.h>
@@ -68,25 +69,6 @@
     return property == AnimatedPropertyTransform || property == AnimatedPropertyTranslate || property == AnimatedPropertyScale || property == AnimatedPropertyRotate;
 }
 
-enum LayerTreeAsTextBehaviorFlags {
-    LayerTreeAsTextBehaviorNormal               = 0,
-    LayerTreeAsTextDebug                        = 1 << 0, // Dump extra debugging info like layer addresses.
-    LayerTreeAsTextIncludeVisibleRects          = 1 << 1,
-    LayerTreeAsTextIncludeTileCaches            = 1 << 2,
-    LayerTreeAsTextIncludeRepaintRects          = 1 << 3,
-    LayerTreeAsTextIncludePaintingPhases        = 1 << 4,
-    LayerTreeAsTextIncludeContentLayers         = 1 << 5,
-    LayerTreeAsTextIncludePageOverlayLayers     = 1 << 6,
-    LayerTreeAsTextIncludeAcceleratesDrawing    = 1 << 7,
-    LayerTreeAsTextIncludeClipping              = 1 << 8,
-    LayerTreeAsTextIncludeBackingStoreAttached  = 1 << 9,
-    LayerTreeAsTextIncludeRootLayerProperties   = 1 << 10,
-    LayerTreeAsTextIncludeEventRegion           = 1 << 11,
-    LayerTreeAsTextIncludeDeepColor             = 1 << 12,
-    LayerTreeAsTextShowAll                      = 0xFFFF
-};
-typedef unsigned LayerTreeAsTextBehavior;
-
 enum class PlatformLayerTreeAsTextFlags : uint8_t {
     Debug = 1 << 0,
     IgnoreChildren = 1 << 1,
@@ -139,8 +121,8 @@
 
     virtual bool isTrackingRepaints() const { return false; }
 
-    virtual bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const { return false; }
-    virtual bool shouldDumpPropertyForLayer(const GraphicsLayer*, const char*, LayerTreeAsTextBehavior) const { return true; }
+    virtual bool shouldSkipLayerInDump(const GraphicsLayer*, OptionSet<LayerTreeAsTextOptions>) const { return false; }
+    virtual bool shouldDumpPropertyForLayer(const GraphicsLayer*, const char*, OptionSet<LayerTreeAsTextOptions>) const { return true; }
 
     virtual bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const { return false; }
     virtual bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const { return true; }

Added: trunk/Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h (0 => 281238)


--- trunk/Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#include <wtf/OptionSet.h>
+
+namespace WebCore {
+
+enum class LayerTreeAsTextOptions : uint16_t {
+    Debug                        = 1 << 0, // Dump extra debugging info like layer addresses.
+    IncludeVisibleRects          = 1 << 1,
+    IncludeTileCaches            = 1 << 2,
+    IncludeRepaintRects          = 1 << 3,
+    IncludePaintingPhases        = 1 << 4,
+    IncludeContentLayers         = 1 << 5,
+    IncludePageOverlayLayers     = 1 << 6,
+    IncludeAcceleratesDrawing    = 1 << 7,
+    IncludeClipping              = 1 << 8,
+    IncludeBackingStoreAttached  = 1 << 9,
+    IncludeRootLayerProperties   = 1 << 10,
+    IncludeEventRegion           = 1 << 11,
+    IncludeDeepColor             = 1 << 12,
+};
+
+static constexpr OptionSet<LayerTreeAsTextOptions> AllLayerTreeAsTextOptions = {
+    LayerTreeAsTextOptions::Debug,
+    LayerTreeAsTextOptions::IncludeVisibleRects,
+    LayerTreeAsTextOptions::IncludeTileCaches,
+    LayerTreeAsTextOptions::IncludeRepaintRects,
+    LayerTreeAsTextOptions::IncludePaintingPhases,
+    LayerTreeAsTextOptions::IncludeContentLayers,
+    LayerTreeAsTextOptions::IncludePageOverlayLayers,
+    LayerTreeAsTextOptions::IncludeAcceleratesDrawing,
+    LayerTreeAsTextOptions::IncludeClipping,
+    LayerTreeAsTextOptions::IncludeBackingStoreAttached,
+    LayerTreeAsTextOptions::IncludeRootLayerProperties,
+    LayerTreeAsTextOptions::IncludeEventRegion,
+    LayerTreeAsTextOptions::IncludeDeepColor,
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (281237 => 281238)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -4207,9 +4207,9 @@
     textStream << " }";
 }
 
-void GraphicsLayerCA::dumpAdditionalProperties(TextStream& textStream, LayerTreeAsTextBehavior behavior) const
+void GraphicsLayerCA::dumpAdditionalProperties(TextStream& textStream, OptionSet<LayerTreeAsTextOptions> options) const
 {
-    if (behavior & LayerTreeAsTextIncludeVisibleRects) {
+    if (options & LayerTreeAsTextOptions::IncludeVisibleRects) {
         textStream << indent << "(visible rect " << m_visibleRect.x() << ", " << m_visibleRect.y() << " " << m_visibleRect.width() << " x " << m_visibleRect.height() << ")\n";
         textStream << indent << "(coverage rect " << m_coverageRect.x() << ", " << m_coverageRect.y() << " " << m_coverageRect.width() << " x " << m_coverageRect.height() << ")\n";
         textStream << indent << "(intersects coverage rect " << m_intersectsCoverageRect << ")\n";
@@ -4216,8 +4216,8 @@
         textStream << indent << "(contentsScale " << m_layer->contentsScale() << ")\n";
     }
 
-    if (tiledBacking() && (behavior & LayerTreeAsTextIncludeTileCaches)) {
-        if (behavior & LayerTreeAsTextDebug)
+    if (tiledBacking() && (options & LayerTreeAsTextOptions::IncludeTileCaches)) {
+        if (options & LayerTreeAsTextOptions::Debug)
             textStream << indent << "(tiled backing " << tiledBacking() << ")\n";
 
         IntRect tileCoverageRect = tiledBacking()->tileCoverageRect();
@@ -4232,12 +4232,12 @@
         textStream << indent << "(in window " << tiledBacking()->isInWindow() << ")\n";
     }
 
-    if ((behavior & LayerTreeAsTextIncludeDeepColor) && m_layer->wantsDeepColorBackingStore())
+    if ((options & LayerTreeAsTextOptions::IncludeDeepColor) && m_layer->wantsDeepColorBackingStore())
         textStream << indent << "(deep color 1)\n";
 
-    if (behavior & LayerTreeAsTextIncludeContentLayers) {
+    if (options & LayerTreeAsTextOptions::IncludeContentLayers) {
         OptionSet<PlatformLayerTreeAsTextFlags> platformFlags = { PlatformLayerTreeAsTextFlags::IgnoreChildren };
-        if (behavior & LayerTreeAsTextDebug)
+        if (options & LayerTreeAsTextOptions::Debug)
             platformFlags.add(PlatformLayerTreeAsTextFlags::Debug);
         dumpInnerLayer(textStream, m_structuralLayer.get(), platformFlags);
         dumpInnerLayer(textStream, m_contentsClippingLayer.get(), platformFlags);
@@ -4248,7 +4248,7 @@
         dumpInnerLayer(textStream, m_backdropLayer.get(), platformFlags);
     }
 
-    if (behavior & LayerTreeAsTextDebug) {
+    if (options & LayerTreeAsTextOptions::Debug) {
         if (m_usesDisplayListDrawing)
             textStream << indent << "(uses display-list drawing " << m_usesDisplayListDrawing << ")\n";
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (281237 => 281238)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -309,7 +309,7 @@
     WEBCORE_EXPORT void setReplicatedByLayer(RefPtr<GraphicsLayer>&&) override;
 
     WEBCORE_EXPORT void getDebugBorderInfo(Color&, float& width) const override;
-    WEBCORE_EXPORT void dumpAdditionalProperties(WTF::TextStream&, LayerTreeAsTextBehavior) const override;
+    WEBCORE_EXPORT void dumpAdditionalProperties(WTF::TextStream&, OptionSet<LayerTreeAsTextOptions>) const override;
     void dumpInnerLayer(WTF::TextStream&, PlatformCALayer*, OptionSet<PlatformLayerTreeAsTextFlags>) const;
     const char *purposeNameForInnerLayer(PlatformCALayer&) const;
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (281237 => 281238)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -1470,13 +1470,13 @@
 }
 #endif
 
-static void dumpInnerLayer(TextStream& textStream, const String& label, CoordinatedGraphicsLayer* layer, LayerTreeAsTextBehavior behavior)
+static void dumpInnerLayer(TextStream& textStream, const String& label, CoordinatedGraphicsLayer* layer, OptionSet<LayerTreeAsTextOptions> options)
 {
     if (!layer)
         return;
 
     textStream << indent << "(" << label << " ";
-    if (behavior & LayerTreeAsTextDebug)
+    if (options & LayerTreeAsTextOptions::Debug)
         textStream << " " << static_cast<void*>(layer);
     textStream << layer->boundsOrigin().x() << ", " << layer->boundsOrigin().y() << " " << layer->size().width() << " x " << layer->size().height();
     if (!layer->contentsAreVisible())
@@ -1484,10 +1484,10 @@
     textStream << ")\n";
 }
 
-void CoordinatedGraphicsLayer::dumpAdditionalProperties(TextStream& textStream, LayerTreeAsTextBehavior behavior) const
+void CoordinatedGraphicsLayer::dumpAdditionalProperties(TextStream& textStream, OptionSet<LayerTreeAsTextOptions> options) const
 {
-    if (behavior & LayerTreeAsTextIncludeContentLayers)
-        dumpInnerLayer(textStream, "backdrop layer", m_backdropLayer.get(), behavior);
+    if (options & LayerTreeAsTextOptions::IncludeContentLayers)
+        dumpInnerLayer(textStream, "backdrop layer", m_backdropLayer.get(), options);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (281237 => 281238)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -114,7 +114,7 @@
     void suspendAnimations(MonotonicTime) override;
     void resumeAnimations() override;
     bool usesContentsLayer() const override;
-    void dumpAdditionalProperties(WTF::TextStream&, LayerTreeAsTextBehavior) const override;
+    void dumpAdditionalProperties(WTF::TextStream&, OptionSet<LayerTreeAsTextOptions>) const override;
 
 #if USE(NICOSIA)
     PlatformLayer* platformLayer() const override;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (281237 => 281238)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -3556,9 +3556,9 @@
     return static_cast<GraphicsLayerClient&>(compositor()).isTrackingRepaints();
 }
 
-bool RenderLayerBacking::shouldSkipLayerInDump(const GraphicsLayer* layer, LayerTreeAsTextBehavior behavior) const
+bool RenderLayerBacking::shouldSkipLayerInDump(const GraphicsLayer* layer, OptionSet<LayerTreeAsTextOptions> options) const
 {
-    if (behavior & LayerTreeAsTextDebug)
+    if (options & LayerTreeAsTextOptions::Debug)
         return false;
 
     // Skip the root tile cache's flattening layer.
@@ -3565,11 +3565,11 @@
     return m_isMainFrameRenderViewLayer && layer && layer == m_childContainmentLayer.get();
 }
 
-bool RenderLayerBacking::shouldDumpPropertyForLayer(const GraphicsLayer* layer, const char* propertyName, LayerTreeAsTextBehavior flags) const
+bool RenderLayerBacking::shouldDumpPropertyForLayer(const GraphicsLayer* layer, const char* propertyName, OptionSet<LayerTreeAsTextOptions> options) const
 {
     // For backwards compatibility with WebKit1 and other platforms,
     // skip some properties on the root tile cache.
-    if (m_isMainFrameRenderViewLayer && layer == m_graphicsLayer.get() && !(flags & LayerTreeAsTextIncludeRootLayerProperties)) {
+    if (m_isMainFrameRenderViewLayer && layer == m_graphicsLayer.get() && !(options & LayerTreeAsTextOptions::IncludeRootLayerProperties)) {
         if (!strcmp(propertyName, "drawsContent"))
             return false;
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (281237 => 281238)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -240,8 +240,8 @@
     bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const override;
 
     bool isTrackingRepaints() const override;
-    bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const override;
-    bool shouldDumpPropertyForLayer(const GraphicsLayer*, const char* propertyName, LayerTreeAsTextBehavior) const override;
+    bool shouldSkipLayerInDump(const GraphicsLayer*, OptionSet<LayerTreeAsTextOptions>) const override;
+    bool shouldDumpPropertyForLayer(const GraphicsLayer*, const char* propertyName, OptionSet<LayerTreeAsTextOptions>) const override;
 
     bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const override;
     bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const override;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (281237 => 281238)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -2328,7 +2328,7 @@
     page().triggerRenderingUpdateForTesting();
 }
 
-String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
+String RenderLayerCompositor::layerTreeAsText(OptionSet<LayerTreeAsTextOptions> options)
 {
     LOG_WITH_STREAM(Compositing, stream << "RenderLayerCompositor " << this << " layerTreeAsText");
 
@@ -2337,44 +2337,18 @@
     if (!m_rootContentsLayer)
         return String();
 
-    LayerTreeAsTextBehavior layerTreeBehavior = LayerTreeAsTextBehaviorNormal;
-    if (flags & LayerTreeFlagsIncludeDebugInfo)
-        layerTreeBehavior |= LayerTreeAsTextDebug;
-    if (flags & LayerTreeFlagsIncludeVisibleRects)
-        layerTreeBehavior |= LayerTreeAsTextIncludeVisibleRects;
-    if (flags & LayerTreeFlagsIncludeTileCaches)
-        layerTreeBehavior |= LayerTreeAsTextIncludeTileCaches;
-    if (flags & LayerTreeFlagsIncludeRepaintRects)
-        layerTreeBehavior |= LayerTreeAsTextIncludeRepaintRects;
-    if (flags & LayerTreeFlagsIncludePaintingPhases)
-        layerTreeBehavior |= LayerTreeAsTextIncludePaintingPhases;
-    if (flags & LayerTreeFlagsIncludeContentLayers)
-        layerTreeBehavior |= LayerTreeAsTextIncludeContentLayers;
-    if (flags & LayerTreeFlagsIncludeAcceleratesDrawing)
-        layerTreeBehavior |= LayerTreeAsTextIncludeAcceleratesDrawing;
-    if (flags & LayerTreeFlagsIncludeClipping)
-        layerTreeBehavior |= LayerTreeAsTextIncludeClipping;
-    if (flags & LayerTreeFlagsIncludeBackingStoreAttached)
-        layerTreeBehavior |= LayerTreeAsTextIncludeBackingStoreAttached;
-    if (flags & LayerTreeFlagsIncludeRootLayerProperties)
-        layerTreeBehavior |= LayerTreeAsTextIncludeRootLayerProperties;
-    if (flags & LayerTreeFlagsIncludeEventRegion)
-        layerTreeBehavior |= LayerTreeAsTextIncludeEventRegion;
-    if (flags & LayerTreeFlagsIncludeDeepColor)
-        layerTreeBehavior |= LayerTreeAsTextIncludeDeepColor;
-
     // We skip dumping the scroll and clip layers to keep layerTreeAsText output
     // similar between platforms.
-    String layerTreeText = m_rootContentsLayer->layerTreeAsText(layerTreeBehavior);
+    String layerTreeText = m_rootContentsLayer->layerTreeAsText(options);
 
     // Dump an empty layer tree only if the only composited layer is the main frame's tiled backing,
     // so that tests expecting us to drop out of accelerated compositing when there are no layers succeed.
-    if (!hasContentCompositingLayers() && documentUsesTiledBacking() && !(layerTreeBehavior & LayerTreeAsTextIncludeTileCaches) && !(layerTreeBehavior & LayerTreeAsTextIncludeRootLayerProperties))
+    if (!hasContentCompositingLayers() && documentUsesTiledBacking() && !(options & LayerTreeAsTextOptions::IncludeTileCaches) && !(options & LayerTreeAsTextOptions::IncludeRootLayerProperties))
         layerTreeText = emptyString();
 
     // The true root layer is not included in the dump, so if we want to report
     // its repaint rects, they must be included here.
-    if (flags & LayerTreeFlagsIncludeRepaintRects)
+    if (options & LayerTreeAsTextOptions::IncludeRepaintRects)
         return m_renderView.frameView().trackedRepaintRectsAsText() + layerTreeText;
 
     return layerTreeText;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (281237 => 281238)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -47,8 +47,6 @@
 class StickyPositionViewportConstraints;
 class TiledBacking;
 
-typedef unsigned LayerTreeFlags;
-
 enum class CompositingUpdateType {
     AfterStyleChange,
     AfterLayout,
@@ -316,10 +314,10 @@
 
     void widgetDidChangeSize(RenderWidget&);
 
-    WEBCORE_EXPORT String layerTreeAsText(LayerTreeFlags = 0) const;
+    WEBCORE_EXPORT String layerTreeAsText(OptionSet<LayerTreeAsTextOptions> = { }) const;
     WEBCORE_EXPORT String trackedRepaintRectsAsText() const;
 
-    WEBCORE_EXPORT String layerTreeAsText(LayerTreeFlags = 0);
+    WEBCORE_EXPORT String layerTreeAsText(OptionSet<LayerTreeAsTextOptions> = { });
     WEBCORE_EXPORT std::optional<String> platformLayerTreeAsText(Element&, OptionSet<PlatformLayerTreeAsTextFlags>);
 
     float deviceScaleFactor() const override;

Modified: trunk/Source/WebCore/testing/Internals.cpp (281237 => 281238)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -2818,31 +2818,31 @@
     return document->isPageBoxVisible(pageNumber);
 }
 
-static LayerTreeFlags toLayerTreeFlags(unsigned short flags)
+static OptionSet<LayerTreeAsTextOptions> toLayerTreeAsTextOptions(unsigned short flags)
 {
-    LayerTreeFlags layerTreeFlags = 0;
+    OptionSet<LayerTreeAsTextOptions> layerTreeFlags;
     if (flags & Internals::LAYER_TREE_INCLUDES_VISIBLE_RECTS)
-        layerTreeFlags |= LayerTreeFlagsIncludeVisibleRects;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeVisibleRects);
     if (flags & Internals::LAYER_TREE_INCLUDES_TILE_CACHES)
-        layerTreeFlags |= LayerTreeFlagsIncludeTileCaches;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeTileCaches);
     if (flags & Internals::LAYER_TREE_INCLUDES_REPAINT_RECTS)
-        layerTreeFlags |= LayerTreeFlagsIncludeRepaintRects;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeRepaintRects);
     if (flags & Internals::LAYER_TREE_INCLUDES_PAINTING_PHASES)
-        layerTreeFlags |= LayerTreeFlagsIncludePaintingPhases;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludePaintingPhases);
     if (flags & Internals::LAYER_TREE_INCLUDES_CONTENT_LAYERS)
-        layerTreeFlags |= LayerTreeFlagsIncludeContentLayers;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeContentLayers);
     if (flags & Internals::LAYER_TREE_INCLUDES_ACCELERATES_DRAWING)
-        layerTreeFlags |= LayerTreeFlagsIncludeAcceleratesDrawing;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeAcceleratesDrawing);
     if (flags & Internals::LAYER_TREE_INCLUDES_CLIPPING)
-        layerTreeFlags |= LayerTreeFlagsIncludeClipping;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeClipping);
     if (flags & Internals::LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED)
-        layerTreeFlags |= LayerTreeFlagsIncludeBackingStoreAttached;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeBackingStoreAttached);
     if (flags & Internals::LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES)
-        layerTreeFlags |= LayerTreeFlagsIncludeRootLayerProperties;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeRootLayerProperties);
     if (flags & Internals::LAYER_TREE_INCLUDES_EVENT_REGION)
-        layerTreeFlags |= LayerTreeFlagsIncludeEventRegion;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeEventRegion);
     if (flags & Internals::LAYER_TREE_INCLUDES_DEEP_COLOR)
-        layerTreeFlags |= LayerTreeFlagsIncludeDeepColor;
+        layerTreeFlags.add(LayerTreeAsTextOptions::IncludeDeepColor);
 
     return layerTreeFlags;
 }
@@ -2855,7 +2855,7 @@
 {
     if (!document.frame() || !document.frame()->contentRenderer())
         return Exception { InvalidAccessError };
-    return document.frame()->contentRenderer()->compositor().layerTreeAsText(toLayerTreeFlags(flags));
+    return document.frame()->contentRenderer()->compositor().layerTreeAsText(toLayerTreeAsTextOptions(flags));
 }
 
 ExceptionOr<uint64_t> Internals::layerIDForElement(Element& element)
@@ -4620,7 +4620,7 @@
 
     document->updateLayoutIgnorePendingStylesheets();
 
-    return MockPageOverlayClient::singleton().layerTreeAsText(*document->page(), toLayerTreeFlags(flags));
+    return MockPageOverlayClient::singleton().layerTreeAsText(*document->page(), toLayerTreeAsTextOptions(flags));
 }
 
 void Internals::setPageMuted(StringView statesString)

Modified: trunk/Source/WebCore/testing/MockPageOverlayClient.cpp (281237 => 281238)


--- trunk/Source/WebCore/testing/MockPageOverlayClient.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/testing/MockPageOverlayClient.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -67,13 +67,13 @@
     }
 }
 
-String MockPageOverlayClient::layerTreeAsText(Page& page, LayerTreeFlags flags)
+String MockPageOverlayClient::layerTreeAsText(Page& page, OptionSet<LayerTreeAsTextOptions> options)
 {
     GraphicsLayer* viewOverlayRoot = page.pageOverlayController().viewOverlayRootLayer();
     GraphicsLayer* documentOverlayRoot = page.pageOverlayController().documentOverlayRootLayer();
     
-    return "View-relative:\n" + (viewOverlayRoot ? viewOverlayRoot->layerTreeAsText(flags | LayerTreeAsTextIncludePageOverlayLayers) : "(no view-relative overlay root)")
-        + "\n\nDocument-relative:\n" + (documentOverlayRoot ? documentOverlayRoot->layerTreeAsText(flags | LayerTreeAsTextIncludePageOverlayLayers) : "(no document-relative overlay root)");
+    return "View-relative:\n" + (viewOverlayRoot ? viewOverlayRoot->layerTreeAsText(options | LayerTreeAsTextOptions::IncludePageOverlayLayers) : "(no view-relative overlay root)")
+        + "\n\nDocument-relative:\n" + (documentOverlayRoot ? documentOverlayRoot->layerTreeAsText(options | LayerTreeAsTextOptions::IncludePageOverlayLayers) : "(no document-relative overlay root)");
 }
 
 void MockPageOverlayClient::willMoveToPage(PageOverlay&, Page*)

Modified: trunk/Source/WebCore/testing/MockPageOverlayClient.h (281237 => 281238)


--- trunk/Source/WebCore/testing/MockPageOverlayClient.h	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebCore/testing/MockPageOverlayClient.h	2021-08-19 15:47:35 UTC (rev 281238)
@@ -25,7 +25,6 @@
 
 #pragma once
 
-#include "Frame.h"
 #include "MockPageOverlay.h"
 #include "PageOverlay.h"
 #include <wtf/HashSet.h>
@@ -32,7 +31,9 @@
 
 namespace WebCore {
 
+class Frame;
 class Page;
+enum class LayerTreeAsTextOptions : uint16_t;
 
 class MockPageOverlayClient final : public PageOverlay::Client {
     friend class NeverDestroyed<MockPageOverlayClient>;
@@ -44,7 +45,7 @@
     Ref<MockPageOverlay> installOverlay(Page&, PageOverlay::OverlayType);
     void uninstallAllOverlays();
 
-    String layerTreeAsText(Page&, LayerTreeFlags);
+    String layerTreeAsText(Page&, OptionSet<LayerTreeAsTextOptions>);
 
     virtual ~MockPageOverlayClient() = default;
 

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp (281237 => 281238)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp	2021-08-19 15:46:32 UTC (rev 281237)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp	2021-08-19 15:47:35 UTC (rev 281238)
@@ -337,7 +337,7 @@
     if (!m_rootLayer)
         return { };
 
-    return m_rootLayer->layerTreeAsText(LayerTreeAsTextShowAll);
+    return m_rootLayer->layerTreeAsText(AllLayerTreeAsTextOptions);
 }
 
 #endif // USE(TEXTURE_MAPPER_GL)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to