Title: [286962] trunk/Source/WebCore
Revision
286962
Author
[email protected]
Date
2021-12-13 11:55:06 -0800 (Mon, 13 Dec 2021)

Log Message

[LBSE] Rename RenderSVGModelObject -> LegacyRenderSVGModelObject
https://bugs.webkit.org/show_bug.cgi?id=234235

Reviewed by Rob Buis.

RenderSVGModelObject will inherit from RenderLayerModelObject in LBSE,
therefore rename the current implementation to LegacyRenderSVGRoot and
adapt all callsites.

Covered by existing tests, no change in behaviour.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::computedFragmentedFlowState):
* rendering/RenderObject.h:
(WebCore::RenderObject::isLegacyRenderSVGModelObject const):
(WebCore::RenderObject::isRenderOrLegacyRenderSVGModelObject const):
* rendering/svg/LegacyRenderSVGModelObject.cpp: Renamed from Source/WebCore/rendering/svg/RenderSVGModelObject.cpp.
(WebCore::LegacyRenderSVGModelObject::LegacyRenderSVGModelObject):
(WebCore::LegacyRenderSVGModelObject::clippedOverflowRect const):
(WebCore::LegacyRenderSVGModelObject::computeFloatVisibleRectInContainer const):
(WebCore::LegacyRenderSVGModelObject::mapLocalToContainer const):
(WebCore::LegacyRenderSVGModelObject::pushMappingToContainer const):
(WebCore::LegacyRenderSVGModelObject::outlineBoundsForRepaint const):
(WebCore::LegacyRenderSVGModelObject::absoluteRects const):
(WebCore::LegacyRenderSVGModelObject::absoluteQuads const):
(WebCore::LegacyRenderSVGModelObject::willBeDestroyed):
(WebCore::LegacyRenderSVGModelObject::styleDidChange):
(WebCore::LegacyRenderSVGModelObject::nodeAtPoint):
(WebCore::LegacyRenderSVGModelObject::absoluteFocusRingQuads):
(WebCore::LegacyRenderSVGModelObject::checkIntersection):
(WebCore::LegacyRenderSVGModelObject::checkEnclosure):
* rendering/svg/LegacyRenderSVGModelObject.h: Renamed from Source/WebCore/rendering/svg/RenderSVGModelObject.h.
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::RenderSVGContainer):
(WebCore::RenderSVGContainer::layout):
* rendering/svg/RenderSVGContainer.h:
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::RenderSVGImage):
(WebCore::RenderSVGImage::willBeDestroyed):
(WebCore::RenderSVGImage::imageElement const):
(WebCore::RenderSVGImage::layout):
* rendering/svg/RenderSVGImage.h:
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::RenderSVGShape):
(WebCore::RenderSVGShape::layout):
* rendering/svg/RenderSVGShape.h:
* rendering/svg/RenderSVGShapeInlines.h:
(WebCore::RenderSVGShape::graphicsElement const):
* svg/SVGSVGElement.cpp:
(WebCore::checkIntersectionWithoutUpdatingLayout):
(WebCore::checkEnclosureWithoutUpdatingLayout):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286961 => 286962)


--- trunk/Source/WebCore/ChangeLog	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/ChangeLog	2021-12-13 19:55:06 UTC (rev 286962)
@@ -1,3 +1,62 @@
+2021-12-13  Nikolas Zimmermann  <[email protected]>
+
+        [LBSE] Rename RenderSVGModelObject -> LegacyRenderSVGModelObject
+        https://bugs.webkit.org/show_bug.cgi?id=234235
+
+        Reviewed by Rob Buis.
+
+        RenderSVGModelObject will inherit from RenderLayerModelObject in LBSE,
+        therefore rename the current implementation to LegacyRenderSVGRoot and
+        adapt all callsites.
+
+        Covered by existing tests, no change in behaviour.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::isLayoutDependent):
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::computedFragmentedFlowState):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isLegacyRenderSVGModelObject const):
+        (WebCore::RenderObject::isRenderOrLegacyRenderSVGModelObject const):
+        * rendering/svg/LegacyRenderSVGModelObject.cpp: Renamed from Source/WebCore/rendering/svg/RenderSVGModelObject.cpp.
+        (WebCore::LegacyRenderSVGModelObject::LegacyRenderSVGModelObject):
+        (WebCore::LegacyRenderSVGModelObject::clippedOverflowRect const):
+        (WebCore::LegacyRenderSVGModelObject::computeFloatVisibleRectInContainer const):
+        (WebCore::LegacyRenderSVGModelObject::mapLocalToContainer const):
+        (WebCore::LegacyRenderSVGModelObject::pushMappingToContainer const):
+        (WebCore::LegacyRenderSVGModelObject::outlineBoundsForRepaint const):
+        (WebCore::LegacyRenderSVGModelObject::absoluteRects const):
+        (WebCore::LegacyRenderSVGModelObject::absoluteQuads const):
+        (WebCore::LegacyRenderSVGModelObject::willBeDestroyed):
+        (WebCore::LegacyRenderSVGModelObject::styleDidChange):
+        (WebCore::LegacyRenderSVGModelObject::nodeAtPoint):
+        (WebCore::LegacyRenderSVGModelObject::absoluteFocusRingQuads):
+        (WebCore::LegacyRenderSVGModelObject::checkIntersection):
+        (WebCore::LegacyRenderSVGModelObject::checkEnclosure):
+        * rendering/svg/LegacyRenderSVGModelObject.h: Renamed from Source/WebCore/rendering/svg/RenderSVGModelObject.h.
+        * rendering/svg/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::RenderSVGContainer):
+        (WebCore::RenderSVGContainer::layout):
+        * rendering/svg/RenderSVGContainer.h:
+        * rendering/svg/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::RenderSVGImage):
+        (WebCore::RenderSVGImage::willBeDestroyed):
+        (WebCore::RenderSVGImage::imageElement const):
+        (WebCore::RenderSVGImage::layout):
+        * rendering/svg/RenderSVGImage.h:
+        * rendering/svg/RenderSVGShape.cpp:
+        (WebCore::RenderSVGShape::RenderSVGShape):
+        (WebCore::RenderSVGShape::layout):
+        * rendering/svg/RenderSVGShape.h:
+        * rendering/svg/RenderSVGShapeInlines.h:
+        (WebCore::RenderSVGShape::graphicsElement const):
+        * svg/SVGSVGElement.cpp:
+        (WebCore::checkIntersectionWithoutUpdatingLayout):
+        (WebCore::checkEnclosureWithoutUpdatingLayout):
+
 2021-12-13  Elliott Williams  <[email protected]>
 
         Deployment target for macOS 11+ does not follow minor version bumps

Modified: trunk/Source/WebCore/Sources.txt (286961 => 286962)


--- trunk/Source/WebCore/Sources.txt	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/Sources.txt	2021-12-13 19:55:06 UTC (rev 286962)
@@ -2461,6 +2461,7 @@
 rendering/style/StyleVisualData.cpp
 rendering/style/TextSizeAdjustment.cpp
 rendering/style/WillChangeData.cpp
+rendering/svg/LegacyRenderSVGModelObject.cpp
 rendering/svg/LegacyRenderSVGRoot.cpp
 rendering/svg/RenderSVGBlock.cpp
 rendering/svg/RenderSVGContainer.cpp
@@ -2471,7 +2472,6 @@
 rendering/svg/RenderSVGImage.cpp
 rendering/svg/RenderSVGInline.cpp
 rendering/svg/RenderSVGInlineText.cpp
-rendering/svg/RenderSVGModelObject.cpp
 rendering/svg/RenderSVGPath.cpp
 rendering/svg/RenderSVGRect.cpp
 rendering/svg/RenderSVGResource.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (286961 => 286962)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-12-13 19:55:06 UTC (rev 286962)
@@ -1241,7 +1241,7 @@
 		436708C512D9CA4B00044234 /* RenderSVGGradientStop.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367088612D9CA4A00044234 /* RenderSVGGradientStop.h */; };
 		436708C712D9CA4B00044234 /* RenderSVGHiddenContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367088812D9CA4A00044234 /* RenderSVGHiddenContainer.h */; };
 		436708C912D9CA4B00044234 /* RenderSVGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367088A12D9CA4A00044234 /* RenderSVGImage.h */; };
-		436708CB12D9CA4B00044234 /* RenderSVGModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367088C12D9CA4A00044234 /* RenderSVGModelObject.h */; };
+		436708CB12D9CA4B00044234 /* LegacyRenderSVGModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367088C12D9CA4A00044234 /* LegacyRenderSVGModelObject.h */; };
 		436708CD12D9CA4B00044234 /* RenderSVGResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367088E12D9CA4A00044234 /* RenderSVGResource.h */; };
 		436708CF12D9CA4B00044234 /* RenderSVGResourceClipper.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367089012D9CA4A00044234 /* RenderSVGResourceClipper.h */; };
 		436708D112D9CA4B00044234 /* RenderSVGResourceContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4367089212D9CA4A00044234 /* RenderSVGResourceContainer.h */; };
@@ -8961,8 +8961,8 @@
 		4367088812D9CA4A00044234 /* RenderSVGHiddenContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGHiddenContainer.h; sourceTree = "<group>"; };
 		4367088912D9CA4A00044234 /* RenderSVGImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGImage.cpp; sourceTree = "<group>"; };
 		4367088A12D9CA4A00044234 /* RenderSVGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGImage.h; sourceTree = "<group>"; };
-		4367088B12D9CA4A00044234 /* RenderSVGModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGModelObject.cpp; sourceTree = "<group>"; };
-		4367088C12D9CA4A00044234 /* RenderSVGModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGModelObject.h; sourceTree = "<group>"; };
+		4367088B12D9CA4A00044234 /* LegacyRenderSVGModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyRenderSVGModelObject.cpp; sourceTree = "<group>"; };
+		4367088C12D9CA4A00044234 /* LegacyRenderSVGModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyRenderSVGModelObject.h; sourceTree = "<group>"; };
 		4367088D12D9CA4A00044234 /* RenderSVGResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResource.cpp; sourceTree = "<group>"; };
 		4367088E12D9CA4A00044234 /* RenderSVGResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResource.h; sourceTree = "<group>"; };
 		4367088F12D9CA4A00044234 /* RenderSVGResourceClipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceClipper.cpp; sourceTree = "<group>"; };
@@ -18847,6 +18847,8 @@
 		088C2F7412390080003D65CE /* svg */ = {
 			isa = PBXGroup;
 			children = (
+				4367088B12D9CA4A00044234 /* LegacyRenderSVGModelObject.cpp */,
+				4367088C12D9CA4A00044234 /* LegacyRenderSVGModelObject.h */,
 				436708A512D9CA4B00044234 /* LegacyRenderSVGRoot.cpp */,
 				436708A612D9CA4B00044234 /* LegacyRenderSVGRoot.h */,
 				4367088112D9CA4A00044234 /* RenderSVGBlock.cpp */,
@@ -18870,8 +18872,6 @@
 				CDF747E8270F6CAE008FEEEC /* RenderSVGInlineInlines.h */,
 				0854B0041255E4E600B9CDD0 /* RenderSVGInlineText.cpp */,
 				0854B0051255E4E600B9CDD0 /* RenderSVGInlineText.h */,
-				4367088B12D9CA4A00044234 /* RenderSVGModelObject.cpp */,
-				4367088C12D9CA4A00044234 /* RenderSVGModelObject.h */,
 				ADDF1AD41257CD9A0003A759 /* RenderSVGPath.cpp */,
 				ADDF1AD51257CD9A0003A759 /* RenderSVGPath.h */,
 				A10BB5821484E3A700B2E87A /* RenderSVGRect.cpp */,
@@ -35796,6 +35796,7 @@
 				F44A5F591FED38F2007F5944 /* LegacyNSPasteboardTypes.h in Headers */,
 				A185B42A1E8211A100DC9118 /* LegacyPreviewLoader.h in Headers */,
 				A10DBF4718F92317000D70C6 /* LegacyPreviewLoaderClient.h in Headers */,
+				436708CB12D9CA4B00044234 /* LegacyRenderSVGModelObject.h in Headers */,
 				436708E512D9CA4B00044234 /* LegacyRenderSVGRoot.h in Headers */,
 				A8CFF5E10A155A05000A4234 /* LegacyRootInlineBox.h in Headers */,
 				5162C7F511F77EFB00612EFE /* LegacySchemeRegistry.h in Headers */,
@@ -36600,7 +36601,6 @@
 				0854B0151255E4E600B9CDD0 /* RenderSVGInline.h in Headers */,
 				CDF747E9270F6CAE008FEEEC /* RenderSVGInlineInlines.h in Headers */,
 				0854B0171255E4E600B9CDD0 /* RenderSVGInlineText.h in Headers */,
-				436708CB12D9CA4B00044234 /* RenderSVGModelObject.h in Headers */,
 				ADDF1AD71257CD9A0003A759 /* RenderSVGPath.h in Headers */,
 				A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */,
 				436708CD12D9CA4B00044234 /* RenderSVGResource.h in Headers */,

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (286961 => 286962)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -2257,7 +2257,7 @@
     case CSSPropertyHeight:
     case CSSPropertyInlineSize:
     case CSSPropertyBlockSize:
-        return renderer && !renderer->isRenderSVGModelObject() && !isNonReplacedInline(*renderer);
+        return renderer && !renderer->isRenderOrLegacyRenderSVGModelObject() && !isNonReplacedInline(*renderer);
     case CSSPropertyPerspectiveOrigin:
     case CSSPropertyTransformOrigin:
     case CSSPropertyTransform:
@@ -3134,7 +3134,7 @@
         case CSSPropertyGap:
             return getCSSPropertyValuesForShorthandProperties(gapShorthand());
         case CSSPropertyHeight:
-            if (renderer && !renderer->isRenderSVGModelObject()) {
+            if (renderer && !renderer->isRenderOrLegacyRenderSVGModelObject()) {
                 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-property,
                 // the "height" property does not apply for non-replaced inline elements.
                 if (!isNonReplacedInline(*renderer))
@@ -3460,7 +3460,7 @@
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
             return cssValuePool.createValue(style.widows(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWidth:
-            if (renderer && !renderer->isRenderSVGModelObject()) {
+            if (renderer && !renderer->isRenderOrLegacyRenderSVGModelObject()) {
                 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-property,
                 // the "width" property does not apply for non-replaced inline elements.
                 if (!isNonReplacedInline(*renderer))

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (286961 => 286962)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -43,6 +43,7 @@
 #include "HTMLTableElement.h"
 #include "HitTestResult.h"
 #include "LayoutIntegrationLineLayout.h"
+#include "LegacyRenderSVGModelObject.h"
 #include "LegacyRenderSVGRoot.h"
 #include "LogicalSelectionOffsetCaches.h"
 #include "Page.h"
@@ -63,7 +64,6 @@
 #include "RenderRuby.h"
 #include "RenderSVGBlock.h"
 #include "RenderSVGInline.h"
-#include "RenderSVGModelObject.h"
 #include "RenderSVGResourceContainer.h"
 #include "RenderScrollbarPart.h"
 #include "RenderTableRow.h"
@@ -238,7 +238,7 @@
     auto inheritedFlowState = RenderObject::NotInsideFragmentedFlow;
     if (is<RenderText>(renderer))
         inheritedFlowState = renderer.parent()->fragmentedFlowState();
-    else if (is<RenderSVGBlock>(renderer) || is<RenderSVGInline>(renderer) || is<RenderSVGModelObject>(renderer)) {
+    else if (is<RenderSVGBlock>(renderer) || is<RenderSVGInline>(renderer) || is<LegacyRenderSVGModelObject>(renderer)) {
         // containingBlock() skips svg boundary (SVG root is a RenderReplaced).
         if (auto* svgRoot = SVGRenderSupport::findTreeRootObject(downcast<RenderElement>(renderer)))
             inheritedFlowState = svgRoot->fragmentedFlowState();

Modified: trunk/Source/WebCore/rendering/RenderObject.h (286961 => 286962)


--- trunk/Source/WebCore/rendering/RenderObject.h	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2021-12-13 19:55:06 UTC (rev 286962)
@@ -324,8 +324,7 @@
     virtual bool isRenderMathMLUnderOver() const { return false; }
 #endif // ENABLE(MATHML)
 
-    // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have
-    // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation.
+    virtual bool isLegacyRenderSVGModelObject() const { return false; }
     virtual bool isRenderSVGModelObject() const { return false; }
     virtual bool isRenderSVGBlock() const { return false; };
     virtual bool isLegacySVGRoot() const { return false; }
@@ -349,6 +348,7 @@
     virtual bool isSVGResourceClipper() const { return false; }
     virtual bool isSVGResourceFilterPrimitive() const { return false; }
     bool isSVGRootOrLegacySVGRoot() const { return isSVGRoot() || isLegacySVGRoot(); }
+    bool isRenderOrLegacyRenderSVGModelObject() const { return isRenderSVGModelObject() || isLegacyRenderSVGModelObject(); }
 
     // FIXME: Those belong into a SVG specific base-class for all renderers (see above)
     // Unfortunately we don't have such a class yet, because it's not possible for all renderers

Copied: trunk/Source/WebCore/rendering/svg/LegacyRenderSVGModelObject.cpp (from rev 286961, trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp) (0 => 286962)


--- trunk/Source/WebCore/rendering/svg/LegacyRenderSVGModelObject.cpp	                        (rev 0)
+++ trunk/Source/WebCore/rendering/svg/LegacyRenderSVGModelObject.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2009, Google 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:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+#include "LegacyRenderSVGModelObject.h"
+
+#include "NotImplemented.h"
+#include "RenderLayer.h"
+#include "RenderLayerModelObject.h"
+#include "RenderSVGResource.h"
+#include "RenderView.h"
+#include "SVGElementInlines.h"
+#include "SVGNames.h"
+#include "SVGResourcesCache.h"
+#include "ShadowRoot.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(LegacyRenderSVGModelObject);
+
+LegacyRenderSVGModelObject::LegacyRenderSVGModelObject(SVGElement& element, RenderStyle&& style)
+    : RenderElement(element, WTFMove(style), 0)
+{
+}
+
+LayoutRect LegacyRenderSVGModelObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
+{
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+    if (document().settings().layerBasedSVGEngineEnabled()) {
+        if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
+            return LayoutRect();
+
+        ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled());
+        return computeRect(visualOverflowRectEquivalent(), repaintContainer, context);
+    }
+#else
+    UNUSED_PARAM(context);
+#endif
+
+    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
+}
+
+std::optional<FloatRect> LegacyRenderSVGModelObject::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
+{
+    return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context);
+}
+
+void LegacyRenderSVGModelObject::mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState& transformState, OptionSet<MapCoordinatesMode>, bool* wasFixed) const
+{
+    SVGRenderSupport::mapLocalToContainer(*this, ancestorContainer, transformState, wasFixed);
+}
+
+const RenderObject* LegacyRenderSVGModelObject::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
+{
+    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
+}
+
+// Copied from RenderBox, this method likely requires further refactoring to work easily for both SVG and CSS Box Model content.
+// FIXME: This may also need to move into SVGRenderSupport as the RenderBox version depends
+// on borderBoundingBox() which SVG RenderBox subclases (like SVGRenderBlock) do not implement.
+LayoutRect LegacyRenderSVGModelObject::outlineBoundsForRepaint(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap*) const
+{
+    LayoutRect box = enclosingLayoutRect(repaintRectInLocalCoordinates());
+    adjustRectForOutlineAndShadow(box);
+
+    FloatQuad containerRelativeQuad = localToContainerQuad(FloatRect(box), repaintContainer);
+    return LayoutRect(snapRectToDevicePixels(LayoutRect(containerRelativeQuad.boundingBox()), document().deviceScaleFactor()));
+}
+
+void LegacyRenderSVGModelObject::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
+{
+    IntRect rect = enclosingIntRect(strokeBoundingBox());
+    rect.moveBy(roundedIntPoint(accumulatedOffset));
+    rects.append(rect);
+}
+
+void LegacyRenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
+{
+    quads.append(localToAbsoluteQuad(strokeBoundingBox(), UseTransforms, wasFixed));
+}
+
+void LegacyRenderSVGModelObject::willBeDestroyed()
+{
+    SVGResourcesCache::clientDestroyed(*this);
+    RenderElement::willBeDestroyed();
+}
+
+void LegacyRenderSVGModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+    if (diff == StyleDifference::Layout) {
+        setNeedsBoundariesUpdate();
+        if (style().hasTransform() || (oldStyle && oldStyle->hasTransform()))
+            setNeedsTransformUpdate();
+    }
+    RenderElement::styleDidChange(diff, oldStyle);
+    SVGResourcesCache::clientStyleChanged(*this, diff, style());
+}
+
+bool LegacyRenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction)
+{
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+    if (document().settings().layerBasedSVGEngineEnabled()) {
+        // FIXME: [LBSE] Upstream LegacyRenderSVGModelObject inheritance changes (should inherit from RenderLayerModelObject).
+        notImplemented();
+        return false;
+    }
+#endif
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+static void getElementCTM(SVGElement* element, AffineTransform& transform)
+{
+    ASSERT(element);
+
+    SVGElement* stopAtElement = SVGLocatable::nearestViewportElement(element);
+    ASSERT(stopAtElement);
+
+    AffineTransform localTransform;
+    Node* current = element;
+
+    while (current && current->isSVGElement()) {
+        SVGElement& currentElement = downcast<SVGElement>(*current);
+        localTransform = currentElement.renderer()->localToParentTransform();
+        transform = localTransform.multiply(transform);
+        // For getCTM() computation, stop at the nearest viewport element
+        if (&currentElement == stopAtElement)
+            break;
+
+        current = current->parentOrShadowHostNode();
+    }
+}
+
+// FloatRect::intersects does not consider horizontal or vertical lines (because of isEmpty()).
+// So special-case handling of such lines.
+static bool intersectsAllowingEmpty(const FloatRect& r, const FloatRect& other)
+{
+    if (r.isEmpty() && other.isEmpty())
+        return false;
+    if (r.isEmpty() && !other.isEmpty())
+        return (other.contains(r.x(), r.y()) && !other.contains(r.maxX(), r.maxY())) || (!other.contains(r.x(), r.y()) && other.contains(r.maxX(), r.maxY()));
+    if (other.isEmpty() && !r.isEmpty())
+        return intersectsAllowingEmpty(other, r);
+    return r.intersects(other);
+}
+
+// One of the element types that can cause graphics to be drawn onto the target canvas. Specifically: circle, ellipse,
+// image, line, path, polygon, polyline, rect, text and use.
+static bool isGraphicsElement(const RenderElement& renderer)
+{
+    return renderer.isSVGShape() || renderer.isSVGText() || renderer.isSVGImage() || renderer.element()->hasTagName(SVGNames::useTag);
+}
+
+// The SVG addFocusRingRects() method adds rects in local coordinates so the default absoluteFocusRingQuads
+// returns incorrect values for SVG objects. Overriding this method provides access to the absolute bounds.
+void LegacyRenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
+{
+    quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates())));
+}
+    
+bool LegacyRenderSVGModelObject::checkIntersection(RenderElement* renderer, const FloatRect& rect)
+{
+    if (!renderer || renderer->style().pointerEvents() == PointerEvents::None)
+        return false;
+    if (!isGraphicsElement(*renderer))
+        return false;
+    AffineTransform ctm;
+    SVGElement* svgElement = downcast<SVGElement>(renderer->element());
+    getElementCTM(svgElement, ctm);
+    ASSERT(svgElement->renderer());
+    return intersectsAllowingEmpty(rect, ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
+}
+
+bool LegacyRenderSVGModelObject::checkEnclosure(RenderElement* renderer, const FloatRect& rect)
+{
+    if (!renderer || renderer->style().pointerEvents() == PointerEvents::None)
+        return false;
+    if (!isGraphicsElement(*renderer))
+        return false;
+    AffineTransform ctm;
+    SVGElement* svgElement = downcast<SVGElement>(renderer->element());
+    getElementCTM(svgElement, ctm);
+    ASSERT(svgElement->renderer());
+    return rect.contains(ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
+}
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/rendering/svg/LegacyRenderSVGModelObject.h (from rev 286961, trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h) (0 => 286962)


--- trunk/Source/WebCore/rendering/svg/LegacyRenderSVGModelObject.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/svg/LegacyRenderSVGModelObject.h	2021-12-13 19:55:06 UTC (rev 286962)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2009, Google 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:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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 "RenderElement.h"
+#include "SVGElement.h"
+#include "SVGRenderSupport.h"
+
+namespace WebCore {
+
+// Most renderers in the SVG rendering tree will inherit from this class
+// but not all. (e.g. RenderSVGForeignObject, RenderSVGBlock) thus methods
+// required by SVG renders need to be declared on RenderObject, but shared
+// logic can go in this class or in SVGRenderSupport.
+
+class SVGElement;
+
+class LegacyRenderSVGModelObject : public RenderElement {
+    WTF_MAKE_ISO_ALLOCATED(LegacyRenderSVGModelObject);
+public:
+    LayoutRect clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const override;
+    std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final;
+    LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap*) const final;
+
+    void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const final;
+    void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
+
+    void mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState&, OptionSet<MapCoordinatesMode>, bool* wasFixed) const final;
+    const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const final;
+    void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
+
+    static bool checkIntersection(RenderElement*, const FloatRect&);
+    static bool checkEnclosure(RenderElement*, const FloatRect&);
+
+    SVGElement& element() const { return downcast<SVGElement>(nodeForNonAnonymous()); }
+
+    // FIXME: [LBSE] Upstream SVGBoundingBoxComputation
+    // LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); }
+    LayoutRect visualOverflowRectEquivalent() const { return LayoutRect(); }
+
+protected:
+    LegacyRenderSVGModelObject(SVGElement&, RenderStyle&&);
+
+    void willBeDestroyed() override;
+
+private:
+    bool isLegacyRenderSVGModelObject() const final { return true; }
+
+    // This method should never be called, SVG uses a different nodeAtPoint method
+    bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
+    void absoluteFocusRingQuads(Vector<FloatQuad>&) final;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(LegacyRenderSVGModelObject, isLegacyRenderSVGModelObject())

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -43,7 +43,7 @@
 WTF_MAKE_ISO_ALLOCATED_IMPL(RenderSVGContainer);
 
 RenderSVGContainer::RenderSVGContainer(SVGElement& element, RenderStyle&& style)
-    : RenderSVGModelObject(element, WTFMove(style))
+    : LegacyRenderSVGModelObject(element, WTFMove(style))
 {
 }
 
@@ -81,7 +81,7 @@
         m_needsBoundariesUpdate = false;
     
         // If our bounds changed, notify the parents.
-        RenderSVGModelObject::setNeedsBoundariesUpdate();
+        LegacyRenderSVGModelObject::setNeedsBoundariesUpdate();
     }
 
     repainter.repaintAfterLayout();

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h	2021-12-13 19:55:06 UTC (rev 286962)
@@ -22,13 +22,13 @@
 
 #pragma once
 
-#include "RenderSVGModelObject.h"
+#include "LegacyRenderSVGModelObject.h"
 
 namespace WebCore {
 
 class SVGElement;
 
-class RenderSVGContainer : public RenderSVGModelObject {
+class RenderSVGContainer : public LegacyRenderSVGModelObject {
     WTF_MAKE_ISO_ALLOCATED(RenderSVGContainer);
 public:
     virtual ~RenderSVGContainer();

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -48,7 +48,7 @@
 WTF_MAKE_ISO_ALLOCATED_IMPL(RenderSVGImage);
 
 RenderSVGImage::RenderSVGImage(SVGImageElement& element, RenderStyle&& style)
-    : RenderSVGModelObject(element, WTFMove(style))
+    : LegacyRenderSVGModelObject(element, WTFMove(style))
     , m_needsBoundariesUpdate(true)
     , m_needsTransformUpdate(true)
     , m_imageResource(makeUnique<RenderImageResource>())
@@ -61,12 +61,12 @@
 void RenderSVGImage::willBeDestroyed()
 {
     imageResource().shutdown();
-    RenderSVGModelObject::willBeDestroyed();
+    LegacyRenderSVGModelObject::willBeDestroyed();
 }
 
 SVGImageElement& RenderSVGImage::imageElement() const
 {
-    return downcast<SVGImageElement>(RenderSVGModelObject::element());
+    return downcast<SVGImageElement>(LegacyRenderSVGModelObject::element());
 }
 
 FloatRect RenderSVGImage::calculateObjectBoundingBox() const
@@ -156,7 +156,7 @@
 
     // If our bounds changed, notify the parents.
     if (transformOrBoundariesUpdate)
-        RenderSVGModelObject::setNeedsBoundariesUpdate();
+        LegacyRenderSVGModelObject::setNeedsBoundariesUpdate();
 
     repainter.repaintAfterLayout();
     clearNeedsLayout();

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.h (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.h	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.h	2021-12-13 19:55:06 UTC (rev 286962)
@@ -25,7 +25,7 @@
 
 #include "AffineTransform.h"
 #include "FloatRect.h"
-#include "RenderSVGModelObject.h"
+#include "LegacyRenderSVGModelObject.h"
 
 namespace WebCore {
 
@@ -32,7 +32,7 @@
 class RenderImageResource;
 class SVGImageElement;
 
-class RenderSVGImage final : public RenderSVGModelObject {
+class RenderSVGImage final : public LegacyRenderSVGModelObject {
     WTF_MAKE_ISO_ALLOCATED(RenderSVGImage);
 public:
     RenderSVGImage(SVGImageElement&, RenderStyle&&);

Deleted: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2009, Google 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:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "RenderSVGModelObject.h"
-
-#include "NotImplemented.h"
-#include "RenderLayer.h"
-#include "RenderLayerModelObject.h"
-#include "RenderSVGResource.h"
-#include "RenderView.h"
-#include "SVGElementInlines.h"
-#include "SVGNames.h"
-#include "SVGResourcesCache.h"
-#include "ShadowRoot.h"
-#include <wtf/IsoMallocInlines.h>
-
-namespace WebCore {
-
-WTF_MAKE_ISO_ALLOCATED_IMPL(RenderSVGModelObject);
-
-RenderSVGModelObject::RenderSVGModelObject(SVGElement& element, RenderStyle&& style)
-    : RenderElement(element, WTFMove(style), 0)
-{
-}
-
-LayoutRect RenderSVGModelObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
-{
-#if ENABLE(LAYER_BASED_SVG_ENGINE)
-    if (document().settings().layerBasedSVGEngineEnabled()) {
-        if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
-            return LayoutRect();
-
-        ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled());
-        return computeRect(visualOverflowRectEquivalent(), repaintContainer, context);
-    }
-#else
-    UNUSED_PARAM(context);
-#endif
-
-    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
-}
-
-std::optional<FloatRect> RenderSVGModelObject::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
-{
-    return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context);
-}
-
-void RenderSVGModelObject::mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState& transformState, OptionSet<MapCoordinatesMode>, bool* wasFixed) const
-{
-    SVGRenderSupport::mapLocalToContainer(*this, ancestorContainer, transformState, wasFixed);
-}
-
-const RenderObject* RenderSVGModelObject::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
-{
-    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
-}
-
-// Copied from RenderBox, this method likely requires further refactoring to work easily for both SVG and CSS Box Model content.
-// FIXME: This may also need to move into SVGRenderSupport as the RenderBox version depends
-// on borderBoundingBox() which SVG RenderBox subclases (like SVGRenderBlock) do not implement.
-LayoutRect RenderSVGModelObject::outlineBoundsForRepaint(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap*) const
-{
-    LayoutRect box = enclosingLayoutRect(repaintRectInLocalCoordinates());
-    adjustRectForOutlineAndShadow(box);
-
-    FloatQuad containerRelativeQuad = localToContainerQuad(FloatRect(box), repaintContainer);
-    return LayoutRect(snapRectToDevicePixels(LayoutRect(containerRelativeQuad.boundingBox()), document().deviceScaleFactor()));
-}
-
-void RenderSVGModelObject::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
-{
-    IntRect rect = enclosingIntRect(strokeBoundingBox());
-    rect.moveBy(roundedIntPoint(accumulatedOffset));
-    rects.append(rect);
-}
-
-void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
-{
-    quads.append(localToAbsoluteQuad(strokeBoundingBox(), UseTransforms, wasFixed));
-}
-
-void RenderSVGModelObject::willBeDestroyed()
-{
-    SVGResourcesCache::clientDestroyed(*this);
-    RenderElement::willBeDestroyed();
-}
-
-void RenderSVGModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
-{
-    if (diff == StyleDifference::Layout) {
-        setNeedsBoundariesUpdate();
-        if (style().hasTransform() || (oldStyle && oldStyle->hasTransform()))
-            setNeedsTransformUpdate();
-    }
-    RenderElement::styleDidChange(diff, oldStyle);
-    SVGResourcesCache::clientStyleChanged(*this, diff, style());
-}
-
-bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction)
-{
-#if ENABLE(LAYER_BASED_SVG_ENGINE)
-    if (document().settings().layerBasedSVGEngineEnabled()) {
-        // FIXME: [LBSE] Upstream RenderSVGModelObject inheritance changes (should inherit from RenderLayerModelObject).
-        notImplemented();
-        return false;
-    }
-#endif
-
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-static void getElementCTM(SVGElement* element, AffineTransform& transform)
-{
-    ASSERT(element);
-
-    SVGElement* stopAtElement = SVGLocatable::nearestViewportElement(element);
-    ASSERT(stopAtElement);
-
-    AffineTransform localTransform;
-    Node* current = element;
-
-    while (current && current->isSVGElement()) {
-        SVGElement& currentElement = downcast<SVGElement>(*current);
-        localTransform = currentElement.renderer()->localToParentTransform();
-        transform = localTransform.multiply(transform);
-        // For getCTM() computation, stop at the nearest viewport element
-        if (&currentElement == stopAtElement)
-            break;
-
-        current = current->parentOrShadowHostNode();
-    }
-}
-
-// FloatRect::intersects does not consider horizontal or vertical lines (because of isEmpty()).
-// So special-case handling of such lines.
-static bool intersectsAllowingEmpty(const FloatRect& r, const FloatRect& other)
-{
-    if (r.isEmpty() && other.isEmpty())
-        return false;
-    if (r.isEmpty() && !other.isEmpty()) {
-        return (other.contains(r.x(), r.y()) && !other.contains(r.maxX(), r.maxY()))
-               || (!other.contains(r.x(), r.y()) && other.contains(r.maxX(), r.maxY()));
-    }
-    if (other.isEmpty() && !r.isEmpty())
-        return intersectsAllowingEmpty(other, r);
-    return r.intersects(other);
-}
-
-// One of the element types that can cause graphics to be drawn onto the target canvas. Specifically: circle, ellipse,
-// image, line, path, polygon, polyline, rect, text and use.
-static bool isGraphicsElement(const RenderElement& renderer)
-{
-    return renderer.isSVGShape() || renderer.isSVGText() || renderer.isSVGImage() || renderer.element()->hasTagName(SVGNames::useTag);
-}
-
-// The SVG addFocusRingRects() method adds rects in local coordinates so the default absoluteFocusRingQuads
-// returns incorrect values for SVG objects. Overriding this method provides access to the absolute bounds.
-void RenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
-{
-    quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates())));
-}
-    
-bool RenderSVGModelObject::checkIntersection(RenderElement* renderer, const FloatRect& rect)
-{
-    if (!renderer || renderer->style().pointerEvents() == PointerEvents::None)
-        return false;
-    if (!isGraphicsElement(*renderer))
-        return false;
-    AffineTransform ctm;
-    SVGElement* svgElement = downcast<SVGElement>(renderer->element());
-    getElementCTM(svgElement, ctm);
-    ASSERT(svgElement->renderer());
-    return intersectsAllowingEmpty(rect, ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
-}
-
-bool RenderSVGModelObject::checkEnclosure(RenderElement* renderer, const FloatRect& rect)
-{
-    if (!renderer || renderer->style().pointerEvents() == PointerEvents::None)
-        return false;
-    if (!isGraphicsElement(*renderer))
-        return false;
-    AffineTransform ctm;
-    SVGElement* svgElement = downcast<SVGElement>(renderer->element());
-    getElementCTM(svgElement, ctm);
-    ASSERT(svgElement->renderer());
-    return rect.contains(ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h	2021-12-13 19:55:06 UTC (rev 286962)
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2009, Google 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:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER 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 "RenderElement.h"
-#include "SVGElement.h"
-#include "SVGRenderSupport.h"
-
-namespace WebCore {
-
-// Most renderers in the SVG rendering tree will inherit from this class
-// but not all. (e.g. RenderSVGForeignObject, RenderSVGBlock) thus methods
-// required by SVG renders need to be declared on RenderObject, but shared
-// logic can go in this class or in SVGRenderSupport.
-
-class SVGElement;
-
-class RenderSVGModelObject : public RenderElement {
-    WTF_MAKE_ISO_ALLOCATED(RenderSVGModelObject);
-public:
-    LayoutRect clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const override;
-    std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final;
-    LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap*) const final;
-
-    void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const final;
-    void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
-
-    void mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState&, OptionSet<MapCoordinatesMode>, bool* wasFixed) const final;
-    const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const final;
-    void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
-
-    static bool checkIntersection(RenderElement*, const FloatRect&);
-    static bool checkEnclosure(RenderElement*, const FloatRect&);
-
-    SVGElement& element() const { return downcast<SVGElement>(nodeForNonAnonymous()); }
-
-    // FIXME: [LBSE] Upstream SVGBoundingBoxComputation
-    // LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); }
-    LayoutRect visualOverflowRectEquivalent() const { return LayoutRect(); }
-
-protected:
-    RenderSVGModelObject(SVGElement&, RenderStyle&&);
-
-    void willBeDestroyed() override;
-
-private:
-    bool isRenderSVGModelObject() const final { return true; }
-
-    // This method should never be called, SVG uses a different nodeAtPoint method
-    bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
-    void absoluteFocusRingQuads(Vector<FloatQuad>&) final;
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGModelObject, isRenderSVGModelObject())

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -52,7 +52,7 @@
 WTF_MAKE_ISO_ALLOCATED_IMPL(RenderSVGShape);
 
 RenderSVGShape::RenderSVGShape(SVGGraphicsElement& element, RenderStyle&& style)
-    : RenderSVGModelObject(element, WTFMove(style))
+    : LegacyRenderSVGModelObject(element, WTFMove(style))
     , m_needsBoundariesUpdate(false) // Default is false, the cached rects are empty from the beginning.
     , m_needsShapeUpdate(true) // Default is true, so we grab a Path object once from SVGGraphicsElement.
     , m_needsTransformUpdate(true) // Default is true, so we grab a AffineTransform object once from SVGGraphicsElement.
@@ -168,7 +168,7 @@
 
     // If our bounds changed, notify the parents.
     if (updateCachedBoundariesInParents)
-        RenderSVGModelObject::setNeedsBoundariesUpdate();
+        LegacyRenderSVGModelObject::setNeedsBoundariesUpdate();
 
     repainter.repaintAfterLayout();
     clearNeedsLayout();

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.h (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.h	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.h	2021-12-13 19:55:06 UTC (rev 286962)
@@ -27,7 +27,7 @@
 
 #include "AffineTransform.h"
 #include "FloatRect.h"
-#include "RenderSVGModelObject.h"
+#include "LegacyRenderSVGModelObject.h"
 #include "SVGMarkerData.h"
 #include <memory>
 #include <wtf/Vector.h>
@@ -41,7 +41,7 @@
 class RenderSVGResource;
 class SVGGraphicsElement;
 
-class RenderSVGShape : public RenderSVGModelObject {
+class RenderSVGShape : public LegacyRenderSVGModelObject {
     WTF_MAKE_ISO_ALLOCATED(RenderSVGShape);
 public:
     enum PointCoordinateSpace {

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShapeInlines.h (286961 => 286962)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShapeInlines.h	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShapeInlines.h	2021-12-13 19:55:06 UTC (rev 286962)
@@ -32,7 +32,7 @@
 
 inline SVGGraphicsElement& RenderSVGShape::graphicsElement() const
 {
-    return downcast<SVGGraphicsElement>(RenderSVGModelObject::element());
+    return downcast<SVGGraphicsElement>(LegacyRenderSVGModelObject::element());
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (286961 => 286962)


--- trunk/Source/WebCore/svg/SVGSVGElement.cpp	2021-12-13 19:52:03 UTC (rev 286961)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp	2021-12-13 19:55:06 UTC (rev 286962)
@@ -245,12 +245,12 @@
 
 static bool checkIntersectionWithoutUpdatingLayout(SVGElement& element, SVGRect& rect)
 {
-    return RenderSVGModelObject::checkIntersection(element.renderer(), rect.value());
+    return LegacyRenderSVGModelObject::checkIntersection(element.renderer(), rect.value());
 }
     
 static bool checkEnclosureWithoutUpdatingLayout(SVGElement& element, SVGRect& rect)
 {
-    return RenderSVGModelObject::checkEnclosure(element.renderer(), rect.value());
+    return LegacyRenderSVGModelObject::checkEnclosure(element.renderer(), rect.value());
 }
 
 Ref<NodeList> SVGSVGElement::getIntersectionList(SVGRect& rect, SVGElement* referenceElement)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to