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; |
} |