Use an OptionSet<> for GraphicsLayerPaintingPhase
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 May 2019 05:50:50 +0000 (05:50 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 May 2019 05:50:50 +0000 (05:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198404

Reviewed by Tim Horton.

Replace GraphicsLayerPaintingPhase with OptionSet<GraphicsLayerPaintingPhase>.

No behavior change.

Source/WebCore:

* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
(WebCore::PageOverlayController::paintContents):
(WebCore::PageOverlayController::notifyFlushRequired):
* page/PageOverlayController.h:
* page/linux/ResourceUsageOverlayLinux.cpp:
* page/mac/ServicesOverlayController.h:
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::paintContents):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::dumpProperties const):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::paintingPhase const):
(WebCore::GraphicsLayer::setPaintingPhase):
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::paintContents):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateForegroundLayer):
(WebCore::RenderLayerBacking::updateBackgroundLayer):
(WebCore::RenderLayerBacking::updateMaskingLayer):
(WebCore::RenderLayerBacking::updateChildClippingStrategy):
(WebCore::RenderLayerBacking::updateScrollingLayers):
(WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
(WebCore::RenderLayerBacking::paintIntoLayer):
(WebCore::RenderLayerBacking::paintContents):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::paintContents):
* rendering/RenderLayerCompositor.h:

Source/WebKitLegacy/win:

* WebCoreSupport/AcceleratedCompositingContext.cpp:
(AcceleratedCompositingContext::paintContents):
* WebCoreSupport/AcceleratedCompositingContext.h:
* WebView.cpp:
(WebView::paintContents):
* WebView.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245950 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/PageOverlayController.cpp
Source/WebCore/page/PageOverlayController.h
Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp
Source/WebCore/page/mac/ServicesOverlayController.h
Source/WebCore/page/mac/ServicesOverlayController.mm
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/GraphicsLayerClient.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp
Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.h
Source/WebKitLegacy/win/WebView.cpp
Source/WebKitLegacy/win/WebView.h

index ea32356..761e578 100644 (file)
@@ -1,3 +1,44 @@
+2019-05-30  Simon Fraser  <simon.fraser@apple.com>
+
+        Use an OptionSet<> for GraphicsLayerPaintingPhase
+        https://bugs.webkit.org/show_bug.cgi?id=198404
+
+        Reviewed by Tim Horton.
+
+        Replace GraphicsLayerPaintingPhase with OptionSet<GraphicsLayerPaintingPhase>.
+
+        No behavior change.
+
+        * page/PageOverlayController.cpp:
+        (WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
+        (WebCore::PageOverlayController::paintContents):
+        (WebCore::PageOverlayController::notifyFlushRequired):
+        * page/PageOverlayController.h:
+        * page/linux/ResourceUsageOverlayLinux.cpp:
+        * page/mac/ServicesOverlayController.h:
+        * page/mac/ServicesOverlayController.mm:
+        (WebCore::ServicesOverlayController::Highlight::paintContents):
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::dumpProperties const):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::paintingPhase const):
+        (WebCore::GraphicsLayer::setPaintingPhase):
+        * platform/graphics/GraphicsLayerClient.h:
+        (WebCore::GraphicsLayerClient::paintContents):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateForegroundLayer):
+        (WebCore::RenderLayerBacking::updateBackgroundLayer):
+        (WebCore::RenderLayerBacking::updateMaskingLayer):
+        (WebCore::RenderLayerBacking::updateChildClippingStrategy):
+        (WebCore::RenderLayerBacking::updateScrollingLayers):
+        (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+        (WebCore::RenderLayerBacking::paintContents):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::paintContents):
+        * rendering/RenderLayerCompositor.h:
+
 2019-05-30  Youenn Fablet  <youenn@apple.com>
 
         Fix AVVideoCaptureSource::setFrameRateWithPreset logging
index c5bdb82..0c03315 100644 (file)
@@ -250,7 +250,7 @@ void PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates()
 #endif
 }
 
-void PageOverlayController::setPageOverlayNeedsDisplay(PageOverlay& overlay, const WebCore::IntRect& dirtyRect)
+void PageOverlayController::setPageOverlayNeedsDisplay(PageOverlay& overlay, const IntRect& dirtyRect)
 {
     ASSERT(m_pageOverlays.contains(&overlay));
     auto* graphicsLayer = m_overlayGraphicsLayers.get(&overlay);
@@ -391,7 +391,7 @@ Vector<String> PageOverlayController::copyAccessibilityAttributesNames(bool para
     return { };
 }
 
-void PageOverlayController::paintContents(const WebCore::GraphicsLayer* graphicsLayer, WebCore::GraphicsContext& graphicsContext, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& clipRect, GraphicsLayerPaintBehavior)
+void PageOverlayController::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clipRect, GraphicsLayerPaintBehavior)
 {
     for (auto& overlayAndGraphicsLayer : m_overlayGraphicsLayers) {
         if (overlayAndGraphicsLayer.value.ptr() != graphicsLayer)
@@ -410,7 +410,7 @@ float PageOverlayController::deviceScaleFactor() const
     return m_page.deviceScaleFactor();
 }
 
-void PageOverlayController::notifyFlushRequired(const WebCore::GraphicsLayer*)
+void PageOverlayController::notifyFlushRequired(const GraphicsLayer*)
 {
     m_page.renderingUpdateScheduler().scheduleRenderingUpdate();
 }
index 827b7a1..64e90e2 100644 (file)
@@ -93,7 +93,7 @@ private:
 
     // GraphicsLayerClient
     void notifyFlushRequired(const GraphicsLayer*) override;
-    void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& clipRect, GraphicsLayerPaintBehavior) override;
+    void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clipRect, GraphicsLayerPaintBehavior) override;
     float deviceScaleFactor() const override;
     bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const override;
     void tiledBackingUsageChanged(const GraphicsLayer*, bool) override;
index a824e53..4fdf756 100644 (file)
@@ -84,7 +84,7 @@ public:
     ~ResourceUsageOverlayPainter() = default;
 
 private:
-    void paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior) override
+    void paintContents(const GraphicsLayer*, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clip, GraphicsLayerPaintBehavior) override
     {
         GraphicsContextStateSaver stateSaver(context);
         context.fillRect(clip, Color(0.0f, 0.0f, 0.0f, 0.8f));
index 8f8a5fb..2c01698 100644 (file)
@@ -82,7 +82,7 @@ private:
 
         // GraphicsLayerClient
         void notifyFlushRequired(const GraphicsLayer*) override;
-        void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& inClip, GraphicsLayerPaintBehavior) override;
+        void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& inClip, GraphicsLayerPaintBehavior) override;
         float deviceScaleFactor() const override;
 
         void didFinishFadeOutAnimation();
index 93b2417..22b65d9 100644 (file)
@@ -124,7 +124,7 @@ void ServicesOverlayController::Highlight::notifyFlushRequired(const GraphicsLay
     m_controller->page().renderingUpdateScheduler().scheduleRenderingUpdate();
 }
 
-void ServicesOverlayController::Highlight::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const FloatRect&, GraphicsLayerPaintBehavior)
+void ServicesOverlayController::Highlight::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect&, GraphicsLayerPaintBehavior)
 {
     if (!DataDetectorsLibrary())
         return;
index 7342e44..5568f4a 100644 (file)
@@ -935,22 +935,22 @@ void GraphicsLayer::dumpProperties(TextStream& ts, LayerTreeAsTextBehavior behav
     if (behavior & LayerTreeAsTextIncludePaintingPhases && paintingPhase()) {
         ts << indent << "(paintingPhases\n";
         TextStream::IndentScope indentScope(ts);
-        if (paintingPhase() & GraphicsLayerPaintBackground)
+        if (paintingPhase().contains(GraphicsLayerPaintingPhase::Background))
             ts << indent << "GraphicsLayerPaintBackground\n";
 
-        if (paintingPhase() & GraphicsLayerPaintForeground)
+        if (paintingPhase().contains(GraphicsLayerPaintingPhase::Foreground))
             ts << indent << "GraphicsLayerPaintForeground\n";
 
-        if (paintingPhase() & GraphicsLayerPaintMask)
+        if (paintingPhase().contains(GraphicsLayerPaintingPhase::Mask))
             ts << indent << "GraphicsLayerPaintMask\n";
 
-        if (paintingPhase() & GraphicsLayerPaintChildClippingMask)
+        if (paintingPhase().contains(GraphicsLayerPaintingPhase::ChildClippingMask))
             ts << indent << "GraphicsLayerPaintChildClippingMask\n";
 
-        if (paintingPhase() & GraphicsLayerPaintOverflowContents)
+        if (paintingPhase().contains(GraphicsLayerPaintingPhase::OverflowContents))
             ts << indent << "GraphicsLayerPaintOverflowContents\n";
 
-        if (paintingPhase() & GraphicsLayerPaintCompositedScroll)
+        if (paintingPhase().contains(GraphicsLayerPaintingPhase::CompositedScroll))
             ts << indent << "GraphicsLayerPaintCompositedScroll\n";
 
         ts << indent << ")\n";
index 7e16d9e..e48434e 100644 (file)
@@ -414,8 +414,8 @@ public:
 #endif
 
     // Some GraphicsLayers paint only the foreground or the background content
-    GraphicsLayerPaintingPhase paintingPhase() const { return m_paintingPhase; }
-    void setPaintingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; }
+    OptionSet<GraphicsLayerPaintingPhase> paintingPhase() const { return m_paintingPhase; }
+    void setPaintingPhase(OptionSet<GraphicsLayerPaintingPhase> phase) { m_paintingPhase = phase; }
 
     enum ShouldClipToLayer {
         DoNotClipToLayer,
@@ -691,7 +691,7 @@ protected:
 
     const Type m_type;
     CustomAppearance m_customAppearance { CustomAppearance::None };
-    GraphicsLayerPaintingPhase m_paintingPhase { GraphicsLayerPaintAllWithOverflowClip };
+    OptionSet<GraphicsLayerPaintingPhase> m_paintingPhase { GraphicsLayerPaintingPhase::Foreground, GraphicsLayerPaintingPhase::Background };
     CompositingCoordinatesOrientation m_contentsOrientation { CompositingCoordinatesOrientation::TopDown }; // affects orientation of layer contents
 
     bool m_beingDestroyed : 1;
index 8672d0f..53fcb28 100644 (file)
@@ -38,17 +38,15 @@ class IntPoint;
 class IntRect;
 class TransformationMatrix;
 
-enum GraphicsLayerPaintingPhaseFlags {
-    GraphicsLayerPaintBackground            = 1 << 0,
-    GraphicsLayerPaintForeground            = 1 << 1,
-    GraphicsLayerPaintMask                  = 1 << 2,
-    GraphicsLayerPaintClipPath              = 1 << 3,
-    GraphicsLayerPaintOverflowContents      = 1 << 4,
-    GraphicsLayerPaintCompositedScroll      = 1 << 5,
-    GraphicsLayerPaintChildClippingMask     = 1 << 6,
-    GraphicsLayerPaintAllWithOverflowClip   = GraphicsLayerPaintBackground | GraphicsLayerPaintForeground
+enum class GraphicsLayerPaintingPhase {
+    Background            = 1 << 0,
+    Foreground            = 1 << 1,
+    Mask                  = 1 << 2,
+    ClipPath              = 1 << 3,
+    OverflowContents      = 1 << 4,
+    CompositedScroll      = 1 << 5,
+    ChildClippingMask     = 1 << 6,
 };
-typedef uint8_t GraphicsLayerPaintingPhase;
 
 enum AnimatedPropertyID {
     AnimatedPropertyInvalid,
@@ -102,7 +100,7 @@ public:
     // Notification that this layer requires a flush before the next display refresh.
     virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) { }
 
-    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& /* inClip */, GraphicsLayerPaintBehavior) { }
+    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& /* inClip */, GraphicsLayerPaintBehavior) { }
     virtual void didChangePlatformLayerForLayer(const GraphicsLayer*) { }
 
     // Provides current transform (taking transform-origin and animations into account). Input matrix has been
index 048bee1..fcaf9c7 100644 (file)
@@ -1709,7 +1709,7 @@ bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
             String layerName = m_owningLayer.name() + " (foreground)";
             m_foregroundLayer = createGraphicsLayer(layerName);
             m_foregroundLayer->setDrawsContent(true);
-            m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
+            m_foregroundLayer->setPaintingPhase({ GraphicsLayerPaintingPhase::Foreground });
             layerChanged = true;
         }
     } else if (m_foregroundLayer) {
@@ -1735,7 +1735,7 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer)
             m_backgroundLayer = createGraphicsLayer(layerName);
             m_backgroundLayer->setDrawsContent(true);
             m_backgroundLayer->setAnchorPoint(FloatPoint3D());
-            m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
+            m_backgroundLayer->setPaintingPhase({ GraphicsLayerPaintingPhase::Background });
             layerChanged = true;
         }
         
@@ -1771,17 +1771,17 @@ void RenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath)
 {
     bool layerChanged = false;
     if (hasMask || hasClipPath) {
-        GraphicsLayerPaintingPhase maskPhases = 0;
+        OptionSet<GraphicsLayerPaintingPhase> maskPhases;
         if (hasMask)
-            maskPhases = GraphicsLayerPaintMask;
+            maskPhases = GraphicsLayerPaintingPhase::Mask;
         
         if (hasClipPath) {
             // If we have a mask, we need to paint the combined clip-path and mask into the mask layer.
             if (hasMask || renderer().style().clipPath()->type() == ClipPathOperation::Reference || !GraphicsLayer::supportsLayerType(GraphicsLayer::Type::Shape))
-                maskPhases |= GraphicsLayerPaintClipPath;
+                maskPhases.add(GraphicsLayerPaintingPhase::ClipPath);
         }
 
-        bool paintsContent = maskPhases;
+        bool paintsContent = !maskPhases.isEmpty();
         GraphicsLayer::Type requiredLayerType = paintsContent ? GraphicsLayer::Type::Normal : GraphicsLayer::Type::Shape;
         if (m_maskLayer && m_maskLayer->type() != requiredLayerType) {
             m_graphicsLayer->setMaskLayer(nullptr);
@@ -1825,7 +1825,7 @@ void RenderLayerBacking::updateChildClippingStrategy(bool needsDescendantsClippi
             if (!m_childClippingMaskLayer) {
                 m_childClippingMaskLayer = createGraphicsLayer("child clipping mask");
                 m_childClippingMaskLayer->setDrawsContent(true);
-                m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildClippingMask);
+                m_childClippingMaskLayer->setPaintingPhase({ GraphicsLayerPaintingPhase::ChildClippingMask });
                 clippingLayer()->setMaskLayer(m_childClippingMaskLayer.copyRef());
             }
         }
@@ -1856,10 +1856,10 @@ bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers)
         m_scrolledContentsLayer->setDrawsContent(true);
         m_scrolledContentsLayer->setAnchorPoint({ });
 
-        GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
+        OptionSet<GraphicsLayerPaintingPhase> paintPhases = { GraphicsLayerPaintingPhase::OverflowContents, GraphicsLayerPaintingPhase::CompositedScroll };
         if (!m_foregroundLayer)
-            paintPhase |= GraphicsLayerPaintForeground;
-        m_scrolledContentsLayer->setPaintingPhase(paintPhase);
+            paintPhases.add(GraphicsLayerPaintingPhase::Foreground);
+        m_scrolledContentsLayer->setPaintingPhase(paintPhases);
         m_scrollContainerLayer->addChild(*m_scrolledContentsLayer);
     } else {
         compositor().willRemoveScrollingLayerWithBacking(m_owningLayer, *this);
@@ -1939,20 +1939,20 @@ void RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole(bool
     m_graphicsLayer->setIsViewportConstrained(viewportCoordinated);
 }
 
-GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const
+OptionSet<GraphicsLayerPaintingPhase> RenderLayerBacking::paintingPhaseForPrimaryLayer() const
 {
-    unsigned phase = 0;
+    OptionSet<GraphicsLayerPaintingPhase> phases;
     if (!m_backgroundLayer)
-        phase |= GraphicsLayerPaintBackground;
+        phases.add(GraphicsLayerPaintingPhase::Background);
     if (!m_foregroundLayer)
-        phase |= GraphicsLayerPaintForeground;
+        phases.add(GraphicsLayerPaintingPhase::Foreground);
 
     if (m_scrolledContentsLayer) {
-        phase &= ~GraphicsLayerPaintForeground;
-        phase |= GraphicsLayerPaintCompositedScroll;
+        phases.remove(GraphicsLayerPaintingPhase::Foreground);
+        phases.add(GraphicsLayerPaintingPhase::CompositedScroll);
     }
 
-    return static_cast<GraphicsLayerPaintingPhase>(phase);
+    return phases;
 }
 
 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const
@@ -2646,9 +2646,9 @@ void RenderLayerBacking::setContentsNeedDisplayInRect(const LayoutRect& r, Graph
 
 void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, GraphicsContext& context,
     const IntRect& paintDirtyRect, // In the coords of rootLayer.
-    OptionSet<PaintBehavior> paintBehavior, GraphicsLayerPaintingPhase paintingPhase)
+    OptionSet<PaintBehavior> paintBehavior, OptionSet<GraphicsLayerPaintingPhase> paintingPhase)
 {
-    if ((paintsIntoWindow() || paintsIntoCompositedAncestor()) && paintingPhase != GraphicsLayerPaintChildClippingMask) {
+    if ((paintsIntoWindow() || paintsIntoCompositedAncestor()) && paintingPhase != OptionSet<GraphicsLayerPaintingPhase>(GraphicsLayerPaintingPhase::ChildClippingMask)) {
 #if !PLATFORM(IOS_FAMILY) && !OS(WINDOWS)
         // FIXME: Looks like the CALayer tree is out of sync with the GraphicsLayer heirarchy
         // when pages are restored from the PageCache.
@@ -2659,19 +2659,19 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap
     }
 
     OptionSet<RenderLayer::PaintLayerFlag> paintFlags;
-    if (paintingPhase & GraphicsLayerPaintBackground)
+    if (paintingPhase.contains(GraphicsLayerPaintingPhase::Background))
         paintFlags.add(RenderLayer::PaintLayerPaintingCompositingBackgroundPhase);
-    if (paintingPhase & GraphicsLayerPaintForeground)
+    if (paintingPhase.contains(GraphicsLayerPaintingPhase::Foreground))
         paintFlags.add(RenderLayer::PaintLayerPaintingCompositingForegroundPhase);
-    if (paintingPhase & GraphicsLayerPaintMask)
+    if (paintingPhase.contains(GraphicsLayerPaintingPhase::Mask))
         paintFlags.add(RenderLayer::PaintLayerPaintingCompositingMaskPhase);
-    if (paintingPhase & GraphicsLayerPaintClipPath)
+    if (paintingPhase.contains(GraphicsLayerPaintingPhase::ClipPath))
         paintFlags.add(RenderLayer::PaintLayerPaintingCompositingClipPathPhase);
-    if (paintingPhase & GraphicsLayerPaintChildClippingMask)
+    if (paintingPhase.contains(GraphicsLayerPaintingPhase::ChildClippingMask))
         paintFlags.add(RenderLayer::PaintLayerPaintingChildClippingMaskPhase);
-    if (paintingPhase & GraphicsLayerPaintOverflowContents)
+    if (paintingPhase.contains(GraphicsLayerPaintingPhase::OverflowContents))
         paintFlags.add(RenderLayer::PaintLayerPaintingOverflowContents);
-    if (paintingPhase & GraphicsLayerPaintCompositedScroll)
+    if (paintingPhase.contains(GraphicsLayerPaintingPhase::CompositedScroll))
         paintFlags.add(RenderLayer::PaintLayerPaintingCompositingScrollingPhase);
 
     if (graphicsLayer == m_backgroundLayer.get() && m_backgroundLayerPaintsFixedRootBackground)
@@ -2718,7 +2718,7 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap
             RenderLayer::PaintLayerPaintingCompositingBackgroundPhase,
             RenderLayer::PaintLayerPaintingCompositingForegroundPhase };
 
-        if (paintingPhase & GraphicsLayerPaintOverflowContents)
+        if (paintingPhase.contains(GraphicsLayerPaintingPhase::OverflowContents))
             sharingLayerPaintFlags.add(RenderLayer::PaintLayerPaintingOverflowContents);
 
         for (auto& layerWeakPtr : m_backingSharingLayers)
@@ -2729,7 +2729,7 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap
 }
 
 // Up-call from compositing layer drawing callback.
-void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior layerPaintBehavior)
+void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase> paintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior layerPaintBehavior)
 {
 #ifndef NDEBUG
     renderer().page().setIsPainting(true);
@@ -2754,7 +2754,7 @@ void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph
         || graphicsLayer == m_childClippingMaskLayer.get()
         || graphicsLayer == m_scrolledContentsLayer.get()) {
 
-        if (!(paintingPhase & GraphicsLayerPaintOverflowContents))
+        if (!paintingPhase.contains(GraphicsLayerPaintingPhase::OverflowContents))
             dirtyRect.intersect(enclosingIntRect(compositedBoundsIncludingMargin()));
 
         // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
index 132e5a3..5175f19 100644 (file)
@@ -235,7 +235,7 @@ public:
     void notifyFlushRequired(const GraphicsLayer*) override;
     void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) override;
 
-    void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior) override;
+    void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clip, GraphicsLayerPaintBehavior) override;
 
     float deviceScaleFactor() const override;
     float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const override;
@@ -333,7 +333,7 @@ private:
 
     void setBackgroundLayerPaintsFixedRootBackground(bool);
 
-    GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
+    OptionSet<GraphicsLayerPaintingPhase> paintingPhaseForPrimaryLayer() const;
     
     LayoutSize contentOffsetInCompositingLayer() const;
     // Result is transform origin in device pixels.
@@ -385,7 +385,7 @@ private:
     bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_isFrameLayerWithTiledBacking); }
     GraphicsLayer* tileCacheFlatteningLayer() const { return m_isFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
 
-    void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, OptionSet<PaintBehavior>, GraphicsLayerPaintingPhase);
+    void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, OptionSet<PaintBehavior>, OptionSet<GraphicsLayerPaintingPhase>);
 
     static CSSPropertyID graphicsLayerToCSSProperty(AnimatedPropertyID);
     static AnimatedPropertyID cssToGraphicsLayerProperty(CSSPropertyID);
index c95e318..78cc185 100644 (file)
@@ -3274,7 +3274,7 @@ void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRec
     context.restore();
 }
 
-void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior)
+void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clip, GraphicsLayerPaintBehavior)
 {
 #if PLATFORM(MAC)
     LocalDefaultSystemAppearance localAppearance(m_renderView.useDarkAppearance());
index 568ab4d..9134779 100644 (file)
@@ -377,7 +377,7 @@ private:
     
     // GraphicsLayerClient implementation
     void notifyFlushRequired(const GraphicsLayer*) override;
-    void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect&, GraphicsLayerPaintBehavior) override;
+    void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect&, GraphicsLayerPaintBehavior) override;
     void customPositionForVisibleRectComputation(const GraphicsLayer*, FloatPoint&) const override;
     bool isTrackingRepaints() const override { return m_isTrackingRepaints; }
     
index 9dc1f2e..0a5fb31 100644 (file)
@@ -1,3 +1,21 @@
+2019-05-30  Simon Fraser  <simon.fraser@apple.com>
+
+        Use an OptionSet<> for GraphicsLayerPaintingPhase
+        https://bugs.webkit.org/show_bug.cgi?id=198404
+
+        Reviewed by Tim Horton.
+
+        Replace GraphicsLayerPaintingPhase with OptionSet<GraphicsLayerPaintingPhase>.
+
+        No behavior change.
+
+        * WebCoreSupport/AcceleratedCompositingContext.cpp:
+        (AcceleratedCompositingContext::paintContents):
+        * WebCoreSupport/AcceleratedCompositingContext.h:
+        * WebView.cpp:
+        (WebView::paintContents):
+        * WebView.h:
+
 2019-05-26  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] Dropped text, attachments, and images should animate into place
index e447370..fb169fd 100644 (file)
@@ -400,7 +400,7 @@ void AcceleratedCompositingContext::layerFlushTimerFired()
         scheduleLayerFlush();
 }
 
-void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& rectToPaint, GraphicsLayerPaintBehavior)
+void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& rectToPaint, GraphicsLayerPaintBehavior)
 {
     context.save();
     context.clip(rectToPaint);
index 6bb334d..e3ec33f 100644 (file)
@@ -52,7 +52,7 @@ public:
     bool enabled();
 
     // GraphicsLayerClient
-    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& rectToPaint, WebCore::GraphicsLayerPaintBehavior) override;
+    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, OptionSet<WebCore::GraphicsLayerPaintingPhase>, const WebCore::FloatRect& rectToPaint, WebCore::GraphicsLayerPaintBehavior) override;
     float deviceScaleFactor() const override;
 
     void initialize();
index 79fc46d..a89acc0 100644 (file)
@@ -7363,7 +7363,7 @@ void WebView::notifyFlushRequired(const GraphicsLayer*)
     flushPendingGraphicsLayerChangesSoon();
 }
 
-void WebView::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& inClipPixels, GraphicsLayerPaintBehavior)
+void WebView::paintContents(const GraphicsLayer*, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& inClipPixels, GraphicsLayerPaintBehavior)
 {
     Frame* frame = core(m_mainFrame);
     if (!frame)
index ad4e32d..1084d40 100644 (file)
@@ -568,7 +568,7 @@ private:
     // GraphicsLayerClient
     void notifyAnimationStarted(const WebCore::GraphicsLayer*, const String&, MonotonicTime) override;
     void notifyFlushRequired(const WebCore::GraphicsLayer*) override;
-    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& inClip, WebCore::GraphicsLayerPaintBehavior) override;
+    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, OptionSet<WebCore::GraphicsLayerPaintingPhase>, const WebCore::FloatRect& inClip, WebCore::GraphicsLayerPaintBehavior) override;
 
 #if USE(CA)
     // CACFLayerTreeHostClient