Title: [240305] trunk
Revision
240305
Author
[email protected]
Date
2019-01-22 16:13:41 -0800 (Tue, 22 Jan 2019)

Log Message

Dynamic changes in the style attributes of an SVGElement do no affect the <use> instances
https://bugs.webkit.org/show_bug.cgi?id=193647

Patch by Said Abou-Hallawa <[email protected]> on 2019-01-22
Reviewed by Simon Fraser.

Source/WebCore:

Changing a style attribute of an SVGELement needs to call invalidateInstances().

Tests: svg/custom/svg-use-style-dynamic-change-invalidate.svg

* svg/SVGElement.cpp:
(WebCore::SVGElement::attributeChanged):

LayoutTests:

* svg/custom/svg-use-style-dynamic-change-invalidate-expected.svg: Added.
* svg/custom/svg-use-style-dynamic-change-invalidate.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (240304 => 240305)


--- trunk/LayoutTests/ChangeLog	2019-01-23 00:10:19 UTC (rev 240304)
+++ trunk/LayoutTests/ChangeLog	2019-01-23 00:13:41 UTC (rev 240305)
@@ -1,3 +1,13 @@
+2019-01-22  Said Abou-Hallawa  <[email protected]>
+
+        Dynamic changes in the style attributes of an SVGElement do no affect the <use> instances
+        https://bugs.webkit.org/show_bug.cgi?id=193647
+
+        Reviewed by Simon Fraser.
+
+        * svg/custom/svg-use-style-dynamic-change-invalidate-expected.svg: Added.
+        * svg/custom/svg-use-style-dynamic-change-invalidate.svg: Added.
+
 2019-01-22  Michael Catanzaro  <[email protected]>
 
         Unreviewed, skip all resource load statistics tests on GTK

Added: trunk/LayoutTests/svg/custom/svg-use-style-dynamic-change-invalidate-expected.svg (0 => 240305)


--- trunk/LayoutTests/svg/custom/svg-use-style-dynamic-change-invalidate-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-use-style-dynamic-change-invalidate-expected.svg	2019-01-23 00:13:41 UTC (rev 240305)
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+	<rect width="100" height="100" fill="green"/>
+	<rect x="110" width="100" height="100" fill="green"/>
+	<rect x="220" width="100" height="100" fill="green"/>
+	<rect x="330" width="100" height="100" fill="green"/>
+</svg>

Added: trunk/LayoutTests/svg/custom/svg-use-style-dynamic-change-invalidate.svg (0 => 240305)


--- trunk/LayoutTests/svg/custom/svg-use-style-dynamic-change-invalidate.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-use-style-dynamic-change-invalidate.svg	2019-01-23 00:13:41 UTC (rev 240305)
@@ -0,0 +1,25 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <symbol id="symbol">
+        <rect id="symbol-rect" width="100%" height="100%" fill="red"/>
+    </symbol>
+    <defs>
+        <rect id="defs-rect" width="100" height="100" fill="red"/>
+    </defs>
+    <rect id="rect" width="100" height="100" fill="red"/>
+    <use x="110" width="100" height="100" xlink:href=""
+    <use x="220" width="100" height="100" xlink:href=""
+    <use x="330" width="100" height="100" xlink:href=""
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        setTimeout(function(){
+            document.getElementById("symbol-rect").setAttribute("style", "fill: green");
+            document.getElementById("defs-rect").setAttribute("style", "fill: green");
+            document.getElementById("rect").setAttribute("style", "fill: green");
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+      }, 0);
+    </script>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (240304 => 240305)


--- trunk/Source/WebCore/ChangeLog	2019-01-23 00:10:19 UTC (rev 240304)
+++ trunk/Source/WebCore/ChangeLog	2019-01-23 00:13:41 UTC (rev 240305)
@@ -1,3 +1,17 @@
+2019-01-22  Said Abou-Hallawa  <[email protected]>
+
+        Dynamic changes in the style attributes of an SVGElement do no affect the <use> instances
+        https://bugs.webkit.org/show_bug.cgi?id=193647
+
+        Reviewed by Simon Fraser.
+
+        Changing a style attribute of an SVGELement needs to call invalidateInstances().
+
+        Tests: svg/custom/svg-use-style-dynamic-change-invalidate.svg
+
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::attributeChanged):
+
 2019-01-22  Alex Christensen  <[email protected]>
 
         Fix more builds.

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (240304 => 240305)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2019-01-23 00:10:19 UTC (rev 240304)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2019-01-23 00:13:41 UTC (rev 240305)
@@ -686,8 +686,10 @@
         document().accessSVGExtensions().rebuildAllElementReferencesForTarget(*this);
 
     // Changes to the style attribute are processed lazily (see Element::getAttribute() and related methods),
-    // so we don't want changes to the style attribute to result in extra work here.
-    if (name != HTMLNames::styleAttr)
+    // so we don't want changes to the style attribute to result in extra work here except invalidateInstances().
+    if (name == HTMLNames::styleAttr)
+        invalidateInstances();
+    else
         svgAttributeChanged(name);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to