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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp

Issue 1885353004: Add ComputedStyle constructor and getter to InterpolationEnvironment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_transformInterpolationType
Patch Set: Rebased Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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/CSSLengthInterpolationType.h" 7 #include "core/animation/CSSLengthInterpolationType.h"
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSValueList.h" 9 #include "core/css/CSSValueList.h"
10 #include "core/css/resolver/StyleResolverState.h" 10 #include "core/css/resolver/StyleResolverState.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 ASSERT(length); 151 ASSERT(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 {
160 const ComputedStyle& style = *environment.state().style(); 160 const ComputedStyle& style = environment.style();
161 return createValue(style.textIndent(), IndentMode(style), style.effectiveZoo m()); 161 return createValue(style.textIndent(), IndentMode(style), style.effectiveZoo m());
162 } 162 }
163 163
164 PairwiseInterpolationValue CSSTextIndentInterpolationType::maybeMergeSingles(Int erpolationValue&& start, InterpolationValue&& end) const 164 PairwiseInterpolationValue CSSTextIndentInterpolationType::maybeMergeSingles(Int erpolationValue&& start, InterpolationValue&& end) const
165 { 165 {
166 CSSTextIndentNonInterpolableValue& startNonInterpolableValue = toCSSTextInde ntNonInterpolableValue(*start.nonInterpolableValue); 166 CSSTextIndentNonInterpolableValue& startNonInterpolableValue = toCSSTextInde ntNonInterpolableValue(*start.nonInterpolableValue);
167 CSSTextIndentNonInterpolableValue& endNonInterpolableValue = toCSSTextIndent NonInterpolableValue(*end.nonInterpolableValue); 167 CSSTextIndentNonInterpolableValue& endNonInterpolableValue = toCSSTextIndent NonInterpolableValue(*end.nonInterpolableValue);
168 168
169 if (startNonInterpolableValue.mode() != endNonInterpolableValue.mode()) 169 if (startNonInterpolableValue.mode() != endNonInterpolableValue.mode())
170 return nullptr; 170 return nullptr;
(...skipping 20 matching lines...) Expand all
191 underlyingValueOwner.mutableValue().interpolableValue, 191 underlyingValueOwner.mutableValue().interpolableValue,
192 toCSSTextIndentNonInterpolableValue(*underlyingValueOwner.mutableValue() .nonInterpolableValue).lengthNonInterpolableValue(), 192 toCSSTextIndentNonInterpolableValue(*underlyingValueOwner.mutableValue() .nonInterpolableValue).lengthNonInterpolableValue(),
193 underlyingFraction, 193 underlyingFraction,
194 *value.interpolableValue, 194 *value.interpolableValue,
195 nonInterpolableValue.lengthNonInterpolableValue()); 195 nonInterpolableValue.lengthNonInterpolableValue());
196 } 196 }
197 197
198 void CSSTextIndentInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const 198 void CSSTextIndentInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const
199 { 199 {
200 const CSSTextIndentNonInterpolableValue& cssTextIndentNonInterpolableValue = toCSSTextIndentNonInterpolableValue(*nonInterpolableValue); 200 const CSSTextIndentNonInterpolableValue& cssTextIndentNonInterpolableValue = toCSSTextIndentNonInterpolableValue(*nonInterpolableValue);
201 ComputedStyle& style = *environment.state().style(); 201 ComputedStyle& style = environment.style();
202 style.setTextIndent(CSSLengthInterpolationType::resolveInterpolableLength( 202 style.setTextIndent(CSSLengthInterpolationType::resolveInterpolableLength(
203 interpolableValue, 203 interpolableValue,
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698