Title: [281060] trunk/Source/WebCore
Revision
281060
Author
[email protected]
Date
2021-08-15 08:43:36 -0700 (Sun, 15 Aug 2021)

Log Message

[LFC Display] Add a Display::Box flag for HasTransfrom
https://bugs.webkit.org/show_bug.cgi?id=229115

Reviewed by Alan Bujtas.

It's possible for a non-box model box to have a RenderStyle with a transform, but that
style isn't applied because transforms only apply to atomic inline or block boxes,
so store a bit on Box for boxes that have transforms.

* display/css/DisplayBox.h:
(WebCore::Display::Box::setHasTransform):
(WebCore::Display::Box::hasTransform const):
* display/css/DisplayBoxFactory.cpp:
(WebCore::Display::BoxFactory::constructBoxRareGeometry const):
(WebCore::Display::BoxFactory::setupBoxModelBox const):
* display/css/DisplayCSSPainter.cpp:
(WebCore::Display::CSSPainter::paintAtomicallyPaintedBox):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281059 => 281060)


--- trunk/Source/WebCore/ChangeLog	2021-08-15 05:25:10 UTC (rev 281059)
+++ trunk/Source/WebCore/ChangeLog	2021-08-15 15:43:36 UTC (rev 281060)
@@ -1,3 +1,23 @@
+2021-08-15  Simon Fraser  <[email protected]>
+
+        [LFC Display] Add a Display::Box flag for HasTransfrom
+        https://bugs.webkit.org/show_bug.cgi?id=229115
+
+        Reviewed by Alan Bujtas.
+
+        It's possible for a non-box model box to have a RenderStyle with a transform, but that
+        style isn't applied because transforms only apply to atomic inline or block boxes,
+        so store a bit on Box for boxes that have transforms.
+
+        * display/css/DisplayBox.h:
+        (WebCore::Display::Box::setHasTransform):
+        (WebCore::Display::Box::hasTransform const):
+        * display/css/DisplayBoxFactory.cpp:
+        (WebCore::Display::BoxFactory::constructBoxRareGeometry const):
+        (WebCore::Display::BoxFactory::setupBoxModelBox const):
+        * display/css/DisplayCSSPainter.cpp:
+        (WebCore::Display::CSSPainter::paintAtomicallyPaintedBox):
+
 2021-08-14  Said Abou-Hallawa  <[email protected]>
 
         [GPU Process] REGRESSION: WebContent often crashes when opening a Google spreadsheet with charts

Modified: trunk/Source/WebCore/display/css/DisplayBox.h (281059 => 281060)


--- trunk/Source/WebCore/display/css/DisplayBox.h	2021-08-15 05:25:10 UTC (rev 281059)
+++ trunk/Source/WebCore/display/css/DisplayBox.h	2021-08-15 15:43:36 UTC (rev 281060)
@@ -53,6 +53,10 @@
         LineBreakBox    = 1 << 4, // FIXME: Workaround for webkit.org/b/219335
     };
 
+    enum class StyleFlags : uint8_t {
+        HasTransform     = 1 << 0,
+    };
+
     Box(Tree&, AbsoluteFloatRect, Style&&, OptionSet<TypeFlags> = { });
     virtual ~Box();
 
@@ -77,6 +81,9 @@
     const Box* nextSibling() const { return m_nextSibling.get(); }
     void setNextSibling(std::unique_ptr<Box>&&);
 
+    void setHasTransform(bool value) { m_styleFlags.set(StyleFlags::HasTransform, value); }
+    bool hasTransform() const { return m_styleFlags.contains(StyleFlags::HasTransform); }
+
     void setNeedsDisplay(std::optional<AbsoluteFloatRect> subrect = std::nullopt);
 
     virtual String debugDescription() const;
@@ -89,7 +96,8 @@
     Style m_style;
     ContainerBox* m_parent { nullptr };
     std::unique_ptr<Box> m_nextSibling;
-    OptionSet<TypeFlags> m_typeFlags;
+    const OptionSet<TypeFlags> m_typeFlags;
+    OptionSet<StyleFlags> m_styleFlags;
 };
 
 } // namespace Display

Modified: trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp (281059 => 281060)


--- trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp	2021-08-15 05:25:10 UTC (rev 281059)
+++ trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp	2021-08-15 15:43:36 UTC (rev 281060)
@@ -255,8 +255,10 @@
         boxRareGeometry->setBorderRadii(WTFMove(borderRadii));
     }
 
-    auto transformationMatrix = computeTransformationMatrix(box, layoutGeometry, layoutBox.style(), offsetFromRoot);
-    boxRareGeometry->setTransform(WTFMove(transformationMatrix));
+    if (box.style().hasTransform()) {
+        auto transformationMatrix = computeTransformationMatrix(box, layoutGeometry, layoutBox.style(), offsetFromRoot);
+        boxRareGeometry->setTransform(WTFMove(transformationMatrix));
+    }
 
     return boxRareGeometry;
 }
@@ -268,6 +270,8 @@
     auto boxRareGeometry = constructBoxRareGeometry(box, layoutBox, layoutGeometry, containingBlockContext.offsetFromRoot);
     box.setBoxRareGeometry(WTFMove(boxRareGeometry));
 
+    box.setHasTransform(box.style().hasTransform());
+
     auto& renderStyle = layoutBox.style();
     if (!(styleForBackground && styleForBackground->hasBackground()) && !renderStyle.hasBorder()) // FIXME: Misses border-radius.
         return;

Modified: trunk/Source/WebCore/display/css/DisplayCSSPainter.cpp (281059 => 281060)


--- trunk/Source/WebCore/display/css/DisplayCSSPainter.cpp	2021-08-15 05:25:10 UTC (rev 281059)
+++ trunk/Source/WebCore/display/css/DisplayCSSPainter.cpp	2021-08-15 15:43:36 UTC (rev 281060)
@@ -137,7 +137,7 @@
             return false;
         
         auto& boxModelBox = downcast<BoxModelBox>(box);
-        return boxModelBox.hasAncestorClip() || boxModelBox.style().hasTransform() || boxModelBox.style().opacity() < 1;
+        return boxModelBox.hasAncestorClip() || boxModelBox.hasTransform() || boxModelBox.style().opacity() < 1;
     };
 
     auto stateSaver = GraphicsContextStateSaver { paintingContext.context, needToSaveState(box) };
@@ -145,7 +145,7 @@
     if (is<BoxModelBox>(box))
         applyAncestorClip(downcast<BoxModelBox>(box), paintingContext);
 
-    if (is<BoxModelBox>(box) && box.style().hasTransform()) {
+    if (is<BoxModelBox>(box) && box.hasTransform()) {
         auto transformationMatrix = downcast<BoxModelBox>(box).rareGeometry()->transform();
         auto absoluteBorderBox = box.absoluteBoxRect();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to