Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp

Issue 2642033002: Implements CSSPropertyAPI for the d property (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
index 4b438c255c3c38532d465dcd251db3d9ab353d5b..a944dfc566383cbeeddf3c14e242b12d794c74f4 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -11,12 +11,15 @@
#include "core/css/CSSImageSetValue.h"
#include "core/css/CSSImageValue.h"
#include "core/css/CSSPaintValue.h"
+#include "core/css/CSSPathValue.h"
#include "core/css/CSSStringValue.h"
#include "core/css/CSSURIValue.h"
#include "core/css/CSSValuePair.h"
#include "core/css/StyleColor.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/frame/UseCounter.h"
+#include "core/svg/SVGPathByteStream.h"
+#include "core/svg/SVGPathUtilities.h"
#include "platform/RuntimeEnabledFeatures.h"
namespace blink {
@@ -532,6 +535,30 @@ CSSValue* consumeColor(CSSParserTokenRange& range,
return CSSColorValue::create(color);
}
+CSSValue* consumePath(CSSParserTokenRange& range) {
aazzam 2017/01/19 23:06:56 can you explain why you put consumePath in CSSProp
Eric Willigers 2017/01/19 23:24:46 consumePath is useful for 'd' and 'offset-path' '
+ if (range.peek().functionId() != CSSValuePath)
+ return nullptr;
+
+ CSSParserTokenRange functionRange = range;
+ CSSParserTokenRange functionArgs = consumeFunction(functionRange);
+
+ if (functionArgs.peek().type() != StringToken)
+ return nullptr;
+ String pathString =
+ functionArgs.consumeIncludingWhitespace().value().toString();
+
+ std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create();
+ if (buildByteStreamFromString(pathString, *byteStream) !=
+ SVGParseStatus::NoError ||
+ !functionArgs.atEnd())
+ return nullptr;
+
+ range = functionRange;
+ if (byteStream->isEmpty())
+ return CSSIdentifierValue::create(CSSValueNone);
+ return CSSPathValue::create(std::move(byteStream));
+}
+
static CSSValue* consumePositionComponent(CSSParserTokenRange& range,
CSSParserMode cssParserMode,
UnitlessQuirk unitless,

Powered by Google App Engine
This is Rietveld 408576698