Title: [284154] trunk/Source/WebCore
Revision
284154
Author
[email protected]
Date
2021-10-14 05:37:26 -0700 (Thu, 14 Oct 2021)

Log Message

Refactor RenderSVGBlock
https://bugs.webkit.org/show_bug.cgi?id=231477

Patch by Rob Buis <[email protected]> on 2021-10-14
Reviewed by Manuel Rego Casasnovas.

Refactor common code from RenderSVGBlock subclasses into RenderSVGBlock.

* rendering/svg/RenderSVGBlock.cpp:
(WebCore::RenderSVGBlock::clippedOverflowRect const):
(WebCore::RenderSVGBlock::computeVisibleRectInContainer const):
(WebCore::RenderSVGBlock::computeFloatVisibleRectInContainer const):
(WebCore::RenderSVGBlock::mapLocalToContainer const):
(WebCore::RenderSVGBlock::pushMappingToContainer const):
(WebCore::RenderSVGBlock::nodeAtPoint):
* rendering/svg/RenderSVGBlock.h:
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::clippedOverflowRect const): Deleted.
(WebCore::RenderSVGForeignObject::computeFloatVisibleRectInContainer const): Deleted.
(WebCore::RenderSVGForeignObject::computeVisibleRectInContainer const): Deleted.
(WebCore::RenderSVGForeignObject::nodeAtPoint): Deleted.
(WebCore::RenderSVGForeignObject::mapLocalToContainer const): Deleted.
(WebCore::RenderSVGForeignObject::pushMappingToContainer const): Deleted.
* rendering/svg/RenderSVGForeignObject.h:
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::clippedOverflowRect const): Deleted.
(WebCore::RenderSVGText::computeVisibleRectInContainer const): Deleted.
(WebCore::RenderSVGText::computeFloatVisibleRectInContainer const): Deleted.
(WebCore::RenderSVGText::mapLocalToContainer const): Deleted.
(WebCore::RenderSVGText::pushMappingToContainer const): Deleted.
(WebCore::RenderSVGText::nodeAtPoint): Deleted.
* rendering/svg/RenderSVGText.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (284153 => 284154)


--- trunk/Source/WebCore/ChangeLog	2021-10-14 12:32:09 UTC (rev 284153)
+++ trunk/Source/WebCore/ChangeLog	2021-10-14 12:37:26 UTC (rev 284154)
@@ -1,3 +1,37 @@
+2021-10-14  Rob Buis  <[email protected]>
+
+        Refactor RenderSVGBlock
+        https://bugs.webkit.org/show_bug.cgi?id=231477
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Refactor common code from RenderSVGBlock subclasses into RenderSVGBlock.
+
+        * rendering/svg/RenderSVGBlock.cpp:
+        (WebCore::RenderSVGBlock::clippedOverflowRect const):
+        (WebCore::RenderSVGBlock::computeVisibleRectInContainer const):
+        (WebCore::RenderSVGBlock::computeFloatVisibleRectInContainer const):
+        (WebCore::RenderSVGBlock::mapLocalToContainer const):
+        (WebCore::RenderSVGBlock::pushMappingToContainer const):
+        (WebCore::RenderSVGBlock::nodeAtPoint):
+        * rendering/svg/RenderSVGBlock.h:
+        * rendering/svg/RenderSVGForeignObject.cpp:
+        (WebCore::RenderSVGForeignObject::clippedOverflowRect const): Deleted.
+        (WebCore::RenderSVGForeignObject::computeFloatVisibleRectInContainer const): Deleted.
+        (WebCore::RenderSVGForeignObject::computeVisibleRectInContainer const): Deleted.
+        (WebCore::RenderSVGForeignObject::nodeAtPoint): Deleted.
+        (WebCore::RenderSVGForeignObject::mapLocalToContainer const): Deleted.
+        (WebCore::RenderSVGForeignObject::pushMappingToContainer const): Deleted.
+        * rendering/svg/RenderSVGForeignObject.h:
+        * rendering/svg/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::clippedOverflowRect const): Deleted.
+        (WebCore::RenderSVGText::computeVisibleRectInContainer const): Deleted.
+        (WebCore::RenderSVGText::computeFloatVisibleRectInContainer const): Deleted.
+        (WebCore::RenderSVGText::mapLocalToContainer const): Deleted.
+        (WebCore::RenderSVGText::pushMappingToContainer const): Deleted.
+        (WebCore::RenderSVGText::nodeAtPoint): Deleted.
+        * rendering/svg/RenderSVGText.h:
+
 2021-10-14  Carlos Garcia Campos  <[email protected]>
 
         [GTK][WPE] Bump GLib version to 2.58.3

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGBlock.cpp (284153 => 284154)


--- trunk/Source/WebCore/rendering/svg/RenderSVGBlock.cpp	2021-10-14 12:32:09 UTC (rev 284153)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGBlock.cpp	2021-10-14 12:37:26 UTC (rev 284154)
@@ -89,4 +89,38 @@
     addVisualOverflow(snappedIntRect(borderRect));
 }
 
+LayoutRect RenderSVGBlock::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const
+{
+    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
 }
+
+std::optional<LayoutRect> RenderSVGBlock::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
+{
+    std::optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context);
+    if (adjustedRect)
+        return enclosingLayoutRect(*adjustedRect);
+    return std::nullopt;
+}
+
+std::optional<FloatRect> RenderSVGBlock::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
+{
+    return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context);
+}
+
+void RenderSVGBlock::mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState& transformState, OptionSet<MapCoordinatesMode>, bool* wasFixed) const
+{
+    SVGRenderSupport::mapLocalToContainer(*this, ancestorContainer, transformState, wasFixed);
+}
+
+const RenderObject* RenderSVGBlock::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
+{
+    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
+}
+
+bool RenderSVGBlock::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction)
+{
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+}

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h (284153 => 284154)


--- trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h	2021-10-14 12:32:09 UTC (rev 284153)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h	2021-10-14 12:37:26 UTC (rev 284154)
@@ -47,6 +47,15 @@
     void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override;
 
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
+
+    LayoutRect clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const final;
+    std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final;
+    std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const final;
+
+    void mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState&, OptionSet<MapCoordinatesMode>, bool* wasFixed) const final;
+    const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const final;
+
+    bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (284153 => 284154)


--- trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp	2021-10-14 12:32:09 UTC (rev 284153)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp	2021-10-14 12:37:26 UTC (rev 284154)
@@ -95,24 +95,6 @@
     RenderBlock::paint(childPaintInfo, childPoint);
 }
 
-LayoutRect RenderSVGForeignObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const
-{
-    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
-}
-
-std::optional<FloatRect> RenderSVGForeignObject::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
-{
-    return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context);
-}
-
-std::optional<LayoutRect> RenderSVGForeignObject::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
-{
-    std::optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context);
-    if (adjustedRect)
-        return enclosingLayoutRect(*adjustedRect);
-    return std::nullopt;
-}
-
 const AffineTransform& RenderSVGForeignObject::localToParentTransform() const
 {
     m_localToParentTransform = localTransform();
@@ -200,20 +182,4 @@
         || RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), HitTestChildBlockBackgrounds);
 }
 
-bool RenderSVGForeignObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction)
-{
-    ASSERT_NOT_REACHED();
-    return false;
 }
-
-void RenderSVGForeignObject::mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState& transformState, OptionSet<MapCoordinatesMode>, bool* wasFixed) const
-{
-    SVGRenderSupport::mapLocalToContainer(*this, ancestorContainer, transformState, wasFixed);
-}
-
-const RenderObject* RenderSVGForeignObject::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
-{
-    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
-}
-
-}

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.h (284153 => 284154)


--- trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.h	2021-10-14 12:32:09 UTC (rev 284153)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.h	2021-10-14 12:37:26 UTC (rev 284154)
@@ -39,10 +39,6 @@
 
     void paint(PaintInfo&, const LayoutPoint&) override;
 
-    LayoutRect clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const override;
-    std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override;
-    std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override;
-
     bool requiresLayer() const override { return false; }
     void layout() override;
 
@@ -51,10 +47,7 @@
     FloatRect repaintRectInLocalCoordinates() const override { return FloatRect(FloatPoint(), m_viewport.size()); }
 
     bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override;
-    bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
 
-    void mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState&, OptionSet<MapCoordinatesMode>, bool* wasFixed) const override;
-    const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override;
     void setNeedsTransformUpdate() override { m_needsTransformUpdate = true; }
 
 private:

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (284153 => 284154)


--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp	2021-10-14 12:32:09 UTC (rev 284153)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp	2021-10-14 12:37:26 UTC (rev 284154)
@@ -89,34 +89,6 @@
     return lineageOfType<RenderSVGText>(start).first();
 }
 
-LayoutRect RenderSVGText::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const
-{
-    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
-}
-
-std::optional<LayoutRect> RenderSVGText::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
-{
-    std::optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context);
-    if (adjustedRect)
-        return enclosingLayoutRect(*adjustedRect);
-    return std::nullopt;
-}
-
-std::optional<FloatRect> RenderSVGText::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const
-{
-    return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context);
-}
-
-void RenderSVGText::mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState& transformState, OptionSet<MapCoordinatesMode>, bool* wasFixed) const
-{
-    SVGRenderSupport::mapLocalToContainer(*this, ancestorContainer, transformState, wasFixed);
-}
-
-const RenderObject* RenderSVGText::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
-{
-    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
-}
-
 static inline void collectLayoutAttributes(RenderObject* text, Vector<SVGTextLayoutAttributes*>& attributes)
 {
     for (RenderObject* descendant = text; descendant; descendant = descendant->nextInPreOrder(text)) {
@@ -452,12 +424,6 @@
     return false;
 }
 
-bool RenderSVGText::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction)
-{
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
 VisiblePosition RenderSVGText::positionForPoint(const LayoutPoint& pointInContents, const RenderFragmentContainer* fragment)
 {
     LegacyRootInlineBox* rootBox = firstRootBox();

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.h (284153 => 284154)


--- trunk/Source/WebCore/rendering/svg/RenderSVGText.h	2021-10-14 12:32:09 UTC (rev 284153)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.h	2021-10-14 12:37:26 UTC (rev 284154)
@@ -68,7 +68,6 @@
     bool isSVGText() const override { return true; }
 
     void paint(PaintInfo&, const LayoutPoint&) override;
-    bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
     bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override;
     VisiblePosition positionForPoint(const LayoutPoint&, const RenderFragmentContainer*) override;
 
@@ -77,12 +76,6 @@
 
     void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
 
-    LayoutRect clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const override;
-    std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override;
-    std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override;
-
-    void mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState&, OptionSet<MapCoordinatesMode>, bool* wasFixed) const override;
-    const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override;
     void willBeDestroyed() override;
 
     const AffineTransform& localToParentTransform() const override { return m_localTransform; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to