Title: [276888] trunk
Revision
276888
Author
[email protected]
Date
2021-05-02 12:08:30 -0700 (Sun, 02 May 2021)

Log Message

getPropertyValue for url path doesn't return the "#" character
https://bugs.webkit.org/show_bug.cgi?id=215409

Patch by Rob Buis <[email protected]> on 2021-05-02
Reviewed by Sam Weinig.

Source/WebCore:

Adapt url serializing in SVG to match Firefox and Chrome.

Test: svg/css/computed-style-url-serializing.html

* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::svgPropertyValue):

LayoutTests:

Add test for this.

* svg/css/computed-style-url-serializing-expected.txt: Added.
* svg/css/computed-style-url-serializing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (276887 => 276888)


--- trunk/LayoutTests/ChangeLog	2021-05-02 19:01:51 UTC (rev 276887)
+++ trunk/LayoutTests/ChangeLog	2021-05-02 19:08:30 UTC (rev 276888)
@@ -1,3 +1,15 @@
+2021-05-02  Rob Buis  <[email protected]>
+
+        getPropertyValue for url path doesn't return the "#" character
+        https://bugs.webkit.org/show_bug.cgi?id=215409
+
+        Reviewed by Sam Weinig.
+
+        Add test for this.
+
+        * svg/css/computed-style-url-serializing-expected.txt: Added.
+        * svg/css/computed-style-url-serializing.html: Added.
+
 2021-05-02  Sam Weinig  <[email protected]>
 
         Consider removing imported/w3c/canvas and canvas/philip (Part 2)

Added: trunk/LayoutTests/svg/css/computed-style-url-serializing-expected.txt (0 => 276888)


--- trunk/LayoutTests/svg/css/computed-style-url-serializing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/css/computed-style-url-serializing-expected.txt	2021-05-02 19:08:30 UTC (rev 276888)
@@ -0,0 +1,15 @@
+Test url serializing of SVG presentation attributes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.defaultView.getComputedStyle(rect, null).mask is "url(\"#reference\")"
+PASS document.defaultView.getComputedStyle(rect, null).markerStart is "url(\"#reference\")"
+PASS document.defaultView.getComputedStyle(rect, null).markerMid is "url(\"#reference\")"
+PASS document.defaultView.getComputedStyle(rect, null).markerEnd is "url(\"#reference\")"
+PASS document.defaultView.getComputedStyle(rect, null).fill is "url(\"#reference\")"
+PASS document.defaultView.getComputedStyle(rect, null).stroke is "url(\"#reference\")"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/css/computed-style-url-serializing.html (0 => 276888)


--- trunk/LayoutTests/svg/css/computed-style-url-serializing.html	                        (rev 0)
+++ trunk/LayoutTests/svg/css/computed-style-url-serializing.html	2021-05-02 19:08:30 UTC (rev 276888)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+description("Test url serializing of SVG presentation attributes.")
+createSVGTestCase();
+
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("mask", "url(#reference)");
+rect.setAttribute("marker-start", "url(#reference)");
+rect.setAttribute("marker-mid", "url(#reference)");
+rect.setAttribute("marker-end", "url(#reference)");
+rect.setAttribute("fill", "url(#reference)");
+rect.setAttribute("stroke", "url(#reference)");
+rootSVGElement.appendChild(rect);
+
+shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).mask", 'url("#reference")');
+shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).markerStart", 'url("#reference")');
+shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).markerMid", 'url("#reference")');
+shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).markerEnd", 'url("#reference")');
+shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill", 'url("#reference")');
+shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke", 'url("#reference")');
+
+var successfullyParsed = true;
+
+completeTest();
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (276887 => 276888)


--- trunk/Source/WebCore/ChangeLog	2021-05-02 19:01:51 UTC (rev 276887)
+++ trunk/Source/WebCore/ChangeLog	2021-05-02 19:08:30 UTC (rev 276888)
@@ -1,3 +1,17 @@
+2021-05-02  Rob Buis  <[email protected]>
+
+        getPropertyValue for url path doesn't return the "#" character
+        https://bugs.webkit.org/show_bug.cgi?id=215409
+
+        Reviewed by Sam Weinig.
+
+        Adapt url serializing in SVG to match Firefox and Chrome.
+
+        Test: svg/css/computed-style-url-serializing.html
+
+        * css/SVGCSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::svgPropertyValue):
+
 2021-05-02  Sam Weinig  <[email protected]>
 
         Add support for DestinationColorSpace::DisplayP3 in preparation for DisplayP3 canvas

Modified: trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp (276887 => 276888)


--- trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp	2021-05-02 19:01:51 UTC (rev 276887)
+++ trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp	2021-05-02 19:08:30 UTC (rev 276888)
@@ -122,7 +122,7 @@
         return CSSPrimitiveValue::create(svgStyle.textAnchor());
     case CSSPropertyMask:
         if (!svgStyle.maskerResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.maskerResource(), CSSUnitType::CSS_URI);
+            return CSSPrimitiveValue::create(makeString('#', svgStyle.maskerResource()), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyFloodColor:
         return currentColorOrValidColor(style, svgStyle.floodColor());
@@ -136,15 +136,15 @@
         return SVGLengthValue::toCSSPrimitiveValue(svgStyle.kerning());
     case CSSPropertyMarkerEnd:
         if (!svgStyle.markerEndResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.markerEndResource(), CSSUnitType::CSS_URI);
+            return CSSPrimitiveValue::create(makeString("#", svgStyle.markerEndResource()), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyMarkerMid:
         if (!svgStyle.markerMidResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.markerMidResource(), CSSUnitType::CSS_URI);
+            return CSSPrimitiveValue::create(makeString("#", svgStyle.markerMidResource()), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyMarkerStart:
         if (!svgStyle.markerStartResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.markerStartResource(), CSSUnitType::CSS_URI);
+            return CSSPrimitiveValue::create(makeString("#", svgStyle.markerStartResource()), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyStroke:
         return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyle.strokePaintUri(), svgStyle.strokePaintColor(), style->color());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to