Title: [289210] trunk/Source/WebCore
Revision
289210
Author
[email protected]
Date
2022-02-07 05:53:35 -0800 (Mon, 07 Feb 2022)

Log Message

[LBSE] Generalize RenderLayer::renderBoxLocation(), adding support for SVG layers
https://bugs.webkit.org/show_bug.cgi?id=236186

Reviewed by Rob Buis.

The layer-aware RenderSVGModelObject exposes a 'layoutLocation()' method which mimics
the CSS 'location()' of a RenderBox -- the layout procedure itself takes care of
computing these quantities in the correct CSS coordinate system. Therefore, in
RenderLayer we can use RenderSVGModelObject layoutLocation() as drop-in replacment
for the location() method of a RenderBox when handling SVG primitives, while
keeping the rest of RenderLayer as much "SVG unaware" as possible.

renderBoxLocation() is renamed to rendererLocation() and extended to support
RenderSVGModelObject. To keep rendererLocation() inline, RenderLayer needs to
include RenderSVGModelObject, which currently includes the RenderLayer header.
Fix that, by including RenderBox.h and inlining the 'element()' function, in
RenderSVGModelObjectInlines.h - in the same spirit as RenderSVGShapeInlines.h.

Covered by existing tests, no change in behaviour.

* Headers.cmake: Add new PrivateHeaders: RenderSVGModelObject.h / SVGBoundingBoxComputation.h / SVGRenderSupport.h.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintBackgroundForFragments):
(WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
(WebCore::RenderLayer::paintOutlineForFragments):
(WebCore::RenderLayer::paintMaskForFragments):
(WebCore::RenderLayer::paintChildClippingMaskForFragments):
(WebCore::RenderLayer::paintOverflowControlsForFragments):
(WebCore::RenderLayer::collectEventRegionForFragments):
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestContents const):
* rendering/RenderLayer.h:
(WebCore::RenderLayer::rendererLocation const):
(WebCore::RenderLayer::renderBoxLocation const): Deleted.
* rendering/svg/RenderSVGModelObject.h:
(WebCore::RenderSVGModelObject::element const): Deleted.
* rendering/svg/RenderSVGModelObjectInlines.h: Copied from Source/WebCore/rendering/svg/RenderSVGShapeInlines.h.
(WebCore::RenderSVGModelObject::element const):
* rendering/svg/RenderSVGShapeInlines.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289209 => 289210)


--- trunk/Source/WebCore/ChangeLog	2022-02-07 13:51:03 UTC (rev 289209)
+++ trunk/Source/WebCore/ChangeLog	2022-02-07 13:53:35 UTC (rev 289210)
@@ -1,3 +1,46 @@
+2022-02-07  Nikolas Zimmermann  <[email protected]>
+
+        [LBSE] Generalize RenderLayer::renderBoxLocation(), adding support for SVG layers
+        https://bugs.webkit.org/show_bug.cgi?id=236186
+
+        Reviewed by Rob Buis.
+
+        The layer-aware RenderSVGModelObject exposes a 'layoutLocation()' method which mimics
+        the CSS 'location()' of a RenderBox -- the layout procedure itself takes care of
+        computing these quantities in the correct CSS coordinate system. Therefore, in
+        RenderLayer we can use RenderSVGModelObject layoutLocation() as drop-in replacment
+        for the location() method of a RenderBox when handling SVG primitives, while
+        keeping the rest of RenderLayer as much "SVG unaware" as possible.
+
+        renderBoxLocation() is renamed to rendererLocation() and extended to support
+        RenderSVGModelObject. To keep rendererLocation() inline, RenderLayer needs to
+        include RenderSVGModelObject, which currently includes the RenderLayer header.
+        Fix that, by including RenderBox.h and inlining the 'element()' function, in
+        RenderSVGModelObjectInlines.h - in the same spirit as RenderSVGShapeInlines.h.
+
+        Covered by existing tests, no change in behaviour.
+
+        * Headers.cmake: Add new PrivateHeaders: RenderSVGModelObject.h / SVGBoundingBoxComputation.h / SVGRenderSupport.h.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintBackgroundForFragments):
+        (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
+        (WebCore::RenderLayer::paintOutlineForFragments):
+        (WebCore::RenderLayer::paintMaskForFragments):
+        (WebCore::RenderLayer::paintChildClippingMaskForFragments):
+        (WebCore::RenderLayer::paintOverflowControlsForFragments):
+        (WebCore::RenderLayer::collectEventRegionForFragments):
+        (WebCore::RenderLayer::hitTestLayer):
+        (WebCore::RenderLayer::hitTestContents const):
+        * rendering/RenderLayer.h:
+        (WebCore::RenderLayer::rendererLocation const):
+        (WebCore::RenderLayer::renderBoxLocation const): Deleted.
+        * rendering/svg/RenderSVGModelObject.h:
+        (WebCore::RenderSVGModelObject::element const): Deleted.
+        * rendering/svg/RenderSVGModelObjectInlines.h: Copied from Source/WebCore/rendering/svg/RenderSVGShapeInlines.h.
+        (WebCore::RenderSVGModelObject::element const):
+        * rendering/svg/RenderSVGShapeInlines.h:
+
 2022-02-07  Ziran Sun  <[email protected]>
 
         [Forms] Use min as default value when min > max for input type="range"

Modified: trunk/Source/WebCore/Headers.cmake (289209 => 289210)


--- trunk/Source/WebCore/Headers.cmake	2022-02-07 13:51:03 UTC (rev 289209)
+++ trunk/Source/WebCore/Headers.cmake	2022-02-07 13:53:35 UTC (rev 289210)
@@ -1912,6 +1912,10 @@
     rendering/style/TextUnderlineOffset.h
     rendering/style/WillChangeData.h
 
+    rendering/svg/RenderSVGModelObject.h
+    rendering/svg/SVGBoundingBoxComputation.h
+    rendering/svg/SVGRenderSupport.h
+
     replay/UserInputBridge.h
 
     storage/Storage.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (289209 => 289210)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-02-07 13:51:03 UTC (rev 289209)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-02-07 13:53:35 UTC (rev 289210)
@@ -242,7 +242,7 @@
 		081EBF3B0FD34F4100DA7559 /* SVGFilterBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */; };
 		083DAEA70F01A7FB00342754 /* RenderTextControlMultiLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 083DAEA30F01A7FB00342754 /* RenderTextControlMultiLine.h */; };
 		083DAEA90F01A7FB00342754 /* RenderTextControlSingleLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 083DAEA50F01A7FB00342754 /* RenderTextControlSingleLine.h */; };
-		0844B01D1255B4E600B9CDD0 /* SVGBoundingBoxComputation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0844B01D1255E4E600B9CDD0 /* SVGBoundingBoxComputation.h */; };
+		0844B01D1255B4E600B9CDD0 /* SVGBoundingBoxComputation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0844B01D1255E4E600B9CDD0 /* SVGBoundingBoxComputation.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0844B01D1255B5A610B8AFD1 /* SVGContainerLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 0844B01D1255E5A610B8AFD1 /* SVGContainerLayout.h */; };
 		0845680812B90DA600960A9F /* FontMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 0845680712B90DA600960A9F /* FontMetrics.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0854B0151255E4E600B9CDD0 /* RenderSVGInline.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B0031255E4E600B9CDD0 /* RenderSVGInline.h */; };
@@ -1264,12 +1264,12 @@
 		436708E912D9CA4B00044234 /* RenderSVGTransformableContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AA12D9CA4B00044234 /* RenderSVGTransformableContainer.h */; };
 		436708EB12D9CA4B00044234 /* RenderSVGViewportContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */; };
 		436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AF12D9CA4B00044234 /* SVGMarkerData.h */; };
-		436708F212D9CA4B00044234 /* SVGRenderSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B312D9CA4B00044234 /* SVGRenderSupport.h */; };
+		436708F212D9CA4B00044234 /* SVGRenderSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B312D9CA4B00044234 /* SVGRenderSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		436708F412D9CA4B00044234 /* SVGRenderTreeAsText.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B512D9CA4B00044234 /* SVGRenderTreeAsText.h */; };
 		436708F612D9CA4B00044234 /* SVGResources.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B712D9CA4B00044234 /* SVGResources.h */; };
 		436708F812D9CA4B00044234 /* SVGResourcesCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B912D9CA4B00044234 /* SVGResourcesCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		436708FA12D9CA4B00044234 /* SVGResourcesCycleSolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708BB12D9CA4B00044234 /* SVGResourcesCycleSolver.h */; };
-		43670C9342D9BC4B00044234 /* RenderSVGModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708FD12D9CA4A00032114 /* RenderSVGModelObject.h */; };
+		43670C9342D9BC4B00044234 /* RenderSVGModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708FD12D9CA4A00032114 /* RenderSVGModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		439046D812DA25E800AF80A2 /* RenderMathMLBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046C412DA25E800AF80A2 /* RenderMathMLBlock.h */; };
 		439046DA12DA25E800AF80A2 /* RenderMathMLFenced.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046C612DA25E800AF80A2 /* RenderMathMLFenced.h */; };
 		439046DA12DA25E800AF81B3 /* RenderMathMLFencedOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046C612DA25E800AF81B3 /* RenderMathMLFencedOperator.h */; };
@@ -4641,6 +4641,7 @@
 		CDF747E6270F6966008FEEEC /* SVGInlineTextBoxInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747E5270F6966008FEEEC /* SVGInlineTextBoxInlines.h */; };
 		CDF747E9270F6CAE008FEEEC /* RenderSVGInlineInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747E8270F6CAE008FEEEC /* RenderSVGInlineInlines.h */; };
 		CDF747EB270F6D88008FEEEC /* RenderSVGBlockInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747EA270F6D88008FEEEC /* RenderSVGBlockInlines.h */; };
+		CDF747EB361AAC77013FEEEC /* RenderSVGModelObjectInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747EA361AAC77013FEEEC /* RenderSVGModelObjectInlines.h */; };
 		CDF747ED270F6ED1008FEEEC /* RenderSVGResourceFilterInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747EC270F6ED1008FEEEC /* RenderSVGResourceFilterInlines.h */; };
 		CDF747EF270F6F8D008FEEEC /* RenderSVGResourceClipperInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747EE270F6F8D008FEEEC /* RenderSVGResourceClipperInlines.h */; };
 		CDF747F1270F766F008FEEEC /* RenderSVGResourceMarkerInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747F0270F766F008FEEEC /* RenderSVGResourceMarkerInlines.h */; };
@@ -16344,6 +16345,7 @@
 		CDF747E5270F6966008FEEEC /* SVGInlineTextBoxInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGInlineTextBoxInlines.h; sourceTree = "<group>"; };
 		CDF747E8270F6CAE008FEEEC /* RenderSVGInlineInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGInlineInlines.h; sourceTree = "<group>"; };
 		CDF747EA270F6D88008FEEEC /* RenderSVGBlockInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGBlockInlines.h; sourceTree = "<group>"; };
+		CDF747EA361AAC77013FEEEC /* RenderSVGModelObjectInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGModelObjectInlines.h; sourceTree = "<group>"; };
 		CDF747EC270F6ED1008FEEEC /* RenderSVGResourceFilterInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceFilterInlines.h; sourceTree = "<group>"; };
 		CDF747EE270F6F8D008FEEEC /* RenderSVGResourceClipperInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceClipperInlines.h; sourceTree = "<group>"; };
 		CDF747F0270F766F008FEEEC /* RenderSVGResourceMarkerInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceMarkerInlines.h; sourceTree = "<group>"; };
@@ -19026,6 +19028,7 @@
 				0854B0051255E4E600B9CDD0 /* RenderSVGInlineText.h */,
 				4367088D34E9CA4A00044234 /* RenderSVGModelObject.cpp */,
 				436708FD12D9CA4A00032114 /* RenderSVGModelObject.h */,
+				CDF747EA361AAC77013FEEEC /* RenderSVGModelObjectInlines.h */,
 				ADDF1AD41257CD9A0003A759 /* RenderSVGPath.cpp */,
 				ADDF1AD51257CD9A0003A759 /* RenderSVGPath.h */,
 				A10BB5821484E3A700B3AB6D /* RenderSVGRect.cpp */,
@@ -36853,6 +36856,7 @@
 				CDF747E9270F6CAE008FEEEC /* RenderSVGInlineInlines.h in Headers */,
 				0854B0171255E4E600B9CDD0 /* RenderSVGInlineText.h in Headers */,
 				43670C9342D9BC4B00044234 /* RenderSVGModelObject.h in Headers */,
+				CDF747EB361AAC77013FEEEC /* RenderSVGModelObjectInlines.h in Headers */,
 				ADDF1AD71257CD9A0003A759 /* RenderSVGPath.h in Headers */,
 				A10BB5851484E3A700B3AB6D /* RenderSVGRect.h in Headers */,
 				436708CD12D9CA4B00044234 /* RenderSVGResource.h in Headers */,

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (289209 => 289210)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-02-07 13:51:03 UTC (rev 289209)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-02-07 13:53:35 UTC (rev 289210)
@@ -3796,7 +3796,7 @@
         // Paint the background.
         // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
         PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhase::BlockBackground, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer(), this);
-        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
+        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - rendererLocation() + localPaintingInfo.subpixelOffset));
     }
 }
 
@@ -3891,7 +3891,7 @@
         PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer(), this, localPaintingInfo.requireSecurityOriginAccessForWidgets);
         if (phase == PaintPhase::Foreground)
             paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests;
-        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
+        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - rendererLocation() + localPaintingInfo.subpixelOffset));
     }
 }
 
@@ -3909,7 +3909,7 @@
         EventRegionContextStateSaver eventRegionStateSaver(localPaintingInfo.eventRegionContext);
 
         clipToRect(context, stateSaver, eventRegionStateSaver, localPaintingInfo, paintBehavior, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius);
-        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
+        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - rendererLocation() + localPaintingInfo.subpixelOffset));
     }
 }
 
@@ -3929,7 +3929,7 @@
         // Paint the mask.
         // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
         PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhase::Mask, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer(), this);
-        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
+        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - rendererLocation() + localPaintingInfo.subpixelOffset));
     }
 }
 
@@ -3947,7 +3947,7 @@
 
         // Paint the clipped mask.
         PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhase::ClippingMask, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer(), this);
-        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
+        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - rendererLocation() + localPaintingInfo.subpixelOffset));
     }
 }
 
@@ -3963,7 +3963,7 @@
         EventRegionContextStateSaver eventRegionStateSaver(localPaintingInfo.eventRegionContext);
 
         clipToRect(context, stateSaver, eventRegionStateSaver, localPaintingInfo, { }, fragment.backgroundRect);
-        m_scrollableArea->paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)), snappedIntRect(fragment.backgroundRect.rect()), true);
+        m_scrollableArea->paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - rendererLocation() + localPaintingInfo.subpixelOffset)), snappedIntRect(fragment.backgroundRect.rect()), true);
     }
 }
 
@@ -3974,7 +3974,7 @@
     for (const auto& fragment : layerFragments) {
         PaintInfo paintInfo(context, fragment.foregroundRect.rect(), PaintPhase::EventRegion, paintBehavior);
         paintInfo.eventRegionContext = localPaintingInfo.eventRegionContext;
-        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
+        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - rendererLocation() + localPaintingInfo.subpixelOffset));
     }
 }
 
@@ -4245,7 +4245,7 @@
 
     auto offsetFromRoot = offsetFromAncestor(rootLayer);
     // FIXME: We need to correctly hit test the clip-path when we have a RenderInline too.
-    if (auto* rendererBox = this->renderBox(); rendererBox && !rendererBox->hitTestClipPath(hitTestLocation, toLayoutPoint(offsetFromRoot - toLayoutSize(renderBoxLocation()))))
+    if (auto* rendererBox = this->renderBox(); rendererBox && !rendererBox->hitTestClipPath(hitTestLocation, toLayoutPoint(offsetFromRoot - toLayoutSize(rendererLocation()))))
         return nullptr;
 
     // Begin by walking our list of positive layers from highest z-index down to the lowest z-index.
@@ -4419,7 +4419,7 @@
 {
     ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
 
-    if (!renderer().hitTest(request, result, hitTestLocation, toLayoutPoint(layerBounds.location() - renderBoxLocation()), hitTestFilter)) {
+    if (!renderer().hitTest(request, result, hitTestLocation, toLayoutPoint(layerBounds.location() - rendererLocation()), hitTestFilter)) {
         // It's wrong to set innerNode, but then claim that you didn't hit anything, unless it is
         // a rect-based test.
         ASSERT(!result.innerNode() || (request.resultIsElementList() && result.listBasedTestResult().size()));

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (289209 => 289210)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2022-02-07 13:51:03 UTC (rev 289209)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2022-02-07 13:53:35 UTC (rev 289210)
@@ -51,6 +51,7 @@
 #include "PaintInfo.h"
 #include "RenderBox.h"
 #include "RenderPtr.h"
+#include "RenderSVGModelObject.h"
 #include "ScrollBehavior.h"
 #include <memory>
 #include <wtf/Markable.h>
@@ -967,7 +968,16 @@
 
     RenderLayer* enclosingPaginationLayerInSubtree(const RenderLayer* rootLayer, PaginationInclusionMode) const;
 
-    LayoutPoint renderBoxLocation() const { return is<RenderBox>(renderer()) ? downcast<RenderBox>(renderer()).location() : LayoutPoint(); }
+    LayoutPoint rendererLocation() const
+    {
+        if (is<RenderBox>(renderer()))
+            return downcast<RenderBox>(renderer()).location();
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+        if (is<RenderSVGModelObject>(renderer()))
+            return downcast<RenderSVGModelObject>(renderer()).layoutLocation();
+#endif
+        return LayoutPoint();
+    }
 
     bool setupFontSubpixelQuantization(GraphicsContext&, bool& didQuantizeFonts);
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h (289209 => 289210)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h	2022-02-07 13:51:03 UTC (rev 289209)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h	2022-02-07 13:53:35 UTC (rev 289210)
@@ -32,10 +32,9 @@
 #pragma once
 
 #if ENABLE(LAYER_BASED_SVG_ENGINE)
-#include "RenderLayer.h"
+#include "RenderBox.h"
 #include "RenderLayerModelObject.h"
 #include "SVGBoundingBoxComputation.h"
-#include "SVGElement.h"
 #include "SVGRenderSupport.h"
 
 namespace WebCore {
@@ -57,7 +56,7 @@
     static bool checkIntersection(RenderElement*, const FloatRect&);
     static bool checkEnclosure(RenderElement*, const FloatRect&);
 
-    SVGElement& element() const { return downcast<SVGElement>(nodeForNonAnonymous()); }
+    inline SVGElement& element() const;
 
     // FIXME: [LBSE] Mark final, add applyTransform to RenderLayerModelObject
     void applyTransform(TransformationMatrix&, const RenderStyle&, const FloatRect& boundingBox, OptionSet<RenderStyle::TransformOperationOption>) const;

Copied: trunk/Source/WebCore/rendering/svg/RenderSVGModelObjectInlines.h (from rev 289209, trunk/Source/WebCore/rendering/svg/RenderSVGShapeInlines.h) (0 => 289210)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObjectInlines.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObjectInlines.h	2022-02-07 13:53:35 UTC (rev 289210)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2022 Igalia S.L.
+ *
+ * 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
+
+#include "RenderSVGModelObject.h"
+#include "SVGElement.h"
+
+namespace WebCore {
+
+inline SVGElement& RenderSVGModelObject::element() const
+{
+    return downcast<SVGElement>(nodeForNonAnonymous());
+}
+
+} // namespace WebCore
+

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShapeInlines.h (289209 => 289210)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShapeInlines.h	2022-02-07 13:51:03 UTC (rev 289209)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShapeInlines.h	2022-02-07 13:53:35 UTC (rev 289210)
@@ -26,6 +26,7 @@
 #pragma once
 
 #if ENABLE(LAYER_BASED_SVG_ENGINE)
+#include "RenderSVGModelObjectInlines.h"
 #include "RenderSVGShape.h"
 #include "SVGGraphicsElement.h"
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to