Title: [208620] trunk/Source/WebCore
Revision
208620
Author
hy...@apple.com
Date
2016-11-11 15:43:29 -0800 (Fri, 11 Nov 2016)

Log Message

[CSS Parser] Add support for paths as basic shapes.
https://bugs.webkit.org/show_bug.cgi?id=164661

Reviewed by Dean Jackson.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208619 => 208620)


--- trunk/Source/WebCore/ChangeLog	2016-11-11 23:42:47 UTC (rev 208619)
+++ trunk/Source/WebCore/ChangeLog	2016-11-11 23:43:29 UTC (rev 208620)
@@ -1,5 +1,16 @@
 2016-11-11  Dave Hyatt  <hy...@apple.com>
 
+        [CSS Parser] Add support for paths as basic shapes.
+        https://bugs.webkit.org/show_bug.cgi?id=164661
+
+        Reviewed by Dean Jackson.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeBasicShapePath):
+        (WebCore::consumeBasicShape):
+
+2016-11-11  Dave Hyatt  <hy...@apple.com>
+
         [CSS Parser] Support margin-box in shape parsing.
         https://bugs.webkit.org/show_bug.cgi?id=164658
 

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (208619 => 208620)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-11-11 23:42:47 UTC (rev 208619)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-11-11 23:43:29 UTC (rev 208620)
@@ -67,6 +67,7 @@
 #include "Rect.h"
 #include "RenderTheme.h"
 #include "RuntimeEnabledFeatures.h"
+#include "SVGPathByteStream.h"
 #include "SVGPathUtilities.h"
 #include "StylePropertyShorthand.h"
 #include "StylePropertyShorthandFunctions.h"
@@ -2192,6 +2193,28 @@
     return shape;
 }
 
+static RefPtr<CSSBasicShapePath> consumeBasicShapePath(CSSParserTokenRange& args)
+{
+    WindRule windRule = RULE_NONZERO;
+    if (identMatches<CSSValueEvenodd, CSSValueNonzero>(args.peek().id())) {
+        windRule = args.consumeIncludingWhitespace().id() == CSSValueEvenodd ? RULE_EVENODD : RULE_NONZERO;
+        if (!consumeCommaIncludingWhitespace(args))
+            return nullptr;
+    }
+
+    if (args.peek().type() != StringToken)
+        return nullptr;
+    
+    auto byteStream = std::make_unique<SVGPathByteStream>();
+    if (!buildSVGPathByteStreamFromString(args.consumeIncludingWhitespace().value().toString(), *byteStream, UnalteredParsing))
+        return nullptr;
+    
+    auto shape = CSSBasicShapePath::create(WTFMove(byteStream));
+    shape->setWindRule(windRule);
+    
+    return WTFMove(shape);
+}
+
 static void complete4Sides(RefPtr<CSSPrimitiveValue> side[4])
 {
     if (side[3])
@@ -2296,6 +2319,8 @@
         shape = consumeBasicShapePolygon(args, context);
     else if (id == CSSValueInset)
         shape = consumeBasicShapeInset(args, context);
+    else if (id == CSSValuePath)
+        shape = consumeBasicShapePath(args);
     if (!shape)
         return nullptr;
     range = rangeCopy;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to