Updating href on textPath doesn't update its rendering
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2018 22:06:35 +0000 (22:06 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2018 22:06:35 +0000 (22:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191920

Reviewed by Dean Jackson.

Source/WebCore:

Fixed the bug by invalidating the RenderSVGResource in SVGTextPathElement::svgAttributeChanged
in addition to updating the pending resources.

Test: svg/text/textpath-reference-update.html

* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::svgAttributeChanged):

LayoutTests:

Added a ref test.

* svg/text/textpath-reference-update-expected.html: Added.
* svg/text/textpath-reference-update.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238464 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/svg/text/textpath-reference-update-expected.html [new file with mode: 0644]
LayoutTests/svg/text/textpath-reference-update.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGTextPathElement.cpp

index 9245bfe..53849e2 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Updating href on textPath doesn't update its rendering
+        https://bugs.webkit.org/show_bug.cgi?id=191920
+
+        Reviewed by Dean Jackson.
+
+        Added a ref test.
+
+        * svg/text/textpath-reference-update-expected.html: Added.
+        * svg/text/textpath-reference-update.html: Added.
+
 2018-11-23  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][IFC] Add support for variable height runs.
diff --git a/LayoutTests/svg/text/textpath-reference-update-expected.html b/LayoutTests/svg/text/textpath-reference-update-expected.html
new file mode 100644 (file)
index 0000000..e704d24
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <p>Test passes if you see a single 100px by 100px green box below.</p>
+    <div style="width: 100px; height: 100px; background: green;"></div>
+</body>
+</html>
diff --git a/LayoutTests/svg/text/textpath-reference-update.html b/LayoutTests/svg/text/textpath-reference-update.html
new file mode 100644 (file)
index 0000000..32be291
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Test passes if you see a single 100px by 100px green box below.</p>
+<svg style="width: 100px; height: 100px;" viewbox="0 0 100 100">
+    <defs>
+        <path id="path1" d="M0,50 L100,50 Z" />
+        <path id="path2" d="M0,-5 L100,-5 Z" />
+    </defs>
+    <rect x="0" y="0" width="100" height="100" fill="green"></rect>
+    <text>
+        <textPath href="#path1">FAIL</textPath>
+    </text>
+</svg>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+window.onload = () => {
+    requestAnimationFrame(() => {
+        document.querySelector('textPath').setAttribute('href', '#path2');
+        if (window.testRunner)
+            requestAnimationFrame(() => testRunner.notifyDone());
+    });
+}
+
+</script>
+</body>
+</html>
index 1448708..70faf9a 100644 (file)
@@ -1,3 +1,18 @@
+2018-11-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Updating href on textPath doesn't update its rendering
+        https://bugs.webkit.org/show_bug.cgi?id=191920
+
+        Reviewed by Dean Jackson.
+
+        Fixed the bug by invalidating the RenderSVGResource in SVGTextPathElement::svgAttributeChanged
+        in addition to updating the pending resources.
+
+        Test: svg/text/textpath-reference-update.html
+
+        * svg/SVGTextPathElement.cpp:
+        (WebCore::SVGTextPathElement::svgAttributeChanged):
+
 2018-11-23  Ross Kirsling  <ross.kirsling@sony.com>
 
         Introduce user-defined literal for LayoutUnit
index 0c95060..55f2c3f 100644 (file)
@@ -103,6 +103,8 @@ void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName)
 
     if (SVGURIReference::isKnownAttribute(attrName)) {
         buildPendingResource();
+        if (auto renderer = this->renderer())
+            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
         return;
     }