Title: [236991] trunk
Revision
236991
Author
s...@apple.com
Date
2018-10-09 16:59:52 -0700 (Tue, 09 Oct 2018)

Log Message

REGRESSION(r234620): SVGLangSpace::svgAttributeChanged() should invalidate the renderer of the SVGGeometryElement descendant only
https://bugs.webkit.org/show_bug.cgi?id=190411

Reviewed by Simon Fraser.

Source/WebCore:

Test: svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr.html

When changing the attributes of the SVGLangSpace, we should invalidate
the renderer of the SVGGeometryElement descendant only. Renderer of other
elements, like SVGStopElement, should not be invalidated because they do
not have geometry and they can be used as resources for drawing another
SVGGeometryElement.

* svg/SVGElement.h:
(WebCore::SVGElement::isSVGGeometryElement const):
* svg/SVGGeometryElement.h:
(isType):
* svg/SVGLangSpace.cpp:
(WebCore::SVGLangSpace::svgAttributeChanged):

LayoutTests:

* svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr-expected.txt: Added.
* svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (236990 => 236991)


--- trunk/LayoutTests/ChangeLog	2018-10-09 23:46:12 UTC (rev 236990)
+++ trunk/LayoutTests/ChangeLog	2018-10-09 23:59:52 UTC (rev 236991)
@@ -1,3 +1,13 @@
+2018-10-09  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        REGRESSION(r234620): SVGLangSpace::svgAttributeChanged() should invalidate the renderer of the SVGGeometryElement descendant only
+        https://bugs.webkit.org/show_bug.cgi?id=190411
+
+        Reviewed by Simon Fraser.
+
+        * svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr-expected.txt: Added.
+        * svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr.html: Added.
+
 2018-10-09  Chris Dumez  <cdu...@apple.com>
 
         Anchor target should be ignored on activation when the download attribute is set

Added: trunk/LayoutTests/svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr-expected.txt (0 => 236991)


--- trunk/LayoutTests/svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr-expected.txt	2018-10-09 23:59:52 UTC (rev 236991)
@@ -0,0 +1,3 @@
+Passes if no crash happens.
+
+

Added: trunk/LayoutTests/svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr.html (0 => 236991)


--- trunk/LayoutTests/svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr.html	                        (rev 0)
+++ trunk/LayoutTests/svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr.html	2018-10-09 23:59:52 UTC (rev 236991)
@@ -0,0 +1,21 @@
+<body>
+    <p>Passes if no crash happens.</p>
+    <svg>
+        <linearGradient id="gradient">
+            <stop id="stop1" offset="0%" stop-color="green" />
+            <stop id="stop2" offset="50%" stop-color="green" />
+        </linearGradient>
+        <rect fill="url(#gradient)" x="10" y="10" width="200" height="100"/>
+    </svg>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        setTimeout(function(){ 
+            stop1.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:lang", "jw");
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    </script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (236990 => 236991)


--- trunk/Source/WebCore/ChangeLog	2018-10-09 23:46:12 UTC (rev 236990)
+++ trunk/Source/WebCore/ChangeLog	2018-10-09 23:59:52 UTC (rev 236991)
@@ -1,3 +1,25 @@
+2018-10-09  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        REGRESSION(r234620): SVGLangSpace::svgAttributeChanged() should invalidate the renderer of the SVGGeometryElement descendant only
+        https://bugs.webkit.org/show_bug.cgi?id=190411
+
+        Reviewed by Simon Fraser.
+
+        Test: svg/dynamic-updates/SVGStopElement-dom-xml-lang-attrr.html
+
+        When changing the attributes of the SVGLangSpace, we should invalidate
+        the renderer of the SVGGeometryElement descendant only. Renderer of other
+        elements, like SVGStopElement, should not be invalidated because they do
+        not have geometry and they can be used as resources for drawing another
+        SVGGeometryElement.
+
+        * svg/SVGElement.h:
+        (WebCore::SVGElement::isSVGGeometryElement const):
+        * svg/SVGGeometryElement.h:
+        (isType):
+        * svg/SVGLangSpace.cpp:
+        (WebCore::SVGLangSpace::svgAttributeChanged):
+
 2018-10-09  Chris Dumez  <cdu...@apple.com>
 
         Anchor target should be ignored on activation when the download attribute is set

Modified: trunk/Source/WebCore/svg/SVGElement.h (236990 => 236991)


--- trunk/Source/WebCore/svg/SVGElement.h	2018-10-09 23:46:12 UTC (rev 236990)
+++ trunk/Source/WebCore/svg/SVGElement.h	2018-10-09 23:59:52 UTC (rev 236991)
@@ -65,6 +65,7 @@
     virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
 
     virtual bool isSVGGraphicsElement() const { return false; }
+    virtual bool isSVGGeometryElement() const { return false; }
     virtual bool isFilterEffect() const { return false; }
     virtual bool isGradientStop() const { return false; }
     virtual bool isTextContent() const { return false; }

Modified: trunk/Source/WebCore/svg/SVGGeometryElement.h (236990 => 236991)


--- trunk/Source/WebCore/svg/SVGGeometryElement.h	2018-10-09 23:46:12 UTC (rev 236990)
+++ trunk/Source/WebCore/svg/SVGGeometryElement.h	2018-10-09 23:59:52 UTC (rev 236991)
@@ -54,6 +54,7 @@
     void svgAttributeChanged(const QualifiedName&) override;
 
 private:
+    bool isSVGGeometryElement() const override { return true; }
     const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
 
     static void registerAttributes();
@@ -64,3 +65,8 @@
 };
 
 } // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SVGGeometryElement)
+    static bool isType(const WebCore::SVGElement& element) { return element.isSVGGeometryElement(); }
+    static bool isType(const WebCore::Node& node) { return is<WebCore::SVGElement>(node) && isType(downcast<WebCore::SVGElement>(node)); }
+SPECIALIZE_TYPE_TRAITS_END()

Modified: trunk/Source/WebCore/svg/SVGLangSpace.cpp (236990 => 236991)


--- trunk/Source/WebCore/svg/SVGLangSpace.cpp	2018-10-09 23:46:12 UTC (rev 236990)
+++ trunk/Source/WebCore/svg/SVGLangSpace.cpp	2018-10-09 23:59:52 UTC (rev 236991)
@@ -24,7 +24,7 @@
 
 #include "RenderSVGResource.h"
 #include "RenderSVGShape.h"
-#include "SVGElement.h"
+#include "SVGGeometryElement.h"
 #include "XMLNames.h"
 #include <wtf/NeverDestroyed.h>
 
@@ -67,10 +67,13 @@
     if (!isKnownAttribute(attrName))
         return;
 
-    if (auto* renderer = downcast<RenderSVGShape>(m_contextElement.renderer())) {
-        SVGElement::InstanceInvalidationGuard guard(m_contextElement);
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-    }
+    auto* renderer = m_contextElement.renderer();
+    if (!is<RenderSVGShape>(renderer))
+        return;
+
+    ASSERT(is<SVGGeometryElement>(m_contextElement));
+    SVGElement::InstanceInvalidationGuard guard(m_contextElement);
+    RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
 }
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to