Title: [255654] branches/safari-610.1.1-branch
Revision
255654
Author
[email protected]
Date
2020-02-03 19:10:17 -0800 (Mon, 03 Feb 2020)

Log Message

Cherry-pick r255420. rdar://problem/58858225

    REGRESSION (r254406): Gmail.com star/favorite icons are not rendering
    https://bugs.webkit.org/show_bug.cgi?id=206909

    Reviewed by Simon Fraser.

    Source/WebCore:

    Make image-set parsing more conservative, for backwards compatibility:
    - Differentiate between image-set and -webkit-image-set when parsing, -webkit-image-set maintains old behavior.
    - Don't allow empty urls when using raw strings, e.g. image-set('' 1x) is invalid.

    Tests updated: fast/css/image-set-parsing.html.

    * css/parser/CSSPropertyParserHelpers.cpp:
    (WebCore::CSSPropertyParserHelpers::consumeImageSet):
    (WebCore::CSSPropertyParserHelpers::consumeImage):

    LayoutTests:

    Added empty URLs and new syntax with prefixed image-set to invalid tests.
    Modified valid image-set parsing test to separate prefixed/non-prefixed.

    * fast/css/image-set-parsing-generated.html:
    * fast/css/image-set-parsing-invalid-expected.txt:
    * fast/css/image-set-parsing-invalid.html:
    * fast/css/image-set-parsing.html:

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

Modified Paths

Diff

Modified: branches/safari-610.1.1-branch/LayoutTests/ChangeLog (255653 => 255654)


--- branches/safari-610.1.1-branch/LayoutTests/ChangeLog	2020-02-04 03:10:12 UTC (rev 255653)
+++ branches/safari-610.1.1-branch/LayoutTests/ChangeLog	2020-02-04 03:10:17 UTC (rev 255654)
@@ -1,5 +1,54 @@
 2020-02-03  Alan Coon  <[email protected]>
 
+        Cherry-pick r255420. rdar://problem/58858225
+
+    REGRESSION (r254406): Gmail.com star/favorite icons are not rendering
+    https://bugs.webkit.org/show_bug.cgi?id=206909
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Make image-set parsing more conservative, for backwards compatibility:
+    - Differentiate between image-set and -webkit-image-set when parsing, -webkit-image-set maintains old behavior.
+    - Don't allow empty urls when using raw strings, e.g. image-set('' 1x) is invalid.
+    
+    Tests updated: fast/css/image-set-parsing.html.
+    
+    * css/parser/CSSPropertyParserHelpers.cpp:
+    (WebCore::CSSPropertyParserHelpers::consumeImageSet):
+    (WebCore::CSSPropertyParserHelpers::consumeImage):
+    
+    LayoutTests:
+    
+    Added empty URLs and new syntax with prefixed image-set to invalid tests.
+    Modified valid image-set parsing test to separate prefixed/non-prefixed.
+    
+    * fast/css/image-set-parsing-generated.html:
+    * fast/css/image-set-parsing-invalid-expected.txt:
+    * fast/css/image-set-parsing-invalid.html:
+    * fast/css/image-set-parsing.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-30  Noam Rosenthal  <[email protected]>
+
+            REGRESSION (r254406): Gmail.com star/favorite icons are not rendering
+            https://bugs.webkit.org/show_bug.cgi?id=206909
+
+            Reviewed by Simon Fraser.
+
+            Added empty URLs and new syntax with prefixed image-set to invalid tests.
+            Modified valid image-set parsing test to separate prefixed/non-prefixed.
+
+            * fast/css/image-set-parsing-generated.html:
+            * fast/css/image-set-parsing-invalid-expected.txt:
+            * fast/css/image-set-parsing-invalid.html:
+            * fast/css/image-set-parsing.html:
+
+2020-02-03  Alan Coon  <[email protected]>
+
         Cherry-pick r255396. rdar://problem/58675608
 
     Web Inspector: add instrumentation for showing existing Web Animations

Modified: branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-generated.html (255653 => 255654)


--- branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-generated.html	2020-02-04 03:10:12 UTC (rev 255653)
+++ branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-generated.html	2020-02-04 03:10:17 UTC (rev 255654)
@@ -72,7 +72,7 @@
 }
 
 testImageSetRule("Single value for background-image with gradient",
-                "background-image",
+                "background-image", 
                 "linear-gradient(green, white) 1x", 2,
                 ["linear-gradient(green, white)", "1dppx"]);
 testImageSetRule("Single value for content with gradient",

Modified: branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-invalid-expected.txt (255653 => 255654)


--- branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-invalid-expected.txt	2020-02-04 03:10:12 UTC (rev 255653)
+++ branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-invalid-expected.txt	2020-02-04 03:10:17 UTC (rev 255654)
@@ -10,6 +10,18 @@
 No x : url('#a') 1
 PASS cssRule is null
 
+No raw string URLs with prefixed image-set : 'image.png' 1x
+PASS cssRule is null
+
+Combination of valid and invalid with prefixed image-set : 'image.png' 1x, url(image.png) 2x
+PASS cssRule is null
+
+Combination of valid and invalid with unprefixed image-set : '' 1x, url(image.png) 2x
+FAIL cssRule should be null. Was [object CSSValueList].
+
+No gradients with prefixed image-set : linear-gradient(black, white) 1x
+PASS cssRule is null
+
 No comma : url('#a') 1x url('#b') 2x
 PASS cssRule is null
 

Modified: branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-invalid.html (255653 => 255654)


--- branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-invalid.html	2020-02-04 03:10:12 UTC (rev 255653)
+++ branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing-invalid.html	2020-02-04 03:10:17 UTC (rev 255654)
@@ -12,13 +12,13 @@
 // These have to be global for the test helpers to see them.
 var cssRule;
 
-function testInvalidImageSet(description, property, rule)
+function testInvalidImageSet(description, property, rule, attribute = "image-set")
 {
     debug("");
     debug(description + " : " + rule);
 
     var div = document.createElement("div");
-    div.setAttribute("style", property + ": -webkit-image-set(" + rule + ")");
+    div.setAttribute("style", property + ": " + attribute + "(" + rule + ")");
     document.body.appendChild(div);
 
     cssRule = div.style.getPropertyCSSValue(property);
@@ -29,6 +29,10 @@
 
 testInvalidImageSet("Too many url parameters", "background-image", "url(#a #b)");
 testInvalidImageSet("No x", "background-image", "url('#a') 1");
+testInvalidImageSet("No raw string URLs with prefixed image-set", "background-image", "'image.png' 1x", "-webkit-image-set");
+testInvalidImageSet("Combination of valid and invalid with prefixed image-set", "background-image", "'image.png' 1x, url(image.png) 2x", "-webkit-image-set");
+testInvalidImageSet("Combination of valid and invalid with unprefixed image-set", "background-image", "'' 1x, url(image.png) 2x");
+testInvalidImageSet("No gradients with prefixed image-set", "background-image", "linear-gradient(black, white) 1x", "-webkit-image-set");
 testInvalidImageSet("No comma", "background-image", "url('#a') 1x url('#b') 2x");
 testInvalidImageSet("Too many scale factor parameters", "background-image", "url('#a') 1x 2x");
 testInvalidImageSet("Scale factor is 0", "background-image", "url('#a') 0x");

Modified: branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing.html (255653 => 255654)


--- branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing.html	2020-02-04 03:10:12 UTC (rev 255653)
+++ branches/safari-610.1.1-branch/LayoutTests/fast/css/image-set-parsing.html	2020-02-04 03:10:17 UTC (rev 255654)
@@ -31,13 +31,13 @@
 // These have to be global for the test helpers to see them.
 var imageSetRule, subRule;
 
-function testImageSetRule(description, property, rule, expectedLength, expectedTexts)
+function testImageSetRule(description, property, rule, expectedLength, expectedTexts, propName = "-webkit-image-set")
 {
     debug("");
     debug(description + " : " + rule);
 
     var div = document.createElement("div");
-    div.setAttribute("style", property + ": -webkit-image-set(" + rule + ")");
+    div.setAttribute("style", property + ": " + propName + "(" + rule + ")");
     document.body.appendChild(div);
 
     imageSetRule = div.style.getPropertyCSSValue(property);
@@ -84,17 +84,17 @@
 testImageSetRule("Single value for background-image without url() function",
                 "background-image",
                 "'#a' 1x", 2,
-                ["a", "1dppx"]);
+                ["a", "1dppx"], "image-set");
 
 testImageSetRule("Multiple values for background-image without url() function",
                 "background-image",
                 "'#a' 1x, '#b' 2x", 4,
-                ["a", "1dppx", "b", "2dppx"]);
+                ["a", "1dppx", "b", "2dppx"], "image-set");
 
 testImageSetRule("Mix values with and without url() function",
                 "background-image",
                 "'#a' 1x, url('#b') 2x", 4,
-                ["a", "1dppx", "b", "2dppx"]);
+                ["a", "1dppx", "b", "2dppx"], "image-set");
 
 testImageSetRule("Multiple values for background-image, out of order",
                 "background-image",

Modified: branches/safari-610.1.1-branch/Source/WebCore/ChangeLog (255653 => 255654)


--- branches/safari-610.1.1-branch/Source/WebCore/ChangeLog	2020-02-04 03:10:12 UTC (rev 255653)
+++ branches/safari-610.1.1-branch/Source/WebCore/ChangeLog	2020-02-04 03:10:17 UTC (rev 255654)
@@ -1,5 +1,56 @@
 2020-02-03  Alan Coon  <[email protected]>
 
+        Cherry-pick r255420. rdar://problem/58858225
+
+    REGRESSION (r254406): Gmail.com star/favorite icons are not rendering
+    https://bugs.webkit.org/show_bug.cgi?id=206909
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Make image-set parsing more conservative, for backwards compatibility:
+    - Differentiate between image-set and -webkit-image-set when parsing, -webkit-image-set maintains old behavior.
+    - Don't allow empty urls when using raw strings, e.g. image-set('' 1x) is invalid.
+    
+    Tests updated: fast/css/image-set-parsing.html.
+    
+    * css/parser/CSSPropertyParserHelpers.cpp:
+    (WebCore::CSSPropertyParserHelpers::consumeImageSet):
+    (WebCore::CSSPropertyParserHelpers::consumeImage):
+    
+    LayoutTests:
+    
+    Added empty URLs and new syntax with prefixed image-set to invalid tests.
+    Modified valid image-set parsing test to separate prefixed/non-prefixed.
+    
+    * fast/css/image-set-parsing-generated.html:
+    * fast/css/image-set-parsing-invalid-expected.txt:
+    * fast/css/image-set-parsing-invalid.html:
+    * fast/css/image-set-parsing.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-30  Noam Rosenthal  <[email protected]>
+
+            REGRESSION (r254406): Gmail.com star/favorite icons are not rendering
+            https://bugs.webkit.org/show_bug.cgi?id=206909
+
+            Reviewed by Simon Fraser.
+
+            Make image-set parsing more conservative, for backwards compatibility:
+            - Differentiate between image-set and -webkit-image-set when parsing, -webkit-image-set maintains old behavior.
+            - Don't allow empty urls when using raw strings, e.g. image-set('' 1x) is invalid.
+
+            Tests updated: fast/css/image-set-parsing.html.
+
+            * css/parser/CSSPropertyParserHelpers.cpp:
+            (WebCore::CSSPropertyParserHelpers::consumeImageSet):
+            (WebCore::CSSPropertyParserHelpers::consumeImage):
+
+2020-02-03  Alan Coon  <[email protected]>
+
         Cherry-pick r255396. rdar://problem/58675608
 
     Web Inspector: add instrumentation for showing existing Web Animations

Modified: branches/safari-610.1.1-branch/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (255653 => 255654)


--- branches/safari-610.1.1-branch/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2020-02-04 03:10:12 UTC (rev 255653)
+++ branches/safari-610.1.1-branch/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2020-02-04 03:10:17 UTC (rev 255654)
@@ -1482,13 +1482,13 @@
     return result;
 }
 
-static RefPtr<CSSValue> consumeImageSet(CSSParserTokenRange& range, const CSSParserContext& context, OptionSet<AllowedImageType> allowedImageType)
+static RefPtr<CSSValue> consumeImageSet(CSSParserTokenRange& range, const CSSParserContext& context, OptionSet<AllowedImageType> allowedImageTypes)
 {
     CSSParserTokenRange rangeCopy = range;
     CSSParserTokenRange args = consumeFunction(rangeCopy);
     RefPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create();
     do {
-        auto image = consumeImage(args, context, (allowedImageType | AllowedImageType::RawStringAsURL) - AllowedImageType::ImageSet);
+        auto image = consumeImage(args, context, allowedImageTypes);
         if (!image)
             return nullptr;
 
@@ -1701,20 +1701,27 @@
     return CSSShadowValue::create(WTFMove(horizontalOffset), WTFMove(verticalOffset), WTFMove(blurRadius), WTFMove(spreadDistance), WTFMove(style), WTFMove(color));
 }
 
-RefPtr<CSSValue> consumeImage(CSSParserTokenRange& range, CSSParserContext context, OptionSet<AllowedImageType> AllowedImageType)
+RefPtr<CSSValue> consumeImage(CSSParserTokenRange& range, CSSParserContext context, OptionSet<AllowedImageType> allowedImageTypes)
 {
-    if ((range.peek().type() == StringToken) && (AllowedImageType & AllowedImageType::RawStringAsURL))
-        return CSSImageValue::create(completeURL(context, range.consumeIncludingWhitespace().value().toAtomString()), context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
+    if ((range.peek().type() == StringToken) && (allowedImageTypes.contains(AllowedImageType::RawStringAsURL))) {
+        auto urlStringView = range.consumeIncludingWhitespace().value();
+        return CSSImageValue::create(completeURL(context, urlStringView.toAtomString()), context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
+    }
 
     if (range.peek().type() == FunctionToken) {
-        CSSValueID id = range.peek().functionId();
-        if ((AllowedImageType & AllowedImageType::ImageSet) && (id == CSSValueWebkitImageSet || id == CSSValueImageSet))
-            return consumeImageSet(range, context, AllowedImageType);
-        if ((AllowedImageType & AllowedImageType::GeneratedImage) && isGeneratedImage(id))
+        CSSValueID functionId = range.peek().functionId();
+        if ((allowedImageTypes.contains(AllowedImageType::GeneratedImage)) && isGeneratedImage(functionId))
             return consumeGeneratedImage(range, context);
+
+        if (allowedImageTypes.contains(AllowedImageType::ImageSet)) {
+            if (functionId == CSSValueImageSet)
+                return consumeImageSet(range, context, (allowedImageTypes | AllowedImageType::RawStringAsURL) - AllowedImageType::ImageSet);
+            if (functionId == CSSValueWebkitImageSet)
+                return consumeImageSet(range, context, AllowedImageType::URLFunction);
+        }
     }
 
-    if (AllowedImageType & AllowedImageType::URLFunction) {
+    if (allowedImageTypes.contains(AllowedImageType::URLFunction)) {
         auto uri = consumeUrlAsStringView(range);
         if (!uri.isNull())
             return CSSImageValue::create(completeURL(context, uri.toAtomString()), context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to