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

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

Issue 1782833008: Add paint() function as valid CSS <image> type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: name->customCSSText Created 4 years, 9 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/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 6f247e4fabba6906dbe62ae6d183200e54bd65fe..8fff7333f39042da9fd0b18aee1d0ab9270304e1 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -17,6 +17,7 @@
#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSGradientValue.h"
#include "core/css/CSSImageSetValue.h"
+#include "core/css/CSSPaintValue.h"
#include "core/css/CSSPathValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSQuadValue.h"
@@ -1917,7 +1918,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumePositionY(CSSParserTokenRange& ra
return consumePositionLonghand<CSSValueTop, CSSValueBottom>(range, cssParserMode);
}
-static PassRefPtrWillBeRawPtr<CSSValue> consumePaint(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+static PassRefPtrWillBeRawPtr<CSSValue> consumePaintStroke(CSSParserTokenRange& range, CSSParserMode cssParserMode)
{
if (range.peek().id() == CSSValueNone)
return consumeIdent(range);
@@ -2451,6 +2452,17 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeCrossFade(CSSParserTokenRange& ar
return CSSCrossfadeValue::create(fromImageValue, toImageValue, percentage);
}
+static PassRefPtrWillBeRawPtr<CSSValue> consumePaint(CSSParserTokenRange& args, CSSParserContext context)
+{
+ ASSERT(RuntimeEnabledFeatures::cssPaintAPIEnabled());
+
+ RefPtrWillBeRawPtr<CSSCustomIdentValue> name = consumeCustomIdent(args);
+ if (!name)
+ return nullptr;
+
+ return CSSPaintValue::create(name.release());
+}
+
static PassRefPtrWillBeRawPtr<CSSValue> consumeGeneratedImage(CSSParserTokenRange& range, CSSParserContext context)
{
CSSValueID id = range.peek().functionId();
@@ -2491,6 +2503,8 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeGeneratedImage(CSSParserTokenRang
result = consumeDeprecatedRadialGradient(args, context.mode(), Repeating);
} else if (id == CSSValueWebkitCrossFade) {
result = consumeCrossFade(args, context);
+ } else if (id == CSSValuePaint) {
+ result = RuntimeEnabledFeatures::cssPaintAPIEnabled() ? consumePaint(args, context) : nullptr;
}
if (!result || !args.atEnd())
return nullptr;
@@ -2504,7 +2518,7 @@ static bool isGeneratedImage(CSSValueID id)
|| id == CSSValueRepeatingLinearGradient || id == CSSValueRepeatingRadialGradient
|| id == CSSValueWebkitLinearGradient || id == CSSValueWebkitRadialGradient
|| id == CSSValueWebkitRepeatingLinearGradient || id == CSSValueWebkitRepeatingRadialGradient
- || id == CSSValueWebkitGradient || id == CSSValueWebkitCrossFade;
+ || id == CSSValueWebkitGradient || id == CSSValueWebkitCrossFade || id == CSSValuePaint;
}
static PassRefPtrWillBeRawPtr<CSSValue> consumeImage(CSSParserTokenRange& range, CSSParserContext context)
@@ -3497,7 +3511,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeLength(m_range, m_context.mode(), ValueRangeAll);
case CSSPropertyFill:
case CSSPropertyStroke:
- return consumePaint(m_range, m_context.mode());
+ return consumePaintStroke(m_range, m_context.mode());
case CSSPropertyPaintOrder:
return consumePaintOrder(m_range);
case CSSPropertyMarkerStart:
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSValueKeywords.in ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698