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

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

Issue 1406433002: Move text-indent property into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 40ef3b88d61ac53915a02cbddf325afe72601d35..ec18b38ba774d3dd061d28ebb93108ada9c9a871 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -663,6 +663,48 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeCounter(CSSParserTokenRange& rang
return list.release();
}
+static PassRefPtrWillBeRawPtr<CSSValue> consumeTextIndent(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+
+ bool hasLengthOrPercentage = false;
+ bool hasEachLine = false;
+ bool hasHanging = false;
+
+ do {
+ // <length> | <percentage> | inherit when RuntimeEnabledFeatures::css3TextEnabled() returns false
Timothy Loh 2015/10/13 05:32:09 Probably better at the top of the function. Maybe
+ if (!hasLengthOrPercentage) {
+ if (RefPtrWillBeRawPtr<CSSValue> textIndent = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Allow)) {
+ list->append(textIndent.release());
+ hasLengthOrPercentage = true;
+ continue;
+ }
+ }
+
+ // [ <length> | <percentage> ] && hanging? && each-line? | inherit
+ // when RuntimeEnabledFeatures::css3TextEnabled() returns true.
+ if (RuntimeEnabledFeatures::css3TextEnabled()) {
+ CSSValueID id = range.peek().id();
+ if (!hasEachLine && id == CSSValueEachLine) {
+ list->append(consumeIdent(range));
+ hasEachLine = true;
+ continue;
+ }
+ if (!hasHanging && id == CSSValueHanging) {
+ list->append(consumeIdent(range));
+ hasHanging = true;
+ continue;
+ }
+ }
+ return nullptr;
+ } while (!range.atEnd());
+
+ if (!hasLengthOrPercentage)
+ return nullptr;
+
+ return list.release();
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID propId)
{
m_range.consumeWhitespace();
@@ -702,6 +744,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
case CSSPropertyCounterIncrement:
case CSSPropertyCounterReset:
return consumeCounter(m_range, m_context.mode(), propId == CSSPropertyCounterIncrement ? 1 : 0);
+ case CSSPropertyTextIndent:
+ return consumeTextIndent(m_range, m_context.mode());
default:
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698