[CSS Parser] Support -webkit-named-image
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Oct 2016 19:38:58 +0000 (19:38 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Oct 2016 19:38:58 +0000 (19:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164235

Reviewed by Dean Jackson.

* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeWebkitNamedImage):
(WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
(WebCore::CSSPropertyParserHelpers::isGeneratedImage):

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

index 673331c..af32f06 100644 (file)
@@ -1,3 +1,16 @@
+2016-10-31  Dave Hyatt  <hyatt@apple.com>
+
+        [CSS Parser] Support -webkit-named-image
+        https://bugs.webkit.org/show_bug.cgi?id=164235
+
+        Reviewed by Dean Jackson.
+
+        * css/CSSValueKeywords.in:
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::consumeWebkitNamedImage):
+        (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
+        (WebCore::CSSPropertyParserHelpers::isGeneratedImage):
+
 2016-10-28  Brent Fulgham  <bfulgham@apple.com>
 
         Do a better job of protecting Frame objects in the context of JavaScript calls
index a810b79..6ef9c8d 100644 (file)
@@ -1156,7 +1156,6 @@ linear-gradient
 radial-gradient
 repeating-linear-gradient
 repeating-radial-gradient
-paint
 -webkit-canvas
 -webkit-cross-fade
 -webkit-gradient
@@ -1165,6 +1164,7 @@ paint
 -webkit-repeating-linear-gradient
 -webkit-repeating-radial-gradient
 -webkit-image-set
+-webkit-named-image
 
 // deprecated gradients
 from
index c99b00b..ca0c510 100644 (file)
@@ -36,6 +36,7 @@
 #include "CSSGradientValue.h"
 #include "CSSImageSetValue.h"
 #include "CSSImageValue.h"
+#include "CSSNamedImageValue.h"
 #include "CSSParserIdioms.h"
 #include "CSSValuePool.h"
 #include "Pair.h"
@@ -1075,6 +1076,16 @@ static RefPtr<CSSValue> consumeWebkitCanvas(CSSParserTokenRange& args)
         return nullptr;
     return CSSCanvasValue::create(canvasName);
 }
+
+static RefPtr<CSSValue> consumeWebkitNamedImage(CSSParserTokenRange& args)
+{
+    if (args.peek().type() != IdentToken)
+        return nullptr;
+    auto imageName = args.consumeIncludingWhitespace().value().toString();
+    if (!args.atEnd())
+        return nullptr;
+    return CSSNamedImageValue::create(imageName);
+}
     
 static RefPtr<CSSValue> consumeGeneratedImage(CSSParserTokenRange& range, CSSParserContext context)
 {
@@ -1104,6 +1115,8 @@ static RefPtr<CSSValue> consumeGeneratedImage(CSSParserTokenRange& range, CSSPar
         result = consumeCrossFade(args, context, id == CSSValueWebkitCrossFade);
     else if (id == CSSValueWebkitCanvas)
         result = consumeWebkitCanvas(args);
+    else if (id == CSSValueWebkitNamedImage)
+        result = consumeWebkitNamedImage(args);
 
     if (!result || !args.atEnd())
         return nullptr;
@@ -1148,7 +1161,7 @@ static bool isGeneratedImage(CSSValueID id)
         || id == CSSValueWebkitLinearGradient || id == CSSValueWebkitRadialGradient
         || id == CSSValueWebkitRepeatingLinearGradient || id == CSSValueWebkitRepeatingRadialGradient
         || id == CSSValueWebkitGradient || id == CSSValueWebkitCrossFade || id == CSSValueWebkitCanvas
-        || id == CSSValuePaint;
+        || id == CSSValueCrossFade || id == CSSValueWebkitNamedImage;
 }
 
 RefPtr<CSSValue> consumeImage(CSSParserTokenRange& range, CSSParserContext context, ConsumeGeneratedImage generatedImage)