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

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

Issue 1429003004: Parse text-emphasis shorthand in CSSPropertyParser with CSSParserTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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 bcc8ea01daa40e95c16dd796380d56ca84596853..5cb63c4d2be4d7471aa98c2212fd7cc062566f2a 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1516,7 +1516,6 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionPath(CSSParserTokenRange& r
CSSValueID id = range.peek().id();
if (id == CSSValueNone)
return consumeIdent(range);
-
// FIXME: Add support for <url>, <basic-shape>, <geometry-box>.
if (range.peek().functionId() != CSSValuePath)
return nullptr;
@@ -1554,6 +1553,32 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionRotation(CSSParserTokenRang
return list.release();
}
+static PassRefPtrWillBeRawPtr<CSSValue> consumeTextEmphasisStyle(CSSParserTokenRange& range)
+{
+ CSSValueID id = range.peek().id();
+ if (id == CSSValueNone)
+ return consumeIdent(range);
+
+ if (RefPtrWillBeRawPtr<CSSValue> textEmphasisStyle = consumeString(range))
+ return textEmphasisStyle.release();
+
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = consumeIdent<CSSValueDot, CSSValueCircle, CSSValueDoubleCircle, CSSValueTriangle, CSSValueSesame>(range);
+ if (!fill)
+ fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range);
+ if (fill && shape) {
+ RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
+ parsedValues->append(fill.release());
+ parsedValues->append(shape.release());
+ return parsedValues.release();
+ }
+ if (fill)
+ return fill.release();
+ if (shape)
+ return shape.release();
+ return nullptr;
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty)
{
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -1656,6 +1681,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeColor(m_range, m_context);
case CSSPropertyWebkitTextFillColor:
case CSSPropertyWebkitTapHighlightColor:
+ case CSSPropertyWebkitTextEmphasisColor:
return consumeColor(m_range, m_context);
case CSSPropertyColor:
return consumeColor(m_range, m_context, inQuirksMode());
@@ -1679,6 +1705,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
case CSSPropertyMotionRotation:
ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
return consumeMotionRotation(m_range, m_context.mode());
+ case CSSPropertyWebkitTextEmphasisStyle:
+ return consumeTextEmphasisStyle(m_range);
default:
return nullptr;
}
@@ -2155,6 +2183,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im
case CSSPropertyMotion:
ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
return consumeShorthandGreedily(motionShorthand(), important);
+ case CSSPropertyWebkitTextEmphasis:
+ return consumeShorthandGreedily(webkitTextEmphasisShorthand(), important);
default:
m_currentShorthand = oldShorthand;
return false;

Powered by Google App Engine
This is Rietveld 408576698