Title: [209236] trunk/Source/WebCore
Revision
209236
Author
[email protected]
Date
2016-12-02 08:29:00 -0800 (Fri, 02 Dec 2016)

Log Message

[CSS Parser] Fix animation property parsing
https://bugs.webkit.org/show_bug.cgi?id=165305

Reviewed by Zalan Bujtas.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeAnimationPropertyList):
Match the old parser by only creating a list for animation properties if there
are two or more comma-separated values. Otherwise just return the CSSValue for
the singleton without creating a list.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209235 => 209236)


--- trunk/Source/WebCore/ChangeLog	2016-12-02 16:21:35 UTC (rev 209235)
+++ trunk/Source/WebCore/ChangeLog	2016-12-02 16:29:00 UTC (rev 209236)
@@ -1,3 +1,16 @@
+2016-12-02  Dave Hyatt  <[email protected]>
+
+        [CSS Parser] Fix animation property parsing
+        https://bugs.webkit.org/show_bug.cgi?id=165305
+
+        Reviewed by Zalan Bujtas.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeAnimationPropertyList):
+        Match the old parser by only creating a list for animation properties if there
+        are two or more comma-separated values. Otherwise just return the CSSValue for
+        the singleton without creating a list.
+
 2016-12-02  Gustavo Sverzut Barbieri  <[email protected]>
 
         Fix build break when disabling some features.

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (209235 => 209236)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-12-02 16:21:35 UTC (rev 209235)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-12-02 16:29:00 UTC (rev 209236)
@@ -1505,19 +1505,36 @@
     return true;
 }
 
-static RefPtr<CSSValueList> consumeAnimationPropertyList(CSSPropertyID property, CSSParserTokenRange& range, const CSSParserContext& context)
+static RefPtr<CSSValue> consumeAnimationPropertyList(CSSPropertyID property, CSSParserTokenRange& range, const CSSParserContext& context)
 {
-    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+    RefPtr<CSSValueList> list;
+    RefPtr<CSSValue> singleton;
     do {
-        RefPtr<CSSValue> value = consumeAnimationValue(property, range, context);
-        if (!value)
+        RefPtr<CSSValue> currentValue = consumeAnimationValue(property, range, context);
+        if (!currentValue)
             return nullptr;
-        list->append(value.releaseNonNull());
+        
+        if (singleton && !list) {
+            list = CSSValueList::createCommaSeparated();
+            list->append(singleton.releaseNonNull());
+        }
+        
+        if (list)
+            list->append(currentValue.releaseNonNull());
+        else
+            singleton = WTFMove(currentValue);
+        
     } while (consumeCommaIncludingWhitespace(range));
-    if (!isValidAnimationPropertyList(property, *list))
-        return nullptr;
-    ASSERT(list->length());
-    return list;
+
+    if (list) {
+        if (!isValidAnimationPropertyList(property, *list))
+            return nullptr;
+    
+        ASSERT(list->length());
+        return list;
+    }
+    
+    return singleton;
 }
 
 bool CSSPropertyParser::consumeAnimationShorthand(const StylePropertyShorthand& shorthand, bool important)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to