Title: [208029] trunk/Source/WebCore
Revision
208029
Author
[email protected]
Date
2016-10-27 21:11:18 -0700 (Thu, 27 Oct 2016)

Log Message

[CSS Parser] Add support for a reference box to -webkit-clip-path
https://bugs.webkit.org/show_bug.cgi?id=164107

Reviewed by Simon Fraser.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeBasicShape):
(WebCore::consumeBasicShapeOrBox):
(WebCore::consumeWebkitClipPath):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208028 => 208029)


--- trunk/Source/WebCore/ChangeLog	2016-10-28 03:56:50 UTC (rev 208028)
+++ trunk/Source/WebCore/ChangeLog	2016-10-28 04:11:18 UTC (rev 208029)
@@ -1,3 +1,15 @@
+2016-10-27  Dave Hyatt  <[email protected]>
+
+        [CSS Parser] Add support for a reference box to -webkit-clip-path
+        https://bugs.webkit.org/show_bug.cgi?id=164107
+
+        Reviewed by Simon Fraser.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeBasicShape):
+        (WebCore::consumeBasicShapeOrBox):
+        (WebCore::consumeWebkitClipPath):
+
 2016-10-27  Yusuke Suzuki  <[email protected]>
 
         [DOM] Add JSEventType

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (208028 => 208029)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-10-28 03:56:50 UTC (rev 208028)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-10-28 04:11:18 UTC (rev 208029)
@@ -2203,7 +2203,7 @@
         shape = consumeBasicShapePolygon(args, context);
     else if (id == CSSValueInset)
         shape = consumeBasicShapeInset(args, context);
-    if (!shape || !args.atEnd())
+    if (!shape)
         return nullptr;
     range = rangeCopy;
     
@@ -2210,6 +2210,31 @@
     return CSSValuePool::singleton().createValue(shape.releaseNonNull());
 }
 
+static RefPtr<CSSValue> consumeBasicShapeOrBox(CSSParserTokenRange& range, const CSSParserContext& context)
+{
+    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    bool shapeFound = false;
+    bool boxFound = false;
+    while (!range.atEnd() && !(shapeFound && boxFound)) {
+        RefPtr<CSSValue> componentValue;
+        if (range.peek().type() == FunctionToken && !shapeFound) {
+            componentValue = consumeBasicShape(range, context);
+            shapeFound = true;
+        } else if (range.peek().type() == IdentToken && !boxFound) {
+            componentValue = consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, CSSValueFill, CSSValueStroke, CSSValueViewBox>(range);
+            boxFound = true;
+        }
+        if (!componentValue)
+            return nullptr;
+        list->append(componentValue.releaseNonNull());
+    }
+    
+    if (!range.atEnd())
+        return nullptr;
+    
+    return list;
+}
+    
 static RefPtr<CSSValue> consumeWebkitClipPath(CSSParserTokenRange& range, const CSSParserContext& context)
 {
     if (range.peek().id() == CSSValueNone)
@@ -2216,7 +2241,7 @@
         return consumeIdent(range);
     if (RefPtr<CSSPrimitiveValue> url = ""
         return url;
-    return consumeBasicShape(range, context);
+    return consumeBasicShapeOrBox(range, context);
 }
 
 static RefPtr<CSSValue> consumeShapeOutside(CSSParserTokenRange& range, const CSSParserContext& context)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to