Title: [293792] branches/safari-613-branch/Source/WebCore
Revision
293792
Author
[email protected]
Date
2022-05-04 14:23:43 -0700 (Wed, 04 May 2022)

Log Message

Apply patch. rdar://problem/75450208

Modified Paths


Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-05-04 21:23:43 UTC (rev 293792)
@@ -1,5 +1,135 @@
 2022-05-04  Alan Coon  <[email protected]>
 
+        Apply patch. rdar://problem/75450208
+
+    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::invalidateSVGPresentationalHintStyle):
+            * 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-05-04  Alan Coon  <[email protected]>
+
         Cherry-pick r291299. rdar://problem/91446377
 
     Line Builder and Content Breaker out of sync

Modified: branches/safari-613-branch/Source/WebCore/dom/ElementData.h (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/dom/ElementData.h	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/dom/ElementData.h	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -46,6 +46,7 @@
 #include "RenderTreeUpdaterGeneratedContent.h"
 #include "RenderView.h"
 #include "RuntimeEnabledFeatures.h"
+#include "SVGElement.h"
 #include "StyleResolver.h"
 #include "StyleTreeResolver.h"
 #include "TextManipulationController.h"
@@ -193,6 +194,9 @@
         if (elementUpdates)
             updateElementRenderer(element, *elementUpdates);
 
+        if (is<SVGElement>(element))
+            downcast<SVGElement>(element).invalidateSVGResourcesInAncestorChainIfNeeded();
+
         storePreviousRenderer(element);
 
         bool mayHaveRenderedDescendants = element.renderer() || (element.hasDisplayContents() && shouldCreateRenderer(element, renderTreePosition().parent()));

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGAnimateMotionElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGClipPathElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGClipPathElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGClipPathElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -92,7 +92,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidateFilterPrimitiveParent(this);
+        SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent(this);
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGElement.h (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGElement.h	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGElement.h	2022-05-04 21:23:43 UTC (rev 293792)
@@ -84,6 +84,8 @@
 
     inline void invalidateSVGAttributes();
     inline void invalidateSVGPresentationalHintStyle();
+    void setSVGResourcesInAncestorChainAreDirty();
+    void invalidateSVGResourcesInAncestorChainIfNeeded();
 
     // The instances of an element are clones made in shadow trees to implement <use>.
     const WeakHashSet<SVGElement>& instances() const;

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGElementInlines.h (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGElementInlines.h	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGElementInlines.h	2022-05-04 21:23:43 UTC (rev 293792)
@@ -38,7 +38,6 @@
 inline void SVGElement::invalidateSVGPresentationalHintStyle()
 {
     ensureUniqueElementData().setPresentationalHintStyleIsDirty(true);
-    // Trigger style recalculation for "elements as resource" (e.g. referenced by feImage).
     invalidateStyle();
 }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEBlendElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEBlendElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEBlendElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -93,7 +93,7 @@
 
     if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEColorMatrixElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEColorMatrixElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEColorMatrixElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -93,7 +93,7 @@
 
     if (attrName == SVGNames::inAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFECompositeElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFECompositeElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFECompositeElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -124,7 +124,7 @@
 
     if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -164,7 +164,7 @@
 {
     m_orderX->setBaseValInternal(x);
     m_orderY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEConvolveMatrixElement::setKernelUnitLength(float x, float y)
@@ -171,7 +171,7 @@
 {
     m_kernelUnitLengthX->setBaseValInternal(x);
     m_kernelUnitLengthY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEConvolveMatrixElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -184,7 +184,7 @@
 
     if (attrName == SVGNames::inAttr || attrName == SVGNames::orderAttr || attrName == SVGNames::kernelMatrixAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -135,7 +135,7 @@
 
     if (attrName == SVGNames::inAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -108,7 +108,7 @@
 
     if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEDropShadowElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEDropShadowElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEDropShadowElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -55,7 +55,7 @@
 {
     m_stdDeviationX->setBaseValInternal(x);
     m_stdDeviationY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEDropShadowElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -90,7 +90,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -54,7 +54,7 @@
 {
     m_stdDeviationX->setBaseValInternal(x);
     m_stdDeviationY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -88,7 +88,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEImageElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEImageElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEImageElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -110,7 +110,7 @@
     } else if (is<SVGElement>(*target.element))
         downcast<SVGElement>(*target.element).addReferencingElement(*this);
 
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -128,7 +128,7 @@
 {
     if (attrName == SVGNames::preserveAspectRatioAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFELightElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFELightElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFELightElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -154,12 +154,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: branches/safari-613-branch/Source/WebCore/svg/SVGFEMergeNodeElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEMergeNodeElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEMergeNodeElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -62,7 +62,7 @@
 {
     if (attrName == SVGNames::inAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidateFilterPrimitiveParent(this);
+        SVGFilterPrimitiveStandardAttributes::invalidateFilterPrimitiveParent(this);
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEMorphologyElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEMorphologyElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEMorphologyElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -53,7 +53,7 @@
 {
     m_radiusX->setBaseValInternal(x);
     m_radiusY->setBaseValInternal(y);
-    invalidate();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 void SVGFEMorphologyElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -107,7 +107,7 @@
 
     if (attrName == SVGNames::inAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFEOffsetElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFEOffsetElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFEOffsetElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -74,7 +74,7 @@
 {
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFESpecularLightingElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFESpecularLightingElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFESpecularLightingElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -144,7 +144,7 @@
 
     if (attrName == SVGNames::inAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFETileElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFETileElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFETileElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -63,7 +63,7 @@
 {
     if (attrName == SVGNames::inAttr) {
         InstanceInvalidationGuard guard(*this);
-        invalidate();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGFilterElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFilterElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFilterElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h	2022-05-04 21:23:43 UTC (rev 293792)
@@ -54,6 +54,8 @@
     SVGAnimatedLength& heightAnimated() { return m_height; }
     SVGAnimatedString& resultAnimated() { return m_result; }
 
+    static void invalidateFilterPrimitiveParent(SVGElement*);
+
 protected:
     SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&);
 
@@ -61,7 +63,6 @@
     void svgAttributeChanged(const QualifiedName&) override;
     void childrenChanged(const ChildChange&) override;
 
-    void invalidate();
     void primitiveAttributeChanged(const QualifiedName& attributeName);
 
 private:
@@ -80,14 +81,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: branches/safari-613-branch/Source/WebCore/svg/SVGForeignObjectElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGForeignObjectElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGForeignObjectElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -81,8 +81,7 @@
 
     if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) {
         updateRelativeLengthsInformation();
-        if (auto renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGGeometryElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGGeometryElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGGeometryElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -149,8 +149,7 @@
 {
     if (attrName == SVGNames::pathLengthAttr) {
         InstanceInvalidationGuard guard(*this);
-        if (auto* renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGGradientElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGGradientElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGGradientElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGGraphicsElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGGraphicsElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGGraphicsElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -135,10 +135,9 @@
     if (attrName == SVGNames::transformAttr) {
         InstanceInvalidationGuard guard(*this);
 
-        if (auto renderer = this->renderer()) {
+        if (auto renderer = this->renderer())
             renderer->setNeedsTransformUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        setSVGResourcesInAncestorChainAreDirty();
 
         return;
     }

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGImageElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGImageElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGImageElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -98,8 +98,9 @@
         updateRelativeLengthsInformation();
 
         if (auto* renderer = this->renderer()) {
-            if (downcast<RenderSVGImage>(*renderer).updateImageViewport())
-                RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+            if (!downcast<RenderSVGImage>(*renderer).updateImageViewport())
+                return;
+            setSVGResourcesInAncestorChainAreDirty();
         }
         return;
     }
@@ -112,8 +113,7 @@
 
     if (attrName == SVGNames::preserveAspectRatioAttr) {
         InstanceInvalidationGuard guard(*this);
-        if (auto* renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGLineElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGLineElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGLineElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGLinearGradientElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGLinearGradientElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGLinearGradientElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -83,8 +83,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         updateRelativeLengthsInformation();
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGMarkerElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGMarkerElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGMarkerElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGMaskElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGMaskElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGMaskElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGPathElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGPathElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGPathElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -69,10 +69,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: branches/safari-613-branch/Source/WebCore/svg/SVGPatternElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGPatternElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGPatternElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -118,8 +118,7 @@
     }
 
     if (PropertyRegistry::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 
@@ -133,8 +132,7 @@
     if (change.source == ChildChange::Source::Parser)
         return;
 
-    if (RenderObject* object = renderer())
-        object->setNeedsLayout();
+    setSVGResourcesInAncestorChainAreDirty();
 }
 
 RenderPtr<RenderElement> SVGPatternElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGPolyElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGPolyElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGPolyElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -56,11 +56,10 @@
 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (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: branches/safari-613-branch/Source/WebCore/svg/SVGRadialGradientElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGRadialGradientElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGRadialGradientElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -89,8 +89,7 @@
     if (PropertyRegistry::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         updateRelativeLengthsInformation();
-        if (RenderObject* object = renderer())
-            object->setNeedsLayout();
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGSVGElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGSVGElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGSVGElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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);
         invalidateSVGPresentationalHintStyle();
 
-        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: branches/safari-613-branch/Source/WebCore/svg/SVGStopElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGStopElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGStopElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -65,10 +65,8 @@
 void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (attrName == SVGNames::offsetAttr) {
-        if (auto renderer = this->renderer()) {
-            InstanceInvalidationGuard guard(*this);
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        }
+        InstanceInvalidationGuard guard(*this);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGTRefElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGTRefElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGTRefElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -184,8 +184,7 @@
     if (SVGURIReference::isKnownAttribute(attrName)) {
         InstanceInvalidationGuard guard(*this);
         buildPendingResource();
-        if (auto renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGTextContentElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGTextContentElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGTextContentElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGTextPathElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGTextPathElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGTextPathElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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: branches/safari-613-branch/Source/WebCore/svg/SVGTextPositioningElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGTextPositioningElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGTextPositioningElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -106,9 +106,8 @@
         if (auto renderer = this->renderer()) {
             if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*renderer))
                 textAncestor->setNeedsPositioningValuesUpdate();
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
         }
-
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGUseElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGUseElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGUseElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -165,8 +165,7 @@
             if (auto targetClone = this->targetClone())
                 transferSizeAttributesToTargetClone(*targetClone);
         }
-        if (auto* renderer = this->renderer())
-            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
+        setSVGResourcesInAncestorChainAreDirty();
         return;
     }
 

Modified: branches/safari-613-branch/Source/WebCore/svg/SVGViewElement.cpp (293791 => 293792)


--- branches/safari-613-branch/Source/WebCore/svg/SVGViewElement.cpp	2022-05-04 21:23:32 UTC (rev 293791)
+++ branches/safari-613-branch/Source/WebCore/svg/SVGViewElement.cpp	2022-05-04 21:23:43 UTC (rev 293792)
@@ -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