| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef LengthBoxStyleInterpolation_h | 5 #ifndef LengthBoxStyleInterpolation_h |
| 6 #define LengthBoxStyleInterpolation_h | 6 #define LengthBoxStyleInterpolation_h |
| 7 | 7 |
| 8 #include "core/animation/LengthStyleInterpolation.h" | 8 #include "core/animation/LengthStyleInterpolation.h" |
| 9 #include "core/css/CSSBorderImageSliceValue.h" | 9 #include "core/css/CSSBorderImageSliceValue.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class LengthBoxStyleInterpolation : public StyleInterpolation { | 13 class LengthBoxStyleInterpolation : public StyleInterpolation { |
| 14 public: | 14 public: |
| 15 static PassRefPtrWillBeRawPtr<LengthBoxStyleInterpolation> create(const CSSV
alue& start, const CSSValue& end, CSSPropertyID id) | 15 static PassRefPtrWillBeRawPtr<LengthBoxStyleInterpolation> maybeCreateFrom(c
onst CSSValue& start, const CSSValue& end, CSSPropertyID id) |
| 16 { | 16 { |
| 17 return adoptRefWillBeNoop(new LengthBoxStyleInterpolation(lengthBoxtoInt
erpolableValue(start), lengthBoxtoInterpolableValue(end), id, false)); | 17 if (start.isPrimitiveValue() && toCSSPrimitiveValue(start).isRect() |
| 18 && end.isPrimitiveValue() && toCSSPrimitiveValue(end).isRect()) |
| 19 return adoptRefWillBeNoop(new LengthBoxStyleInterpolation(lengthBoxt
oInterpolableValue(start), lengthBoxtoInterpolableValue(end), id, false)); |
| 20 |
| 21 if (start.isBorderImageSliceValue() && toCSSBorderImageSliceValue(start)
.slices() |
| 22 && end.isBorderImageSliceValue() && toCSSBorderImageSliceValue(end).
slices() |
| 23 && toCSSBorderImageSliceValue(start).m_fill == toCSSBorderImageSlice
Value(end).m_fill) |
| 24 return adoptRefWillBeNoop(new LengthBoxStyleInterpolation(borderImag
eSlicetoInterpolableValue(start), borderImageSlicetoInterpolableValue(end), id,
toCSSBorderImageSliceValue(start).m_fill)); |
| 25 return nullptr; |
| 18 } | 26 } |
| 19 | 27 |
| 20 static PassRefPtrWillBeRawPtr<LengthBoxStyleInterpolation> createFromBorderI
mageSlice(CSSValue& start, CSSValue& end, CSSPropertyID id) | 28 static bool isAutoValue(const CSSValue&); |
| 21 { | |
| 22 return adoptRefWillBeNoop(new LengthBoxStyleInterpolation(borderImageSli
cetoInterpolableValue(start), borderImageSlicetoInterpolableValue(end), id, toCS
SBorderImageSliceValue(start).m_fill)); | |
| 23 } | |
| 24 | |
| 25 static bool canCreateFrom(const CSSValue&); | |
| 26 | |
| 27 static bool matchingFill(CSSValue&, CSSValue&); | |
| 28 static bool canCreateFromBorderImageSlice(CSSValue&); | |
| 29 | 29 |
| 30 virtual void apply(StyleResolverState&) const override; | 30 virtual void apply(StyleResolverState&) const override; |
| 31 virtual void trace(Visitor*) override; | 31 virtual void trace(Visitor*) override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 LengthBoxStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start,
PassOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id, bool fill) | 34 LengthBoxStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start,
PassOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id, bool fill) |
| 35 : StyleInterpolation(start, end, id) | 35 : StyleInterpolation(start, end, id) |
| 36 , m_fill(fill) | 36 , m_fill(fill) |
| 37 { } | 37 { } |
| 38 | 38 |
| 39 static PassOwnPtrWillBeRawPtr<InterpolableValue> lengthBoxtoInterpolableValu
e(const CSSValue&); | 39 static PassOwnPtrWillBeRawPtr<InterpolableValue> lengthBoxtoInterpolableValu
e(const CSSValue&); |
| 40 static PassOwnPtrWillBeRawPtr<InterpolableValue> borderImageSlicetoInterpola
bleValue(CSSValue&); | 40 static PassOwnPtrWillBeRawPtr<InterpolableValue> borderImageSlicetoInterpola
bleValue(const CSSValue&); |
| 41 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLengthBox(Interpo
lableValue*, InterpolationRange = RangeAll); | 41 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLengthBox(Interpo
lableValue*); |
| 42 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToBorderImageSlice(
InterpolableValue*, bool); | 42 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToBorderImageSlice(
InterpolableValue*, bool); |
| 43 | 43 |
| 44 bool m_fill; | 44 bool m_fill; |
| 45 | 45 |
| 46 friend class AnimationLengthBoxStyleInterpolationTest; | 46 friend class AnimationLengthBoxStyleInterpolationTest; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace blink | 49 } // namespace blink |
| 50 | 50 |
| 51 #endif // LengthBoxStyleInterpolation_h | 51 #endif // LengthBoxStyleInterpolation_h |
| OLD | NEW |