[SVG] -webkit-clip-path treats url(abc#xyz) as url(#xyz) because it checks only URL...
authorHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Aug 2019 02:06:42 +0000 (02:06 +0000)
committerHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Aug 2019 02:06:42 +0000 (02:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201030

Reviewed by Ryosuke Niwa.

Source/WebCore:

Tests: svg/clip-path/clip-path-invalid-reference-001-expected.svg
       svg/clip-path/clip-path-invalid-reference-001.svg
       svg/clip-path/clip-path-invalid-reference-002-expected.svg
       svg/clip-path/clip-path-invalid-reference-002.svg

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertClipPath): Use
SVGURIReference::fragmentIdentifierFromIRIString to get fragment
identifier from -webkit-clip-path.

LayoutTests:

* svg/clip-path/clip-path-invalid-reference-001-expected.svg: Added.
* svg/clip-path/clip-path-invalid-reference-001.svg: Added.
* svg/clip-path/clip-path-invalid-reference-002-expected.svg: Added.
* svg/clip-path/clip-path-invalid-reference-002.svg: Added.

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

LayoutTests/ChangeLog
LayoutTests/svg/clip-path/clip-path-invalid-reference-001-expected.svg [new file with mode: 0644]
LayoutTests/svg/clip-path/clip-path-invalid-reference-001.svg [new file with mode: 0644]
LayoutTests/svg/clip-path/clip-path-invalid-reference-002-expected.svg [new file with mode: 0644]
LayoutTests/svg/clip-path/clip-path-invalid-reference-002.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StyleBuilderConverter.h

index 93c9d31..ea5cfaa 100644 (file)
@@ -1,3 +1,15 @@
+2019-08-22  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [SVG] -webkit-clip-path treats url(abc#xyz) as url(#xyz) because it checks only URL fragment part
+        https://bugs.webkit.org/show_bug.cgi?id=201030
+
+        Reviewed by Ryosuke Niwa.
+
+        * svg/clip-path/clip-path-invalid-reference-001-expected.svg: Added.
+        * svg/clip-path/clip-path-invalid-reference-001.svg: Added.
+        * svg/clip-path/clip-path-invalid-reference-002-expected.svg: Added.
+        * svg/clip-path/clip-path-invalid-reference-002.svg: Added.
+
 2019-08-22  Daniel Bates  <dabates@apple.com>
 
         [iOS] Should show input view when became first responder if keyboard was showing when the view was resigned
diff --git a/LayoutTests/svg/clip-path/clip-path-invalid-reference-001-expected.svg b/LayoutTests/svg/clip-path/clip-path-invalid-reference-001-expected.svg
new file mode 100644 (file)
index 0000000..30e712e
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<rect width="200" height="200" fill="green"/>
+</svg>
diff --git a/LayoutTests/svg/clip-path/clip-path-invalid-reference-001.svg b/LayoutTests/svg/clip-path/clip-path-invalid-reference-001.svg
new file mode 100644 (file)
index 0000000..a4ea5cf
--- /dev/null
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<clipPath id="clip1">
+  <rect width="100" height="100"/>
+</clipPath>
+<rect width="200" height="200" fill="green" clip-path="url(#not-found)"/>
+</svg>
diff --git a/LayoutTests/svg/clip-path/clip-path-invalid-reference-002-expected.svg b/LayoutTests/svg/clip-path/clip-path-invalid-reference-002-expected.svg
new file mode 100644 (file)
index 0000000..30e712e
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<rect width="200" height="200" fill="green"/>
+</svg>
diff --git a/LayoutTests/svg/clip-path/clip-path-invalid-reference-002.svg b/LayoutTests/svg/clip-path/clip-path-invalid-reference-002.svg
new file mode 100644 (file)
index 0000000..8695905
--- /dev/null
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<clipPath id="clip1">
+</clipPath>
+<rect width="200" height="200" fill="green" style="-webkit-clip-path: url(not-found#clip1)"/>
+</svg>
index e8ce78a..770ec0f 100644 (file)
@@ -1,3 +1,20 @@
+2019-08-22  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [SVG] -webkit-clip-path treats url(abc#xyz) as url(#xyz) because it checks only URL fragment part
+        https://bugs.webkit.org/show_bug.cgi?id=201030
+
+        Reviewed by Ryosuke Niwa.
+
+        Tests: svg/clip-path/clip-path-invalid-reference-001-expected.svg
+               svg/clip-path/clip-path-invalid-reference-001.svg
+               svg/clip-path/clip-path-invalid-reference-002-expected.svg
+               svg/clip-path/clip-path-invalid-reference-002.svg
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertClipPath): Use
+        SVGURIReference::fragmentIdentifierFromIRIString to get fragment
+        identifier from -webkit-clip-path.
+
 2019-08-22  Andy Estes  <aestes@apple.com>
 
         [watchOS] Disable Content Filtering in the simulator build
index 88775ad..c073a10 100644 (file)
@@ -590,9 +590,9 @@ inline RefPtr<ClipPathOperation> StyleBuilderConverter::convertClipPath(StyleRes
         auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
         if (primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_URI) {
             String cssURLValue = primitiveValue.stringValue();
-            URL url = styleResolver.document().completeURL(cssURLValue);
+            String fragment = SVGURIReference::fragmentIdentifierFromIRIString(cssURLValue, styleResolver.document());
             // FIXME: It doesn't work with external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=126133)
-            return ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier());
+            return ReferenceClipPathOperation::create(cssURLValue, fragment);
         }
         ASSERT(primitiveValue.valueID() == CSSValueNone);
         return nullptr;