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

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: . 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 8e09fb9eb4cbcd981eadb3519362be1faa25a83e..b4f6f41219e34f08d39807444986d71e2ab66bc7 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -18,6 +18,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"
@@ -2240,7 +2241,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);
@@ -2774,6 +2775,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();
@@ -2814,6 +2826,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;
@@ -2827,7 +2841,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)
@@ -3820,7 +3834,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:

Powered by Google App Engine
This is Rietveld 408576698