Title: [269239] trunk/Source/WebCore
Revision
269239
Author
[email protected]
Date
2020-11-01 17:39:15 -0800 (Sun, 01 Nov 2020)

Log Message

[LFC Display] Pass deviceScaleFactor around with GraphicsContext at paint time
https://bugs.webkit.org/show_bug.cgi?id=218423

Reviewed by Zalan Bujtas.

Border painting code will need to use deviceScaleFactor at paint time, so make a small
struct that bundles GraphicsContext& and deviceScaleFactor together, and pass that to
paint functions.

* WebCore.xcodeproj/project.pbxproj:
* display/DisplayLayerController.cpp:
(WebCore::Display::LayerController::RootLayerClient::paintContents):
* display/css/DisplayBoxPainter.cpp:
(WebCore::Display::BoxPainter::paintFillLayer):
(WebCore::Display::BoxPainter::paintBackgroundImages):
(WebCore::Display::BoxPainter::paintBoxDecorations):
(WebCore::Display::BoxPainter::paintBoxContent):
(WebCore::Display::BoxPainter::paintBox):
* display/css/DisplayBoxPainter.h:
* display/css/DisplayCSSPainter.cpp:
(WebCore::Display::CSSPainter::recursivePaintDescendants):
(WebCore::Display::CSSPainter::paintStackingContext):
(WebCore::Display::CSSPainter::paintTree):
* display/css/DisplayCSSPainter.h:
* display/css/DisplayPaintingContext.h: Copied from Source/WebCore/display/css/DisplayBoxPainter.h.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269238 => 269239)


--- trunk/Source/WebCore/ChangeLog	2020-11-01 22:03:36 UTC (rev 269238)
+++ trunk/Source/WebCore/ChangeLog	2020-11-02 01:39:15 UTC (rev 269239)
@@ -1,3 +1,31 @@
+2020-11-01  Simon Fraser  <[email protected]>
+
+        [LFC Display] Pass deviceScaleFactor around with GraphicsContext at paint time
+        https://bugs.webkit.org/show_bug.cgi?id=218423
+
+        Reviewed by Zalan Bujtas.
+
+        Border painting code will need to use deviceScaleFactor at paint time, so make a small
+        struct that bundles GraphicsContext& and deviceScaleFactor together, and pass that to
+        paint functions.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * display/DisplayLayerController.cpp:
+        (WebCore::Display::LayerController::RootLayerClient::paintContents):
+        * display/css/DisplayBoxPainter.cpp:
+        (WebCore::Display::BoxPainter::paintFillLayer):
+        (WebCore::Display::BoxPainter::paintBackgroundImages):
+        (WebCore::Display::BoxPainter::paintBoxDecorations):
+        (WebCore::Display::BoxPainter::paintBoxContent):
+        (WebCore::Display::BoxPainter::paintBox):
+        * display/css/DisplayBoxPainter.h:
+        * display/css/DisplayCSSPainter.cpp:
+        (WebCore::Display::CSSPainter::recursivePaintDescendants):
+        (WebCore::Display::CSSPainter::paintStackingContext):
+        (WebCore::Display::CSSPainter::paintTree):
+        * display/css/DisplayCSSPainter.h:
+        * display/css/DisplayPaintingContext.h: Copied from Source/WebCore/display/css/DisplayBoxPainter.h.
+
 2020-11-01  Zalan Bujtas  <[email protected]>
 
         [LegacyInlineLayout] Remove collapsible trailing whitespace when it is followed by a hard line break

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (269238 => 269239)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-11-01 22:03:36 UTC (rev 269238)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-11-02 01:39:15 UTC (rev 269239)
@@ -5913,6 +5913,7 @@
 		0F26A7AD205626100090A141 /* SVGUnknownElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGUnknownElement.cpp; sourceTree = "<group>"; };
 		0F283A8D235582F8004794CA /* ThemeTypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ThemeTypes.cpp; sourceTree = "<group>"; };
 		0F283A9123563126004794CA /* BorderData.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BorderData.cpp; sourceTree = "<group>"; };
+		0F32BA41254F3216001AC38E /* DisplayPaintingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayPaintingContext.h; sourceTree = "<group>"; };
 		0F36E7361BD1837A002DB891 /* LayoutPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutPoint.cpp; sourceTree = "<group>"; };
 		0F36E7381BD184B9002DB891 /* LayoutSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutSize.cpp; sourceTree = "<group>"; };
 		0F37F0832202AC8F00A89C0B /* ScrollingTreeScrollingNodeDelegateMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreeScrollingNodeDelegateMac.mm; sourceTree = "<group>"; };
@@ -9226,6 +9227,7 @@
 		582DE3221C30C85400BE02A8 /* TextDecorationPainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextDecorationPainter.cpp; sourceTree = "<group>"; };
 		582DE3231C30C85400BE02A8 /* TextDecorationPainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextDecorationPainter.h; sourceTree = "<group>"; };
 		5868C7C42539DA3300BF9DF3 /* JSResizeObserverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSResizeObserverCustom.cpp; sourceTree = "<group>"; };
+		5868C7D52546E0B300BF9DF3 /* JSIntersectionObserverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIntersectionObserverCustom.cpp; sourceTree = "<group>"; };
 		5884FE5622813E2D0040AFF6 /* JSResizeObserverEntryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSResizeObserverEntryCustom.cpp; sourceTree = "<group>"; };
 		589556EC18D4A44000764B03 /* BorderEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BorderEdge.h; sourceTree = "<group>"; };
 		58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BorderEdge.cpp; sourceTree = "<group>"; };
@@ -10016,7 +10018,6 @@
 		77A17AA312F28B2A004E02F6 /* JSOESVertexArrayObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESVertexArrayObject.h; sourceTree = "<group>"; };
 		77AAD6831ECFB66200BFA2D1 /* CredentialCreationOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CredentialCreationOptions.idl; sourceTree = "<group>"; };
 		77AAD6851ECFBD3900BFA2D1 /* CredentialCreationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CredentialCreationOptions.h; sourceTree = "<group>"; };
-		5868C7D52546E0B300BF9DF3 /* JSIntersectionObserverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIntersectionObserverCustom.cpp; sourceTree = "<group>"; };
 		77C13F042165658A002D9C5F /* JSIntersectionObserverEntryCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSIntersectionObserverEntryCustom.cpp; sourceTree = "<group>"; };
 		77CAAAEF1F2FC35000CB5C8D /* VisualViewport.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VisualViewport.idl; sourceTree = "<group>"; };
 		77D50FFA1ED4EC7800DA4C87 /* CredentialRequestOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CredentialRequestOptions.idl; sourceTree = "<group>"; };
@@ -17649,6 +17650,7 @@
 				0F94722D2534BA7300F153C8 /* DisplayFillLayerImageGeometry.h */,
 				0FFF1B75251BC6570098795A /* DisplayImageBox.cpp */,
 				0FFF1B7B251BC6570098795A /* DisplayImageBox.h */,
+				0F32BA41254F3216001AC38E /* DisplayPaintingContext.h */,
 				0FFF1B7C251BC6570098795A /* DisplayReplacedBox.cpp */,
 				0FFF1B79251BC6570098795A /* DisplayReplacedBox.h */,
 				0FFF1B76251BC6570098795A /* DisplayStyle.cpp */,

Modified: trunk/Source/WebCore/display/DisplayLayerController.cpp (269238 => 269239)


--- trunk/Source/WebCore/display/DisplayLayerController.cpp	2020-11-01 22:03:36 UTC (rev 269238)
+++ trunk/Source/WebCore/display/DisplayLayerController.cpp	2020-11-02 01:39:15 UTC (rev 269239)
@@ -31,6 +31,7 @@
 #include "Chrome.h"
 #include "ChromeClient.h"
 #include "DisplayCSSPainter.h"
+#include "DisplayPaintingContext.h"
 #include "DisplayTree.h"
 #include "DisplayView.h"
 #include "Frame.h"
@@ -58,8 +59,10 @@
 {
     ASSERT_UNUSED(layer, layer == m_layerController.contentLayer());
 
-    if (auto* displayTree = m_layerController.m_displayTree.get())
-        CSSPainter::paintTree(*displayTree, context, enclosingIntRect(dirtyRect));
+    if (auto* displayTree = m_layerController.m_displayTree.get()) {
+        PaintingContext paintingContext { context, deviceScaleFactor() };
+        CSSPainter::paintTree(*displayTree, paintingContext, enclosingIntRect(dirtyRect));
+    }
 }
 
 float LayerController::RootLayerClient::deviceScaleFactor() const

Modified: trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp (269238 => 269239)


--- trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp	2020-11-01 22:03:36 UTC (rev 269238)
+++ trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp	2020-11-02 01:39:15 UTC (rev 269239)
@@ -34,6 +34,7 @@
 #include "DisplayContainerBox.h"
 #include "DisplayFillLayerImageGeometry.h"
 #include "DisplayImageBox.h"
+#include "DisplayPaintingContext.h"
 #include "DisplayStyle.h"
 #include "DisplayTextBox.h"
 #include "DisplayTree.h"
@@ -46,9 +47,9 @@
 namespace WebCore {
 namespace Display {
 
-void BoxPainter::paintFillLayer(const BoxModelBox& box, const FillLayer& layer, const FillLayerImageGeometry& geometry, GraphicsContext& context)
+void BoxPainter::paintFillLayer(const BoxModelBox& box, const FillLayer& layer, const FillLayerImageGeometry& geometry, PaintingContext& paintingContext)
 {
-    GraphicsContextStateSaver stateSaver(context, false);
+    GraphicsContextStateSaver stateSaver(paintingContext.context, false);
 
     auto clipRectForLayer = [](const BoxModelBox& box, const FillLayer& layer) {
         switch (layer.clip()) {
@@ -69,7 +70,7 @@
     case FillBox::Padding:
     case FillBox::Content: {
         stateSaver.save();
-        context.clip(clipRectForLayer(box, layer));
+        paintingContext.context.clip(clipRectForLayer(box, layer));
         break;
     }
     case FillBox::Text:
@@ -98,10 +99,10 @@
         InterpolationQuality::Default
     };
 
-    context.drawTiledImage(*image, geometry.destRect(), toFloatPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), options);
+    paintingContext.context.drawTiledImage(*image, geometry.destRect(), toFloatPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), options);
 }
 
-void BoxPainter::paintBackgroundImages(const BoxModelBox& box, GraphicsContext& context)
+void BoxPainter::paintBackgroundImages(const BoxModelBox& box, PaintingContext& paintingContext)
 {
     const auto& style = box.style();
 
@@ -118,11 +119,11 @@
     for (int i = layers.size() - 1; i >=0; --i) {
         const auto* layer = layers[i];
         const auto& geometry = layerGeometryList[i];
-        paintFillLayer(box, *layer, geometry, context);
+        paintFillLayer(box, *layer, geometry, paintingContext);
     }
 }
 
-void BoxPainter::paintBoxDecorations(const BoxModelBox& box, GraphicsContext& context)
+void BoxPainter::paintBoxDecorations(const BoxModelBox& box, PaintingContext& paintingContext)
 {
     // FIXME: Table decoration painting is special.
 
@@ -132,9 +133,9 @@
 
     // Background color
     if (style.hasBackground()) {
-        context.fillRect(borderBoxRect, style.backgroundColor());
+        paintingContext.context.fillRect(borderBoxRect, style.backgroundColor());
         if (style.hasBackgroundImage())
-            paintBackgroundImages(box, context);
+            paintBackgroundImages(box, paintingContext);
     }
 
     // Border
@@ -144,12 +145,12 @@
                 return;
             if (borderStyle.style() == BorderStyle::None || borderStyle.style() == BorderStyle::Hidden)
                 return;
-            context.setStrokeColor(borderStyle.color());
-            context.setStrokeThickness(borderStyle.width());
-            context.drawLine(start, end);
+            paintingContext.context.setStrokeColor(borderStyle.color());
+            paintingContext.context.setStrokeThickness(borderStyle.width());
+            paintingContext.context.drawLine(start, end);
         };
 
-        context.setFillColor(Color::transparentBlack);
+        paintingContext.context.setFillColor(Color::transparentBlack);
 
         // Top
         {
@@ -185,7 +186,7 @@
     }
 }
 
-void BoxPainter::paintBoxContent(const Box& box, GraphicsContext& context)
+void BoxPainter::paintBoxContent(const Box& box, PaintingContext& paintingContext)
 {
     if (is<ImageBox>(box)) {
         auto& imageBox = downcast<ImageBox>(box);
@@ -194,7 +195,7 @@
         auto imageRect = imageBox.replacedContentRect();
 
         if (image)
-            context.drawImage(*image, imageRect);
+            paintingContext.context.drawImage(*image, imageRect);
 
         return;
     }
@@ -205,8 +206,8 @@
         auto& style = box.style();
         auto textRect = box.absoluteBoxRect();
 
-        context.setStrokeColor(style.color());
-        context.setFillColor(style.color());
+        paintingContext.context.setStrokeColor(style.color());
+        paintingContext.context.setFillColor(style.color());
 
         // FIXME: Add non-baseline align painting
         auto baseline = textRect.y() + style.fontMetrics().ascent();
@@ -214,13 +215,12 @@
 
         auto textRun = TextRun { textBox.text().content().substring(textBox.text().start(), textBox.text().length()), textRect.x(), expansion.horizontalExpansion, expansion.behavior };
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
-        context.drawText(style.fontCascade(), textRun, { textRect.x(), baseline });
-        
+        paintingContext.context.drawText(style.fontCascade(), textRun, { textRect.x(), baseline });
         return;
     }
 }
 
-void BoxPainter::paintBox(const Box& box, GraphicsContext& context, const IntRect& dirtyRect)
+void BoxPainter::paintBox(const Box& box, PaintingContext& paintingContext, const IntRect& dirtyRect)
 {
     auto absoluteRect = box.absoluteBoxRect();
     // FIXME: Need to account for visual overflow.
@@ -234,13 +234,13 @@
         auto imageRect = imageBox.replacedContentRect();
 
         if (image)
-            context.drawImage(*image, imageRect);
+            paintingContext.context.drawImage(*image, imageRect);
     }
 
     if (is<BoxModelBox>(box))
-        paintBoxDecorations(downcast<BoxModelBox>(box), context);
+        paintBoxDecorations(downcast<BoxModelBox>(box), paintingContext);
 
-    paintBoxContent(box, context);
+    paintBoxContent(box, paintingContext);
 }
 
 } // namespace Display

Modified: trunk/Source/WebCore/display/css/DisplayBoxPainter.h (269238 => 269239)


--- trunk/Source/WebCore/display/css/DisplayBoxPainter.h	2020-11-01 22:03:36 UTC (rev 269238)
+++ trunk/Source/WebCore/display/css/DisplayBoxPainter.h	2020-11-02 01:39:15 UTC (rev 269239)
@@ -38,19 +38,21 @@
 
 namespace Display {
 
-class FillLayerImageGeometry;
 class Box;
 class BoxModelBox;
+class FillLayerImageGeometry;
 
+struct PaintingContext;
+
 class BoxPainter {
 public:
-    static void paintBox(const Box&, GraphicsContext&, const IntRect& dirtyRect);
-    static void paintBoxDecorations(const BoxModelBox&, GraphicsContext&);
-    static void paintBoxContent(const Box&, GraphicsContext&);
+    static void paintBox(const Box&, PaintingContext&, const IntRect& dirtyRect);
+    static void paintBoxDecorations(const BoxModelBox&, PaintingContext&);
+    static void paintBoxContent(const Box&, PaintingContext&);
 
 private:
-    static void paintBackgroundImages(const BoxModelBox&, GraphicsContext&);
-    static void paintFillLayer(const BoxModelBox&, const FillLayer&, const FillLayerImageGeometry&, GraphicsContext&);
+    static void paintBackgroundImages(const BoxModelBox&, PaintingContext&);
+    static void paintFillLayer(const BoxModelBox&, const FillLayer&, const FillLayerImageGeometry&, PaintingContext&);
 };
 
 } // namespace Display

Modified: trunk/Source/WebCore/display/css/DisplayCSSPainter.cpp (269238 => 269239)


--- trunk/Source/WebCore/display/css/DisplayCSSPainter.cpp	2020-11-01 22:03:36 UTC (rev 269238)
+++ trunk/Source/WebCore/display/css/DisplayCSSPainter.cpp	2020-11-02 01:39:15 UTC (rev 269239)
@@ -30,6 +30,7 @@
 
 #include "DisplayBoxPainter.h"
 #include "DisplayContainerBox.h"
+#include "DisplayPaintingContext.h"
 #include "DisplayStyle.h"
 #include "DisplayTree.h"
 #include "GraphicsContext.h"
@@ -39,7 +40,7 @@
 namespace Display {
 
 // FIXME: Make this an iterator.
-void CSSPainter::recursivePaintDescendants(const ContainerBox& containerBox, GraphicsContext& context, PaintPhase paintPhase)
+void CSSPainter::recursivePaintDescendants(const ContainerBox& containerBox, PaintingContext& paintingContext, PaintPhase paintPhase)
 {
     for (const auto* child = containerBox.firstChild(); child; child = child->nextSibling()) {
         auto& box = *child;
@@ -49,37 +50,37 @@
         switch (paintPhase) {
         case PaintPhase::BlockBackgrounds:
             if (!box.style().isFloating() && !box.style().isPositioned() && is<BoxModelBox>(box))
-                BoxPainter::paintBoxDecorations(downcast<BoxModelBox>(box), context);
+                BoxPainter::paintBoxDecorations(downcast<BoxModelBox>(box), paintingContext);
             break;
         case PaintPhase::Floats:
             if (box.style().isFloating() && !box.style().isPositioned() && is<BoxModelBox>(box))
-                BoxPainter::paintBoxDecorations(downcast<BoxModelBox>(box), context);
+                BoxPainter::paintBoxDecorations(downcast<BoxModelBox>(box), paintingContext);
             break;
         case PaintPhase::BlockForegrounds:
             if (!box.style().isFloating() && !box.style().isPositioned())
-                BoxPainter::paintBoxContent(box, context);
+                BoxPainter::paintBoxContent(box, paintingContext);
         };
         if (is<ContainerBox>(box))
-            recursivePaintDescendants(downcast<ContainerBox>(box), context, paintPhase);
+            recursivePaintDescendants(downcast<ContainerBox>(box), paintingContext, paintPhase);
     }
 }
 
-void CSSPainter::paintStackingContext(const BoxModelBox& contextRoot, GraphicsContext& context, const IntRect& dirtyRect)
+void CSSPainter::paintStackingContext(const BoxModelBox& contextRoot, PaintingContext& paintingContext, const IntRect& dirtyRect)
 {
     UNUSED_PARAM(dirtyRect);
     
-    BoxPainter::paintBoxDecorations(contextRoot, context);
+    BoxPainter::paintBoxDecorations(contextRoot, paintingContext);
 
     auto paintDescendants = [&](const ContainerBox& containerBox) {
         // For all its in-flow, non-positioned, block-level descendants in tree order: If the element is a block, list-item, or other block equivalent:
         // Box decorations.
         // Table decorations.
-        recursivePaintDescendants(containerBox, context, PaintPhase::BlockBackgrounds);
+        recursivePaintDescendants(containerBox, paintingContext, PaintPhase::BlockBackgrounds);
 
         // All non-positioned floating descendants, in tree order. For each one of these, treat the element as if it created a new stacking context,
         // but any positioned descendants and descendants which actually create a new stacking context should be considered part of the parent
         // stacking context, not this new one.
-        recursivePaintDescendants(containerBox, context, PaintPhase::Floats);
+        recursivePaintDescendants(containerBox, paintingContext, PaintPhase::Floats);
 
         // If the element is an inline element that generates a stacking context, then:
         // FIXME: Handle this case.
@@ -87,7 +88,7 @@
         // Otherwise: first for the element, then for all its in-flow, non-positioned, block-level descendants in tree order:
         // 1. If the element is a block-level replaced element, then: the replaced content, atomically.
         // 2. Otherwise, for each line box of that element...
-        recursivePaintDescendants(containerBox, context, PaintPhase::BlockForegrounds);
+        recursivePaintDescendants(containerBox, paintingContext, PaintPhase::BlockForegrounds);
     };
 
     if (is<ContainerBox>(contextRoot)) {
@@ -107,7 +108,7 @@
 
         // Stacking contexts formed by positioned descendants with negative z-indices (excluding 0) in z-index order (most negative first) then tree order.
         for (auto* box : negativeZOrderList)
-            paintStackingContext(*box, context, dirtyRect);
+            paintStackingContext(*box, paintingContext, dirtyRect);
 
         paintDescendants(containerBox);
 
@@ -117,12 +118,12 @@
         // generated atomically.
         for (auto* box : positiveZOrderList) {
             if (box->style().isStackingContext())
-                paintStackingContext(*box, context, dirtyRect);
+                paintStackingContext(*box, paintingContext, dirtyRect);
             else if (is<ContainerBox>(*box)) {
-                BoxPainter::paintBoxDecorations(*box, context);
+                BoxPainter::paintBoxDecorations(*box, paintingContext);
                 paintDescendants(downcast<ContainerBox>(*box));
             } else
-                BoxPainter::paintBox(*box, context, dirtyRect);
+                BoxPainter::paintBox(*box, paintingContext, dirtyRect);
         }
     }
 }
@@ -154,9 +155,9 @@
     }
 }
 
-void CSSPainter::paintTree(const Tree& displayTree, GraphicsContext& context, const IntRect& dirtyRect)
+void CSSPainter::paintTree(const Tree& displayTree, PaintingContext& paintingContext, const IntRect& dirtyRect)
 {
-    paintStackingContext(displayTree.rootBox(), context, dirtyRect);
+    paintStackingContext(displayTree.rootBox(), paintingContext, dirtyRect);
 }
 
 } // namespace Display

Modified: trunk/Source/WebCore/display/css/DisplayCSSPainter.h (269238 => 269239)


--- trunk/Source/WebCore/display/css/DisplayCSSPainter.h	2020-11-01 22:03:36 UTC (rev 269238)
+++ trunk/Source/WebCore/display/css/DisplayCSSPainter.h	2020-11-02 01:39:15 UTC (rev 269239)
@@ -44,10 +44,12 @@
 class ContainerBox;
 class Tree;
 
+struct PaintingContext;
+
 class CSSPainter {
 public:
-    static void paintStackingContext(const BoxModelBox&, GraphicsContext&, const IntRect& dirtyRect);
-    static void paintTree(const Tree&, GraphicsContext&, const IntRect& dirtyRect);
+    static void paintStackingContext(const BoxModelBox&, PaintingContext&, const IntRect& dirtyRect);
+    static void paintTree(const Tree&, PaintingContext&, const IntRect& dirtyRect);
 
 private:
     enum class PaintPhase {
@@ -55,7 +57,7 @@
         Floats,
         BlockForegrounds
     };
-    static void recursivePaintDescendants(const ContainerBox&, GraphicsContext&, PaintPhase);
+    static void recursivePaintDescendants(const ContainerBox&, PaintingContext&, PaintPhase);
 
     static bool isStackingContextPaintingBoundary(const Box&);
     static void recursiveCollectLayers(const ContainerBox&, Vector<const BoxModelBox*>& negativeZOrderList, Vector<const BoxModelBox*>& positiveZOrderList);

Copied: trunk/Source/WebCore/display/css/DisplayPaintingContext.h (from rev 269238, trunk/Source/WebCore/display/css/DisplayBoxPainter.h) (0 => 269239)


--- trunk/Source/WebCore/display/css/DisplayPaintingContext.h	                        (rev 0)
+++ trunk/Source/WebCore/display/css/DisplayPaintingContext.h	2020-11-02 01:39:15 UTC (rev 269239)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+namespace WebCore {
+
+class GraphicsContext;
+
+namespace Display {
+
+struct PaintingContext {
+    GraphicsContext& context;
+    float deviceScaleFactor { 1 };
+};
+
+} // namespace Display
+} // namespace WebCore
+
+
+#endif // ENABLE(LAYOUT_FORMATTING_CONTEXT)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to