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/CSSClipInterpolationType.h" | 5 #include "core/animation/CSSClipInterpolationType.h" |
6 | 6 |
7 #include "core/animation/CSSLengthInterpolationType.h" | 7 #include "core/animation/CSSLengthInterpolationType.h" |
8 #include "core/css/CSSQuadValue.h" | 8 #include "core/css/CSSQuadValue.h" |
9 #include "core/css/resolver/StyleResolverState.h" | 9 #include "core/css/resolver/StyleResolverState.h" |
10 #include "wtf/PtrUtil.h" | 10 #include "wtf/PtrUtil.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ClipAutos autos( | 216 ClipAutos autos( |
217 isCSSAuto(*quad.top()), | 217 isCSSAuto(*quad.top()), |
218 isCSSAuto(*quad.right()), | 218 isCSSAuto(*quad.right()), |
219 isCSSAuto(*quad.bottom()), | 219 isCSSAuto(*quad.bottom()), |
220 isCSSAuto(*quad.left())); | 220 isCSSAuto(*quad.left())); |
221 return InterpolationValue(std::move(list), CSSClipNonInterpolableValue::crea
te(autos)); | 221 return InterpolationValue(std::move(list), CSSClipNonInterpolableValue::crea
te(autos)); |
222 } | 222 } |
223 | 223 |
224 InterpolationValue CSSClipInterpolationType::maybeConvertUnderlyingValue(const I
nterpolationEnvironment& environment) const | 224 InterpolationValue CSSClipInterpolationType::maybeConvertUnderlyingValue(const I
nterpolationEnvironment& environment) const |
225 { | 225 { |
226 if (environment.state().style()->hasAutoClip()) | 226 const ComputedStyle& style = environment.style(); |
| 227 if (style.hasAutoClip()) |
227 return nullptr; | 228 return nullptr; |
228 return createClipValue(environment.state().style()->clip(), environment.stat
e().style()->effectiveZoom()); | 229 return createClipValue(style.clip(), style.effectiveZoom()); |
229 } | 230 } |
230 | 231 |
231 PairwiseInterpolationValue CSSClipInterpolationType::maybeMergeSingles(Interpola
tionValue&& start, InterpolationValue&& end) const | 232 PairwiseInterpolationValue CSSClipInterpolationType::maybeMergeSingles(Interpola
tionValue&& start, InterpolationValue&& end) const |
232 { | 233 { |
233 const ClipAutos& startAutos = toCSSClipNonInterpolableValue(*start.nonInterp
olableValue).clipAutos(); | 234 const ClipAutos& startAutos = toCSSClipNonInterpolableValue(*start.nonInterp
olableValue).clipAutos(); |
234 const ClipAutos& endAutos = toCSSClipNonInterpolableValue(*end.nonInterpolab
leValue).clipAutos(); | 235 const ClipAutos& endAutos = toCSSClipNonInterpolableValue(*end.nonInterpolab
leValue).clipAutos(); |
235 if (startAutos != endAutos) | 236 if (startAutos != endAutos) |
236 return nullptr; | 237 return nullptr; |
237 return PairwiseInterpolationValue(std::move(start.interpolableValue), std::m
ove(end.interpolableValue), start.nonInterpolableValue.release()); | 238 return PairwiseInterpolationValue(std::move(start.interpolableValue), std::m
ove(end.interpolableValue), start.nonInterpolableValue.release()); |
238 } | 239 } |
(...skipping 11 matching lines...) Expand all Loading... |
250 void CSSClipInterpolationType::apply(const InterpolableValue& interpolableValue,
const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& env
ironment) const | 251 void CSSClipInterpolationType::apply(const InterpolableValue& interpolableValue,
const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& env
ironment) const |
251 { | 252 { |
252 const ClipAutos& autos = toCSSClipNonInterpolableValue(nonInterpolableValue)
->clipAutos(); | 253 const ClipAutos& autos = toCSSClipNonInterpolableValue(nonInterpolableValue)
->clipAutos(); |
253 const InterpolableList& list = toInterpolableList(interpolableValue); | 254 const InterpolableList& list = toInterpolableList(interpolableValue); |
254 const auto& convertIndex = [&list, &environment](bool isAuto, size_t index) | 255 const auto& convertIndex = [&list, &environment](bool isAuto, size_t index) |
255 { | 256 { |
256 if (isAuto) | 257 if (isAuto) |
257 return Length(Auto); | 258 return Length(Auto); |
258 return CSSLengthInterpolationType::resolveInterpolableLength(*list.get(i
ndex), nullptr, environment.state().cssToLengthConversionData(), ValueRangeAll); | 259 return CSSLengthInterpolationType::resolveInterpolableLength(*list.get(i
ndex), nullptr, environment.state().cssToLengthConversionData(), ValueRangeAll); |
259 }; | 260 }; |
260 environment.state().style()->setClip(LengthBox( | 261 environment.style().setClip(LengthBox( |
261 convertIndex(autos.isTopAuto, ClipTop), | 262 convertIndex(autos.isTopAuto, ClipTop), |
262 convertIndex(autos.isRightAuto, ClipRight), | 263 convertIndex(autos.isRightAuto, ClipRight), |
263 convertIndex(autos.isBottomAuto, ClipBottom), | 264 convertIndex(autos.isBottomAuto, ClipBottom), |
264 convertIndex(autos.isLeftAuto, ClipLeft))); | 265 convertIndex(autos.isLeftAuto, ClipLeft))); |
265 } | 266 } |
266 | 267 |
267 } // namespace blink | 268 } // namespace blink |
OLD | NEW |