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

Unified Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 224723023: Implements hanging property for text-indent from CSS3 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update description Created 6 years, 8 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: Source/core/css/resolver/StyleBuilderCustom.cpp
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index bd29c27edd87f9ead6f1bf9d90fb668c8540d157..6fba559c2b2c5e5825886a19725b88784dd03f89 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -551,12 +551,14 @@ void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState
{
state.style()->setTextIndent(state.parentStyle()->textIndent());
state.style()->setTextIndentLine(state.parentStyle()->textIndentLine());
+ state.style()->setTextIndentType(state.parentStyle()->textIndentType());
}
void StyleBuilderFunctions::applyInitialCSSPropertyTextIndent(StyleResolverState& state)
{
state.style()->setTextIndent(RenderStyle::initialTextIndent());
state.style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
+ state.style()->setTextIndentType(RenderStyle::initialTextIndentType());
}
void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState& state, CSSValue* value)
@@ -564,22 +566,25 @@ void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
if (!value->isValueList())
return;
- // [ <length> | <percentage> ] each-line
- // The order is guaranteed. See BisonCSSParser::parseTextIndent.
- // The second value, each-line is handled only when css3TextEnabled() returns true.
+ Length lengthOrPercentageValue;
+ TextIndentLine textIndentLineValue = RenderStyle::initialTextIndentLine();
+ TextIndentType textIndentTypeValue = RenderStyle::initialTextIndentType();
- CSSValueList* valueList = toCSSValueList(value);
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWithoutBoundsCheck(0));
- Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedConversion | PercentConversion>(state.cssToLengthConversionData());
- state.style()->setTextIndent(lengthOrPercentageValue);
+ for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(i.value());
+ if (!primitiveValue->getValueID())
+ lengthOrPercentageValue = primitiveValue->convertToLength<FixedConversion | PercentConversion>(state.cssToLengthConversionData());
+ else if (primitiveValue->getValueID() == CSSValueEachLine)
+ textIndentLineValue = TextIndentEachLine;
+ else if (primitiveValue->getValueID() == CSSValueHanging)
+ textIndentTypeValue = TextIndentHanging;
+ else
+ ASSERT_NOT_REACHED();
+ }
- ASSERT(valueList->length() <= 2);
- CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1));
- if (eachLineValue) {
- ASSERT(eachLineValue->getValueID() == CSSValueEachLine);
- state.style()->setTextIndentLine(TextIndentEachLine);
- } else
- state.style()->setTextIndentLine(TextIndentFirstLine);
+ state.style()->setTextIndent(lengthOrPercentageValue);
+ state.style()->setTextIndentLine(textIndentLineValue);
+ state.style()->setTextIndentType(textIndentTypeValue);
}
void StyleBuilderFunctions::applyInitialCSSPropertyTransformOrigin(StyleResolverState& state)
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/rendering/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698