Title: [184091] releases/WebKitGTK/webkit-2.8
Revision
184091
Author
[email protected]
Date
2015-05-11 06:31:21 -0700 (Mon, 11 May 2015)

Log Message

Merge r183053 - REGRESSION (r177494): -webkit-mask-image: with data URI fails on non-local files
https://bugs.webkit.org/show_bug.cgi?id=141857

Reviewed by Dirk Schulze.

Source/WebCore:

r177494 regressed loading of data URIs in masks with remote content, triggering
a cross-domain error which occurs because the mask loading happened via a separate
SVGDocument.

Fix by checking for data URIs at parsing time, which is what we used to do.

Test: http/tests/css/data-uri-mask.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseMaskImage):
* svg/SVGURIReference.h:
(WebCore::SVGURIReference::isExternalURIReference):

LayoutTests:

Ref test with a masked green square. Has to be an http test to trigger the
origin checking.

* http/tests/css/data-uri-mask-expected.html: Added.
* http/tests/css/data-uri-mask.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (184090 => 184091)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-05-11 13:12:20 UTC (rev 184090)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-05-11 13:31:21 UTC (rev 184091)
@@ -1,3 +1,16 @@
+2015-04-20  Simon Fraser  <[email protected]>
+
+        REGRESSION (r177494): -webkit-mask-image: with data URI fails on non-local files
+        https://bugs.webkit.org/show_bug.cgi?id=141857
+
+        Reviewed by Dirk Schulze.
+        
+        Ref test with a masked green square. Has to be an http test to trigger the
+        origin checking.
+        
+        * http/tests/css/data-uri-mask-expected.html: Added.
+        * http/tests/css/data-uri-mask.html: Added.
+
 2015-04-17  Bem Jones-Bey  <[email protected]>
 
         Large values for line-height cause integer overflow in RenderStyle::computedLineHeight

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/css/data-uri-mask-expected.html (0 => 184091)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/css/data-uri-mask-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/css/data-uri-mask-expected.html	2015-05-11 13:31:21 UTC (rev 184091)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .masked {
+            height: 100px;
+            width: 100px;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <div class="masked"></div>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/css/data-uri-mask.html (0 => 184091)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/css/data-uri-mask.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/css/data-uri-mask.html	2015-05-11 13:31:21 UTC (rev 184091)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .masked {
+            height: 100px;
+            width: 100px;
+            background-color: green;
+            -webkit-mask-image: url(data:image/png;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICRAEAOw==);
+        }
+    </style>
+</head>
+<body>
+    <div class="masked"></div>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184090 => 184091)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-11 13:12:20 UTC (rev 184090)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-11 13:31:21 UTC (rev 184091)
@@ -1,3 +1,23 @@
+2015-04-20  Simon Fraser  <[email protected]>
+
+        REGRESSION (r177494): -webkit-mask-image: with data URI fails on non-local files
+        https://bugs.webkit.org/show_bug.cgi?id=141857
+
+        Reviewed by Dirk Schulze.
+        
+        r177494 regressed loading of data URIs in masks with remote content, triggering
+        a cross-domain error which occurs because the mask loading happened via a separate
+        SVGDocument.
+        
+        Fix by checking for data URIs at parsing time, which is what we used to do.
+
+        Test: http/tests/css/data-uri-mask.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseMaskImage):
+        * svg/SVGURIReference.h:
+        (WebCore::SVGURIReference::isExternalURIReference):
+
 2015-04-17  Bem Jones-Bey  <[email protected]>
 
         Large values for line-height cause integer overflow in RenderStyle::computedLineHeight

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/css/CSSParser.cpp (184090 => 184091)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/css/CSSParser.cpp	2015-05-11 13:12:20 UTC (rev 184090)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/css/CSSParser.cpp	2015-05-11 13:31:21 UTC (rev 184091)
@@ -9574,16 +9574,23 @@
 {
     outValue = nullptr;
     CSSParserValue* value = valueList.current();
-    if (value->id == CSSValueNone)
+    if (value->id == CSSValueNone) {
         outValue = WebKitCSSResourceValue::create(cssValuePool().createIdentifierValue(CSSValueNone));
-    else if (value->unit == CSSPrimitiveValue::CSS_URI)
-        outValue = WebKitCSSResourceValue::create(CSSPrimitiveValue::create(completeURL(value->string), CSSPrimitiveValue::CSS_URI));
-    else {
-        RefPtr<CSSValue> fillImageValue;
-        if (parseFillImage(valueList, fillImageValue))
-            outValue = WebKitCSSResourceValue::create(fillImageValue);
+        return outValue.get();
     }
 
+    RefPtr<CSSValue> resourceValue;
+    if (value->unit == CSSPrimitiveValue::CSS_URI) {
+        if (protocolIs(value->string, "data"))
+            parseFillImage(valueList, resourceValue);
+        else
+            resourceValue = CSSPrimitiveValue::create(completeURL(value->string), CSSPrimitiveValue::CSS_URI);
+    } else
+        parseFillImage(valueList, resourceValue);
+
+    if (resourceValue)
+        outValue = WebKitCSSResourceValue::create(resourceValue);
+
     return outValue.get();
 }
 

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/svg/SVGURIReference.h (184090 => 184091)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/svg/SVGURIReference.h	2015-05-11 13:12:20 UTC (rev 184090)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/svg/SVGURIReference.h	2015-05-11 13:31:21 UTC (rev 184091)
@@ -48,6 +48,7 @@
 
         // If the URI matches our documents URL, we're dealing with a local reference.
         URL url = ""
+        ASSERT(!url.protocolIsData());
         return !equalIgnoringFragmentIdentifier(url, document.url());
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to