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 <memory> | 7 #include <memory> |
8 #include "core/animation/LengthInterpolationFunctions.h" | 8 #include "core/animation/LengthInterpolationFunctions.h" |
9 #include "core/css/CSSIdentifierValue.h" | 9 #include "core/css/CSSIdentifierValue.h" |
10 #include "core/css/CSSPrimitiveValue.h" | 10 #include "core/css/CSSPrimitiveValue.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 InterpolationValue length = nullptr; | 158 InterpolationValue length = nullptr; |
159 TextIndentLine line = ComputedStyle::InitialTextIndentLine(); | 159 TextIndentLine line = ComputedStyle::InitialTextIndentLine(); |
160 TextIndentType type = ComputedStyle::InitialTextIndentType(); | 160 TextIndentType type = ComputedStyle::InitialTextIndentType(); |
161 | 161 |
162 for (const auto& item : ToCSSValueList(value)) { | 162 for (const auto& item : ToCSSValueList(value)) { |
163 if (item->IsIdentifierValue() && | 163 if (item->IsIdentifierValue() && |
164 ToCSSIdentifierValue(*item).GetValueID() == CSSValueEachLine) | 164 ToCSSIdentifierValue(*item).GetValueID() == CSSValueEachLine) |
165 line = TextIndentLine::kEachLine; | 165 line = TextIndentLine::kEachLine; |
166 else if (item->IsIdentifierValue() && | 166 else if (item->IsIdentifierValue() && |
167 ToCSSIdentifierValue(*item).GetValueID() == CSSValueHanging) | 167 ToCSSIdentifierValue(*item).GetValueID() == CSSValueHanging) |
168 type = kTextIndentHanging; | 168 type = TextIndentType::kHanging; |
169 else | 169 else |
170 length = LengthInterpolationFunctions::MaybeConvertCSSValue(*item); | 170 length = LengthInterpolationFunctions::MaybeConvertCSSValue(*item); |
171 } | 171 } |
172 DCHECK(length); | 172 DCHECK(length); |
173 | 173 |
174 return InterpolationValue( | 174 return InterpolationValue( |
175 std::move(length.interpolable_value), | 175 std::move(length.interpolable_value), |
176 CSSTextIndentNonInterpolableValue::Create( | 176 CSSTextIndentNonInterpolableValue::Create( |
177 std::move(length.non_interpolable_value), IndentMode(line, type))); | 177 std::move(length.non_interpolable_value), IndentMode(line, type))); |
178 } | 178 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 interpolable_value, | 248 interpolable_value, |
249 css_text_indent_non_interpolable_value.LengthNonInterpolableValue(), | 249 css_text_indent_non_interpolable_value.LengthNonInterpolableValue(), |
250 state.CssToLengthConversionData(), kValueRangeAll)); | 250 state.CssToLengthConversionData(), kValueRangeAll)); |
251 | 251 |
252 const IndentMode& mode = css_text_indent_non_interpolable_value.Mode(); | 252 const IndentMode& mode = css_text_indent_non_interpolable_value.Mode(); |
253 style.SetTextIndentLine(mode.line); | 253 style.SetTextIndentLine(mode.line); |
254 style.SetTextIndentType(mode.type); | 254 style.SetTextIndentType(mode.type); |
255 } | 255 } |
256 | 256 |
257 } // namespace blink | 257 } // namespace blink |
OLD | NEW |