Title: [291788] trunk/Source/WebCore
Revision
291788
Author
[email protected]
Date
2022-03-23 23:32:33 -0700 (Wed, 23 Mar 2022)

Log Message

setNeedsLayout() should not be called when changing the SVG properties
https://bugs.webkit.org/show_bug.cgi?id=230296

Patch by Rob Buis <[email protected]> on 2022-03-23
Reviewed by Said Abou-Hallawa.

Make SVG not call setNeedsLayout() from outside RenderTreeUpdater::updateRenderTree() when an attribute changes.
This ensures there will not be a dirty rendering tree immediately after updating it.

The patch also tries to avoid invalidate wording since this is quite generic.

Based on the initial patch by Said Abou-Hallawa.

* dom/ElementData.h:
(WebCore::ElementData::svgResourcesInAncestorChainAreDirty const):
(WebCore::ElementData::setSVGResourcesInAncestorChainAreDirty const):
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateRenderTree):
* svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::applyResultsToTarget):
* svg/SVGClipPathElement.cpp:
(WebCore::SVGClipPathElement::svgAttributeChanged):
(WebCore::SVGClipPathElement::childrenChanged):
* svg/SVGComponentTransferFunctionElement.cpp:
(WebCore::SVGComponentTransferFunctionElement::svgAttributeChanged):
* svg/SVGElement.cpp:
(WebCore::SVGElement::setSVGResourcesInAncestorChainAreDirty):
(WebCore::SVGElement::invalidateSVGResourcesInAncestorChainIfNeeded):
* svg/SVGElement.h:
* svg/SVGElementInlines.h:
(WebCore::SVGElement::setPresentationalHintStyleIsDirty):
* svg/SVGFEBlendElement.cpp:
(WebCore::SVGFEBlendElement::svgAttributeChanged):
* svg/SVGFEColorMatrixElement.cpp:
(WebCore::SVGFEColorMatrixElement::svgAttributeChanged):
* svg/SVGFECompositeElement.cpp:
(WebCore::SVGFECompositeElement::svgAttributeChanged):
* svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::setOrder):
(WebCore::SVGFEConvolveMatrixElement::setKernelUnitLength):
(WebCore::SVGFEConvolveMatrixElement::svgAttributeChanged):
* svg/SVGFEDiffuseLightingElement.cpp:
(WebCore::SVGFEDiffuseLightingElement::svgAttributeChanged):
* svg/SVGFEDisplacementMapElement.cpp:
(WebCore::SVGFEDisplacementMapElement::svgAttributeChanged):
* svg/SVGFEDropShadowElement.cpp:
(WebCore::SVGFEDropShadowElement::setStdDeviation):
(WebCore::SVGFEDropShadowElement::svgAttributeChanged):
* svg/SVGFEGaussianBlurElement.cpp:
(WebCore::SVGFEGaussianBlurElement::setStdDeviation):
(WebCore::SVGFEGaussianBlurElement::svgAttributeChanged):
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::buildPendingResource):
(WebCore::SVGFEImageElement::svgAttributeChanged):
* svg/SVGFELightElement.cpp:
(WebCore::SVGFELightElement::childrenChanged):
* svg/SVGFEMergeNodeElement.cpp:
(WebCore::SVGFEMergeNodeElement::svgAttributeChanged):
* svg/SVGFEMorphologyElement.cpp:
(WebCore::SVGFEMorphologyElement::setRadius):
(WebCore::SVGFEMorphologyElement::svgAttributeChanged):
* svg/SVGFEOffsetElement.cpp:
(WebCore::SVGFEOffsetElement::svgAttributeChanged):
* svg/SVGFESpecularLightingElement.cpp:
(WebCore::SVGFESpecularLightingElement::svgAttributeChanged):
* svg/SVGFETileElement.cpp:
(WebCore::SVGFETileElement::svgAttributeChanged):
* svg/SVGFilterElement.cpp:
(WebCore::SVGFilterElement::svgAttributeChanged):
(WebCore::SVGFilterElement::childrenChanged):
* svg/SVGFilterPrimitiveStandardAttributes.cpp:
(WebCore::SVGFilterPrimitiveStandardAttributes::svgAttributeChanged):
(WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):
(WebCore::SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent):
(WebCore::invalidateFilterPrimitiveParent): Deleted.
* svg/SVGFilterPrimitiveStandardAttributes.h:
(WebCore::SVGFilterPrimitiveStandardAttributes::invalidate): Deleted.
* svg/SVGForeignObjectElement.cpp:
(WebCore::SVGForeignObjectElement::svgAttributeChanged):
* svg/SVGGeometryElement.cpp:
(WebCore::SVGGeometryElement::svgAttributeChanged):
* svg/SVGGradientElement.cpp:
(WebCore::SVGGradientElement::svgAttributeChanged):
(WebCore::SVGGradientElement::childrenChanged):
* svg/SVGGraphicsElement.cpp:
(WebCore::SVGGraphicsElement::svgAttributeChanged):
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::svgAttributeChanged):
* svg/SVGLineElement.cpp:
(WebCore::SVGLineElement::svgAttributeChanged):
* svg/SVGLinearGradientElement.cpp:
(WebCore::SVGLinearGradientElement::svgAttributeChanged):
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::svgAttributeChanged):
(WebCore::SVGMarkerElement::childrenChanged):
* svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::svgAttributeChanged):
(WebCore::SVGMaskElement::childrenChanged):
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::svgAttributeChanged):
* svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::svgAttributeChanged):
(WebCore::SVGPatternElement::childrenChanged):
* svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::svgAttributeChanged):
* svg/SVGRadialGradientElement.cpp:
(WebCore::SVGRadialGradientElement::svgAttributeChanged):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::updateCurrentTranslate):
(WebCore::SVGSVGElement::svgAttributeChanged):
* svg/SVGStopElement.cpp:
(WebCore::SVGStopElement::svgAttributeChanged):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::svgAttributeChanged):
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::svgAttributeChanged):
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::svgAttributeChanged):
* svg/SVGTextPositioningElement.cpp:
(WebCore::SVGTextPositioningElement::svgAttributeChanged):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::svgAttributeChanged):
* svg/SVGViewElement.cpp:
(WebCore::SVGViewElement::svgAttributeChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291787 => 291788)


--- trunk/Source/WebCore/ChangeLog	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/ChangeLog	2022-03-24 06:32:33 UTC (rev 291788)
@@ -1,3 +1,129 @@
+2022-03-23  Rob Buis  <[email protected]>
+
+        setNeedsLayout() should not be called when changing the SVG properties
+        https://bugs.webkit.org/show_bug.cgi?id=230296
+
+        Reviewed by Said Abou-Hallawa.
+
+        Make SVG not call setNeedsLayout() from outside RenderTreeUpdater::updateRenderTree() when an attribute changes.
+        This ensures there will not be a dirty rendering tree immediately after updating it.
+
+        The patch also tries to avoid invalidate wording since this is quite generic.
+
+        Based on the initial patch by Said Abou-Hallawa.
+
+        * dom/ElementData.h:
+        (WebCore::ElementData::svgResourcesInAncestorChainAreDirty const):
+        (WebCore::ElementData::setSVGResourcesInAncestorChainAreDirty const):
+        * rendering/updating/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::updateRenderTree):
+        * svg/SVGAnimateMotionElement.cpp:
+        (WebCore::SVGAnimateMotionElement::applyResultsToTarget):
+        * svg/SVGClipPathElement.cpp:
+        (WebCore::SVGClipPathElement::svgAttributeChanged):
+        (WebCore::SVGClipPathElement::childrenChanged):
+        * svg/SVGComponentTransferFunctionElement.cpp:
+        (WebCore::SVGComponentTransferFunctionElement::svgAttributeChanged):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::setSVGResourcesInAncestorChainAreDirty):
+        (WebCore::SVGElement::invalidateSVGResourcesInAncestorChainIfNeeded):
+        * svg/SVGElement.h:
+        * svg/SVGElementInlines.h:
+        (WebCore::SVGElement::setPresentationalHintStyleIsDirty):
+        * svg/SVGFEBlendElement.cpp:
+        (WebCore::SVGFEBlendElement::svgAttributeChanged):
+        * svg/SVGFEColorMatrixElement.cpp:
+        (WebCore::SVGFEColorMatrixElement::svgAttributeChanged):
+        * svg/SVGFECompositeElement.cpp:
+        (WebCore::SVGFECompositeElement::svgAttributeChanged):
+        * svg/SVGFEConvolveMatrixElement.cpp:
+        (WebCore::SVGFEConvolveMatrixElement::setOrder):
+        (WebCore::SVGFEConvolveMatrixElement::setKernelUnitLength):
+        (WebCore::SVGFEConvolveMatrixElement::svgAttributeChanged):
+        * svg/SVGFEDiffuseLightingElement.cpp:
+        (WebCore::SVGFEDiffuseLightingElement::svgAttributeChanged):
+        * svg/SVGFEDisplacementMapElement.cpp:
+        (WebCore::SVGFEDisplacementMapElement::svgAttributeChanged):
+        * svg/SVGFEDropShadowElement.cpp:
+        (WebCore::SVGFEDropShadowElement::setStdDeviation):
+        (WebCore::SVGFEDropShadowElement::svgAttributeChanged):
+        * svg/SVGFEGaussianBlurElement.cpp:
+        (WebCore::SVGFEGaussianBlurElement::setStdDeviation):
+        (WebCore::SVGFEGaussianBlurElement::svgAttributeChanged):
+        * svg/SVGFEImageElement.cpp:
+        (WebCore::SVGFEImageElement::buildPendingResource):
+        (WebCore::SVGFEImageElement::svgAttributeChanged):
+        * svg/SVGFELightElement.cpp:
+        (WebCore::SVGFELightElement::childrenChanged):
+        * svg/SVGFEMergeNodeElement.cpp:
+        (WebCore::SVGFEMergeNodeElement::svgAttributeChanged):
+        * svg/SVGFEMorphologyElement.cpp:
+        (WebCore::SVGFEMorphologyElement::setRadius):
+        (WebCore::SVGFEMorphologyElement::svgAttributeChanged):
+        * svg/SVGFEOffsetElement.cpp:
+        (WebCore::SVGFEOffsetElement::svgAttributeChanged):
+        * svg/SVGFESpecularLightingElement.cpp:
+        (WebCore::SVGFESpecularLightingElement::svgAttributeChanged):
+        * svg/SVGFETileElement.cpp:
+        (WebCore::SVGFETileElement::svgAttributeChanged):
+        * svg/SVGFilterElement.cpp:
+        (WebCore::SVGFilterElement::svgAttributeChanged):
+        (WebCore::SVGFilterElement::childrenChanged):
+        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
+        (WebCore::SVGFilterPrimitiveStandardAttributes::svgAttributeChanged):
+        (WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):
+        (WebCore::SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent):
+        (WebCore::invalidateFilterPrimitiveParent): Deleted.
+        * svg/SVGFilterPrimitiveStandardAttributes.h:
+        (WebCore::SVGFilterPrimitiveStandardAttributes::invalidate): Deleted.
+        * svg/SVGForeignObjectElement.cpp:
+        (WebCore::SVGForeignObjectElement::svgAttributeChanged):
+        * svg/SVGGeometryElement.cpp:
+        (WebCore::SVGGeometryElement::svgAttributeChanged):
+        * svg/SVGGradientElement.cpp:
+        (WebCore::SVGGradientElement::svgAttributeChanged):
+        (WebCore::SVGGradientElement::childrenChanged):
+        * svg/SVGGraphicsElement.cpp:
+        (WebCore::SVGGraphicsElement::svgAttributeChanged):
+        * svg/SVGImageElement.cpp:
+        (WebCore::SVGImageElement::svgAttributeChanged):
+        * svg/SVGLineElement.cpp:
+        (WebCore::SVGLineElement::svgAttributeChanged):
+        * svg/SVGLinearGradientElement.cpp:
+        (WebCore::SVGLinearGradientElement::svgAttributeChanged):
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::svgAttributeChanged):
+        (WebCore::SVGMarkerElement::childrenChanged):
+        * svg/SVGMaskElement.cpp:
+        (WebCore::SVGMaskElement::svgAttributeChanged):
+        (WebCore::SVGMaskElement::childrenChanged):
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::svgAttributeChanged):
+        * svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::svgAttributeChanged):
+        (WebCore::SVGPatternElement::childrenChanged):
+        * svg/SVGPolyElement.cpp:
+        (WebCore::SVGPolyElement::svgAttributeChanged):
+        * svg/SVGRadialGradientElement.cpp:
+        (WebCore::SVGRadialGradientElement::svgAttributeChanged):
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::updateCurrentTranslate):
+        (WebCore::SVGSVGElement::svgAttributeChanged):
+        * svg/SVGStopElement.cpp:
+        (WebCore::SVGStopElement::svgAttributeChanged):
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::svgAttributeChanged):
+        * svg/SVGTextContentElement.cpp:
+        (WebCore::SVGTextContentElement::svgAttributeChanged):
+        * svg/SVGTextPathElement.cpp:
+        (WebCore::SVGTextPathElement::svgAttributeChanged):
+        * svg/SVGTextPositioningElement.cpp:
+        (WebCore::SVGTextPositioningElement::svgAttributeChanged):
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::svgAttributeChanged):
+        * svg/SVGViewElement.cpp:
+        (WebCore::SVGViewElement::svgAttributeChanged):
+
 2022-03-23  Sihui Liu  <[email protected]>
 
         Add logging for LocalStorage and IndexedDB data migration

Modified: trunk/Source/WebCore/dom/ElementData.h (291787 => 291788)


--- trunk/Source/WebCore/dom/ElementData.h	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/dom/ElementData.h	2022-03-24 06:32:33 UTC (rev 291788)
@@ -125,13 +125,15 @@
     mutable uint32_t m_arraySizeAndFlags;
 
     static const uint32_t s_arraySize = 27;
-    static const uint32_t s_flagCount = 5;
+    static const uint32_t s_flagCount = 6;
     static const uint32_t s_flagIsUnique = 1;
     static const uint32_t s_flagHasNameAttribute = 1 << 1;
     static const uint32_t s_flagPresentationalHintStyleIsDirty = 1 << 2;
     static const uint32_t s_flagStyleAttributeIsDirty = 1 << 3;
     static const uint32_t s_flagAnimatedSVGAttributesAreDirty = 1 << 4;
+    static const uint32_t s_flagSVGResourcesInAncestorChainAreDirty = 1 << 5;
     static const uint32_t s_flagsMask = (1 << s_flagCount) - 1;
+    // FIXME: could the SVG specific flags go to some SVG class?
 
     inline void updateFlag(uint32_t flag, bool set) const
     {
@@ -160,6 +162,9 @@
     bool animatedSVGAttributesAreDirty() const { return m_arraySizeAndFlags & s_flagAnimatedSVGAttributesAreDirty; }
     void setAnimatedSVGAttributesAreDirty(bool dirty) const { updateFlag(s_flagAnimatedSVGAttributesAreDirty, dirty); }
 
+    bool svgResourcesInAncestorChainAreDirty() const { return m_arraySizeAndFlags & s_flagSVGResourcesInAncestorChainAreDirty; }
+    void setSVGResourcesInAncestorChainAreDirty(bool dirty) const { updateFlag(s_flagSVGResourcesInAncestorChainAreDirty, dirty); }
+
     mutable RefPtr<StyleProperties> m_inlineStyle;
     mutable SpaceSplitString m_classNames;
     mutable AtomString m_idForStyleResolution;

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (291787 => 291788)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -45,6 +45,7 @@
 #include "RenderTreeUpdaterGeneratedContent.h"
 #include "RenderView.h"
 #include "RuntimeEnabledFeatures.h"
+#include "SVGElement.h"
 #include "StyleResolver.h"
 #include "StyleTreeResolver.h"
 #include "TextManipulationController.h"
@@ -192,6 +193,9 @@
         if (elementUpdate)
             updateElementRenderer(element, *elementUpdate);
 
+        if (is<SVGElement>(element))
+            downcast<SVGElement>(element).invalidateSVGResourcesInAncestorChainIfNeeded();
+
         storePreviousRenderer(element);
 
         bool mayHaveRenderedDescendants = element.renderer() || (element.hasDisplayContents() && shouldCreateRenderer(element, renderTreePosition().parent()));

Modified: trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -250,11 +250,14 @@
     if (!targetElement)
         return;
 
-    if (RenderElement* renderer = targetElement->renderer()) {
-        renderer->setNeedsTransformUpdate();
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-    }
+    auto updateTargetElement = [](SVGElement& element) {
+        if (auto renderer = element.renderer())
+            renderer->setNeedsTransformUpdate();
+        element.setSVGResourcesInAncestorChainAreDirty();
+    };
 
+    updateTargetElement(*targetElement);
+
     AffineTransform* targetSupplementalTransform = targetElement->supplementalTransform();
     if (!targetSupplementalTransform)
         return;
@@ -265,10 +268,7 @@
         if (!transform || *transform == *targetSupplementalTransform)
             continue;
         *transform = *targetSupplementalTransform;
-        if (RenderElement* renderer = instance->renderer()) {
-            renderer->setNeedsTransformUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        updateTargetElement(instance);
     }
 }
 

Modified: trunk/Source/WebCore/svg/SVGClipPathElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGClipPathElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGClipPathElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -67,8 +67,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
 
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -82,8 +81,7 @@
     if (change.source == ChildChange::Source::Parser)
         return;
 
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 RenderPtr<RenderElement> SVGClipPathElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

Modified: trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -92,7 +92,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidateFilterPrimitiveParent(this);
+        SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent(this);
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -883,6 +883,22 @@
         addPropertyToPresentationalHintStyle(style, propertyID, value);
 }
 
+void SVGElement::setSVGResourcesInAncestorChainAreDirty()
+{
+    ensureUniqueElementData().setSVGResourcesInAncestorChainAreDirty(true);
+    invalidateStyle();
+}
+
+void SVGElement::invalidateSVGResourcesInAncestorChainIfNeeded()
+{
+    if (!elementData() || !elementData()->svgResourcesInAncestorChainAreDirty())
+        return;
+
+    if (auto renderer = this->renderer())
+        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+    elementData()->setSVGResourcesInAncestorChainAreDirty(false);
+}
+
 void SVGElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     CSSPropertyID propId = cssPropertyIdForSVGAttributeName(attrName);

Modified: trunk/Source/WebCore/svg/SVGElement.h (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGElement.h	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGElement.h	2022-03-24 06:32:33 UTC (rev 291788)
@@ -84,6 +84,8 @@
 
     inline void setAnimatedSVGAttributesAreDirty();
     inline void setPresentationalHintStyleIsDirty();
+    void setSVGResourcesInAncestorChainAreDirty();
+    void invalidateSVGResourcesInAncestorChainIfNeeded();
 
     // The instances of an element are clones made in shadow trees to implement <use>.
     const WeakHashSet<SVGElement>& instances() const;

Modified: trunk/Source/WebCore/svg/SVGElementInlines.h (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGElementInlines.h	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGElementInlines.h	2022-03-24 06:32:33 UTC (rev 291788)
@@ -38,7 +38,6 @@
 inline void SVGElement::setPresentationalHintStyleIsDirty()
 {
     ensureUniqueElementData().setPresentationalHintStyleIsDirty(true);
-    // Trigger style recalculation for "elements as resource" (e.g. referenced by feImage).
     invalidateStyle();
 }
 

Modified: trunk/Source/WebCore/svg/SVGFEBlendElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEBlendElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEBlendElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -89,7 +89,7 @@
             primitiveAttributeChanged(attrName);
         else {
             ASSERT(attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr);
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         }
         return;
     }

Modified: trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -87,7 +87,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         if (attrName == SVGNames::inAttr)
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         else {
             ASSERT(attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr);
             primitiveAttributeChanged(attrName);

Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFECompositeElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -118,7 +118,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr)
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         else {
             ASSERT(attrName == SVGNames::k1Attr || attrName == SVGNames::k2Attr || attrName == SVGNames::k3Attr || attrName == SVGNames::k4Attr || attrName == SVGNames::operatorAttr);
             primitiveAttributeChanged(attrName);

Modified: trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -160,7 +160,7 @@
 {
     m_orderX->setBaseValInternal(x);
     m_orderY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEConvolveMatrixElement::setKernelUnitLength(float x, float y)
@@ -167,7 +167,7 @@
 {
     m_kernelUnitLengthX->setBaseValInternal(x);
     m_kernelUnitLengthY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEConvolveMatrixElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -175,7 +175,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         if (attrName == SVGNames::inAttr || attrName == SVGNames::orderAttr || attrName == SVGNames::kernelMatrixAttr)
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         else {
             ASSERT(attrName == SVGNames::edgeModeAttr || attrName == SVGNames::divisorAttr || attrName == SVGNames::biasAttr || attrName == SVGNames::targetXAttr
                 || attrName == SVGNames::targetYAttr || attrName == SVGNames::kernelUnitLengthAttr || attrName == SVGNames::preserveAlphaAttr);

Modified: trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -128,7 +128,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         if (attrName == SVGNames::inAttr)
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         else {
             ASSERT(attrName == SVGNames::diffuseConstantAttr || attrName == SVGNames::surfaceScaleAttr || attrName == SVGNames::kernelUnitLengthAttr);
             primitiveAttributeChanged(attrName);

Modified: trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -102,7 +102,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr)
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         else {
             ASSERT(attrName == SVGNames::xChannelSelectorAttr || attrName == SVGNames::yChannelSelectorAttr || attrName == SVGNames::scaleAttr);
             primitiveAttributeChanged(attrName);

Modified: trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -54,7 +54,7 @@
 {
     m_stdDeviationX->setBaseValInternal(x);
     m_stdDeviationY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEDropShadowElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -89,7 +89,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -53,7 +53,7 @@
 {
     m_stdDeviationX->setBaseValInternal(x);
     m_stdDeviationY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -87,7 +87,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGFEImageElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -111,7 +111,7 @@
     } else if (is<SVGElement>(*target.element))
         downcast<SVGElement>(*target.element).addReferencingElement(*this);
 
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -130,7 +130,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         ASSERT(attrName == SVGNames::preserveAspectRatioAttr);
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGFELightElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFELightElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFELightElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -157,12 +157,8 @@
 
     if (change.source == ChildChange::Source::Parser)
         return;
-    RefPtr parent = parentNode();
-    if (!parent)
-        return;
-    RenderElement* renderer = parent->renderer();
-    if (renderer && renderer->isSVGResourceFilterPrimitive())
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+
+    SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent(this);
 }
 
 }

Modified: trunk/Source/WebCore/svg/SVGFEMergeNodeElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEMergeNodeElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEMergeNodeElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -63,7 +63,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         ASSERT(attrName == SVGNames::inAttr);
         InstanceInvalidationGuard guard(*this);
-        invalidateFilterPrimitiveParent(this);
+        SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent(this);
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -52,7 +52,7 @@
 {
     m_radiusX->setBaseValInternal(x);
     m_radiusY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEMorphologyElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -101,7 +101,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         if (attrName == SVGNames::inAttr)
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         else {
             ASSERT(attrName == SVGNames::operatorAttr || attrName == SVGNames::radiusAttr);
             primitiveAttributeChanged(attrName);

Modified: trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -72,7 +72,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -138,7 +138,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         if (attrName == SVGNames::inAttr)
-            invalidate();
+            setSVGResourcesInAncestorChainAreDirty();
         else {
             ASSERT(attrName == SVGNames::specularConstantAttr || attrName == SVGNames::specularExponentAttr || attrName == SVGNames::surfaceScaleAttr || attrName == SVGNames::kernelUnitLengthAttr);
             primitiveAttributeChanged(attrName);

Modified: trunk/Source/WebCore/svg/SVGFETileElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFETileElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFETileElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -61,7 +61,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         ASSERT(attrName == SVGNames::inAttr);
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGFilterElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFilterElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFilterElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -99,8 +99,7 @@
     }
 
     if (PropertyRegistry::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
-        if (auto* renderer = this->renderer())
-            renderer->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -114,8 +113,7 @@
     if (change.source == ChildChange::Source::Parser)
         return;
 
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 RenderPtr<RenderElement> SVGFilterElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

Modified: trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -78,7 +78,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -91,7 +91,7 @@
 
     if (change.source == ChildChange::Source::Parser)
         return;
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 RenderPtr<RenderElement> SVGFilterPrimitiveStandardAttributes::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
@@ -107,7 +107,7 @@
     return false;
 }
 
-void invalidateFilterPrimitiveParent(SVGElement* element)
+void SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent(SVGElement* element)
 {
     if (!element)
         return;
@@ -120,7 +120,7 @@
     if (!renderer || !renderer->isSVGResourceFilterPrimitive())
         return;
 
-    RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer, false);
+    downcast<SVGElement>(*parent).setSVGResourcesInAncestorChainAreDirty();
 }
 
 }

Modified: trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h	2022-03-24 06:32:33 UTC (rev 291788)
@@ -55,6 +55,8 @@
     virtual Vector<AtomString> filterEffectInputsNames() const { return { }; }
     virtual RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const = 0;
 
+    static void invalidateFilterPrimitiveParent(SVGElement*);
+
 protected:
     SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&);
 
@@ -62,7 +64,6 @@
     void svgAttributeChanged(const QualifiedName&) override;
     void childrenChanged(const ChildChange&) override;
 
-    void invalidate();
     void primitiveAttributeChanged(const QualifiedName& attributeName);
 
 private:
@@ -81,14 +82,6 @@
     Ref<SVGAnimatedString> m_result { SVGAnimatedString::create(this) };
 };
 
-void invalidateFilterPrimitiveParent(SVGElement*);
-
-inline void SVGFilterPrimitiveStandardAttributes::invalidate()
-{
-    if (auto* primitiveRenderer = renderer())
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*primitiveRenderer);
-}
-
 inline void SVGFilterPrimitiveStandardAttributes::primitiveAttributeChanged(const QualifiedName& attribute)
 {
     if (auto* primitiveRenderer = renderer())

Modified: trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -81,8 +81,7 @@
         else {
             ASSERT(attrName == SVGNames::xAttr || attrName == SVGNames::yAttr);
             updateRelativeLengthsInformation();
-            if (auto renderer = this->renderer())
-                RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+            setSVGResourcesInAncestorChainAreDirty();
         }
         return;
     }

Modified: trunk/Source/WebCore/svg/SVGGeometryElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGGeometryElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGGeometryElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -150,8 +150,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         ASSERT(attrName == SVGNames::pathLengthAttr);
         InstanceInvalidationGuard guard(*this);
-        if (auto* renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGGradientElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGGradientElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGGradientElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -79,8 +79,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -94,8 +93,7 @@
     if (change.source == ChildChange::Source::Parser)
         return;
 
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 GradientColorStops SVGGradientElement::buildStops()

Modified: trunk/Source/WebCore/svg/SVGGraphicsElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGGraphicsElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGGraphicsElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -136,10 +136,9 @@
         ASSERT(attrName == SVGNames::transformAttr);
         InstanceInvalidationGuard guard(*this);
 
-        if (auto renderer = this->renderer()) {
+        if (auto renderer = this->renderer())
             renderer->setNeedsTransformUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        setSVGResourcesInAncestorChainAreDirty();
 
         return;
     }

Modified: trunk/Source/WebCore/svg/SVGImageElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGImageElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGImageElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -99,15 +99,15 @@
             updateRelativeLengthsInformation();
 
             if (auto* renderer = this->renderer()) {
-                if (downcast<RenderSVGImage>(*renderer).updateImageViewport())
-                    RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+                if (!downcast<RenderSVGImage>(*renderer).updateImageViewport())
+                    return;
+                setSVGResourcesInAncestorChainAreDirty();
             }
         } else if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr)
             setPresentationalHintStyleIsDirty();
         else {
             ASSERT(attrName == SVGNames::preserveAspectRatioAttr);
-            if (auto* renderer = this->renderer())
-                RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+            setSVGResourcesInAncestorChainAreDirty();
         }
         return;
     }

Modified: trunk/Source/WebCore/svg/SVGLineElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGLineElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGLineElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -74,10 +74,9 @@
         InstanceInvalidationGuard guard(*this);
         updateRelativeLengthsInformation();
 
-        if (auto* renderer = downcast<LegacyRenderSVGShape>(this->renderer())) {
-            renderer->setNeedsShapeUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        if (auto* renderer = this->renderer())
+            static_cast<LegacyRenderSVGShape*>(renderer)->setNeedsShapeUpdate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -83,8 +83,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         updateRelativeLengthsInformation();
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGMarkerElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGMarkerElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -98,14 +98,12 @@
         InstanceInvalidationGuard guard(*this);
         if (PropertyRegistry::isAnimatedLengthAttribute(attrName))
             updateRelativeLengthsInformation();
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
     
     if (SVGFitToViewBox::isKnownAttribute(attrName)) {
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -119,8 +117,7 @@
     if (change.source == ChildChange::Source::Parser)
         return;
 
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 String SVGMarkerElement::orient() const

Modified: trunk/Source/WebCore/svg/SVGMaskElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGMaskElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGMaskElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -105,8 +105,7 @@
     }
 
     if (PropertyRegistry::isKnownAttribute(attrName)) {
-        if (auto* renderer = this->renderer())
-            renderer->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -120,8 +119,7 @@
     if (change.source == ChildChange::Source::Parser)
         return;
 
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 RenderPtr<RenderElement> SVGMaskElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

Modified: trunk/Source/WebCore/svg/SVGPathElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGPathElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGPathElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -70,10 +70,9 @@
         InstanceInvalidationGuard guard(*this);
         invalidateMPathDependencies();
 
-        if (auto* renderer = downcast<RenderSVGPath>(this->renderer())) {
-            renderer->setNeedsShapeUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        if (auto* renderer = this->renderer())
+            static_cast<RenderSVGPath*>(renderer)->setNeedsShapeUpdate();
+        setSVGResourcesInAncestorChainAreDirty();
 
         return;
     }

Modified: trunk/Source/WebCore/svg/SVGPatternElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGPatternElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGPatternElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -117,8 +117,7 @@
     }
 
     if (PropertyRegistry::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -132,8 +131,7 @@
     if (change.source == ChildChange::Source::Parser)
         return;
 
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 RenderPtr<RenderElement> SVGPatternElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

Modified: trunk/Source/WebCore/svg/SVGPolyElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGPolyElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGPolyElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -57,11 +57,10 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         ASSERT(attrName == SVGNames::pointsAttr);
-        if (auto* renderer = downcast<RenderSVGPath>(this->renderer())) {
-            InstanceInvalidationGuard guard(*this);
-            renderer->setNeedsShapeUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        InstanceInvalidationGuard guard(*this);
+        if (auto* renderer = this->renderer())
+            static_cast<RenderSVGPath*>(renderer)->setNeedsShapeUpdate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -89,8 +89,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         updateRelativeLengthsInformation();
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGSVGElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -137,8 +137,7 @@
 
 void SVGSVGElement::updateCurrentTranslate()
 {
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
     if (parentNode() == &document() && document().renderView())
         document().renderView()->repaint();
 }
@@ -211,16 +210,28 @@
         InstanceInvalidationGuard guard(*this);
         setPresentationalHintStyleIsDirty();
 
-        if (auto* renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
+            // FIXME: try to get rid of this custom handling of embedded SVG invalidation, maybe through abstraction.
+            if (auto* renderer = this->renderer()) {
+                bool embeddedThroughFrame = false;
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+                if (is<RenderSVGRoot>(renderer) && downcast<RenderSVGRoot>(renderer)->isEmbeddedThroughFrameContainingSVGDocument())
+                    embeddedThroughFrame = true;
+#endif
+                if (!embeddedThroughFrame && is<LegacyRenderSVGRoot>(renderer) && downcast<LegacyRenderSVGRoot>(renderer)->isEmbeddedThroughFrameContainingSVGDocument())
+                    embeddedThroughFrame = true;
+                if (embeddedThroughFrame)
+                    renderer->view().setNeedsLayout(MarkOnlyThis);
+            }
+        }
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
     if (SVGFitToViewBox::isKnownAttribute(attrName)) {
-        if (auto* renderer = this->renderer()) {
+        if (auto* renderer = this->renderer())
             renderer->setNeedsTransformUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGStopElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGStopElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGStopElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -66,10 +66,8 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         ASSERT(attrName == SVGNames::offsetAttr);
-        if (auto renderer = this->renderer()) {
-            InstanceInvalidationGuard guard(*this);
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        InstanceInvalidationGuard guard(*this);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGTRefElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGTRefElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGTRefElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -184,8 +184,7 @@
     if (SVGURIReference::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         buildPendingResource();
-        if (auto renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGTextContentElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGTextContentElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGTextContentElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -183,10 +183,8 @@
         if (attrName == SVGNames::textLengthAttr)
             m_specifiedTextLength = m_textLength->baseVal()->value();
 
-        if (auto renderer = this->renderer()) {
-            InstanceInvalidationGuard guard(*this);
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        InstanceInvalidationGuard guard(*this);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGTextPathElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGTextPathElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGTextPathElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -93,15 +93,13 @@
         if (attrName == SVGNames::startOffsetAttr)
             updateRelativeLengthsInformation();
 
-        if (auto renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
     if (SVGURIReference::isKnownAttribute(attrName)) {
         buildPendingResource();
-        if (auto renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGTextPositioningElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGTextPositioningElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGTextPositioningElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -106,9 +106,8 @@
         if (auto renderer = this->renderer()) {
             if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*renderer))
                 textAncestor->setNeedsPositioningValuesUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
         }
-
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -165,8 +165,7 @@
             if (auto targetClone = this->targetClone())
                 transferSizeAttributesToTargetClone(*targetClone);
         }
-        if (auto* renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGViewElement.cpp (291787 => 291788)


--- trunk/Source/WebCore/svg/SVGViewElement.cpp	2022-03-24 06:27:16 UTC (rev 291787)
+++ trunk/Source/WebCore/svg/SVGViewElement.cpp	2022-03-24 06:32:33 UTC (rev 291788)
@@ -59,12 +59,10 @@
         return;
 
     if (SVGFitToViewBox::isKnownAttribute(attrName)) {
-        if (m_targetElement) {
-            m_targetElement->inheritViewAttributes(*this);
-            if (auto* renderer = m_targetElement->renderer())
-                RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
-
+        if (!m_targetElement)
+            return;
+        m_targetElement->inheritViewAttributes(*this);
+        m_targetElement->setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to