OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/animation/CSSTextIndentInterpolationType.h" | 5 #include "core/animation/CSSTextIndentInterpolationType.h" |
6 | 6 |
7 #include "core/animation/LengthInterpolationFunctions.h" | 7 #include "core/animation/LengthInterpolationFunctions.h" |
| 8 #include "core/css/CSSIdentifierValue.h" |
8 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/css/CSSValueList.h" | 10 #include "core/css/CSSValueList.h" |
10 #include "core/css/resolver/StyleResolverState.h" | 11 #include "core/css/resolver/StyleResolverState.h" |
11 #include "core/style/ComputedStyle.h" | 12 #include "core/style/ComputedStyle.h" |
12 #include "wtf/PtrUtil.h" | 13 #include "wtf/PtrUtil.h" |
13 #include <memory> | 14 #include <memory> |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 namespace { | 18 namespace { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return createValue(parentStyle.textIndent(), mode, parentStyle.effectiveZoom
()); | 134 return createValue(parentStyle.textIndent(), mode, parentStyle.effectiveZoom
()); |
134 } | 135 } |
135 | 136 |
136 InterpolationValue CSSTextIndentInterpolationType::maybeConvertValue(const CSSVa
lue& value, const StyleResolverState&, ConversionCheckers&) const | 137 InterpolationValue CSSTextIndentInterpolationType::maybeConvertValue(const CSSVa
lue& value, const StyleResolverState&, ConversionCheckers&) const |
137 { | 138 { |
138 InterpolationValue length = nullptr; | 139 InterpolationValue length = nullptr; |
139 TextIndentLine line = ComputedStyle::initialTextIndentLine(); | 140 TextIndentLine line = ComputedStyle::initialTextIndentLine(); |
140 TextIndentType type = ComputedStyle::initialTextIndentType(); | 141 TextIndentType type = ComputedStyle::initialTextIndentType(); |
141 | 142 |
142 for (const auto& item : toCSSValueList(value)) { | 143 for (const auto& item : toCSSValueList(value)) { |
143 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item); | 144 if (item->isIdentifierValue() && toCSSIdentifierValue(*item).getValueID(
) == CSSValueEachLine) |
144 if (primitiveValue.getValueID() == CSSValueEachLine) | |
145 line = TextIndentEachLine; | 145 line = TextIndentEachLine; |
146 else if (primitiveValue.getValueID() == CSSValueHanging) | 146 else if (item->isIdentifierValue() && toCSSIdentifierValue(*item).getVal
ueID() == CSSValueHanging) |
147 type = TextIndentHanging; | 147 type = TextIndentHanging; |
148 else | 148 else |
149 length = LengthInterpolationFunctions::maybeConvertCSSValue(primitiv
eValue); | 149 length = LengthInterpolationFunctions::maybeConvertCSSValue(*item); |
150 } | 150 } |
151 DCHECK(length); | 151 DCHECK(length); |
152 | 152 |
153 return InterpolationValue( | 153 return InterpolationValue( |
154 std::move(length.interpolableValue), | 154 std::move(length.interpolableValue), |
155 CSSTextIndentNonInterpolableValue::create(length.nonInterpolableValue.re
lease(), IndentMode(line, type))); | 155 CSSTextIndentNonInterpolableValue::create(length.nonInterpolableValue.re
lease(), IndentMode(line, type))); |
156 } | 156 } |
157 | 157 |
158 InterpolationValue CSSTextIndentInterpolationType::maybeConvertUnderlyingValue(c
onst InterpolationEnvironment& environment) const | 158 InterpolationValue CSSTextIndentInterpolationType::maybeConvertUnderlyingValue(c
onst InterpolationEnvironment& environment) const |
159 { | 159 { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 cssTextIndentNonInterpolableValue.lengthNonInterpolableValue(), | 204 cssTextIndentNonInterpolableValue.lengthNonInterpolableValue(), |
205 environment.state().cssToLengthConversionData(), | 205 environment.state().cssToLengthConversionData(), |
206 ValueRangeAll)); | 206 ValueRangeAll)); |
207 | 207 |
208 const IndentMode& mode = cssTextIndentNonInterpolableValue.mode(); | 208 const IndentMode& mode = cssTextIndentNonInterpolableValue.mode(); |
209 style.setTextIndentLine(mode.line); | 209 style.setTextIndentLine(mode.line); |
210 style.setTextIndentType(mode.type); | 210 style.setTextIndentType(mode.type); |
211 } | 211 } |
212 | 212 |
213 } // namespace blink | 213 } // namespace blink |
OLD | NEW |