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

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: Patch for landing 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 9eaca7dc46d3c8d2918955511098c9b926a94aa0..74823b2295cd23ee6631267c0b8f68aa2298ac43 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -713,6 +713,47 @@ static PassRefPtrWillBeRawPtr<CSSValueList> consumeSize(CSSParserTokenRange& ran
return result.release();
}
+static PassRefPtrWillBeRawPtr<CSSValue> consumeTextIndent(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+ // [ <length> | <percentage> ] && hanging? && each-line?
+ // Keywords only allowed when css3Text is enabled.
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+
+ bool hasLengthOrPercentage = false;
+ bool hasEachLine = false;
+ bool hasHanging = false;
+
+ do {
+ if (!hasLengthOrPercentage) {
+ if (RefPtrWillBeRawPtr<CSSValue> textIndent = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Allow)) {
+ list->append(textIndent.release());
+ hasLengthOrPercentage = true;
+ continue;
+ }
+ }
+
+ 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();
@@ -754,6 +795,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeCounter(m_range, m_context.mode(), propId == CSSPropertyCounterIncrement ? 1 : 0);
case CSSPropertySize:
return consumeSize(m_range, m_context.mode());
+ case CSSPropertyTextIndent:
+ return consumeTextIndent(m_range, m_context.mode());
default:
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698