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 #include "core/animation/LengthBoxStyleInterpolation.h" | 5 #include "core/animation/LengthBoxStyleInterpolation.h" |
6 | 6 |
7 #include "core/css/CSSQuadValue.h" | 7 #include "core/css/CSSQuadValue.h" |
8 #include "core/css/resolver/StyleBuilder.h" | 8 #include "core/css/resolver/StyleBuilder.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 bool onlyInterpolateBetweenLengthAndCSSValueAuto(const CSSQuadValue& startRect,
const CSSQuadValue& endRect) | 14 bool onlyInterpolateBetweenLengthAndCSSValueAuto(const CSSQuadValue& startRect,
const CSSQuadValue& endRect) |
15 { | 15 { |
16 return startRect.left()->isLength() != endRect.left()->isLength() | 16 return startRect.left()->isLength() != endRect.left()->isLength() |
17 && startRect.right()->isLength() != endRect.right()->isLength() | 17 && startRect.right()->isLength() != endRect.right()->isLength() |
18 && startRect.top()->isLength() != endRect.top()->isLength() | 18 && startRect.top()->isLength() != endRect.top()->isLength() |
19 && startRect.bottom()->isLength() != endRect.bottom()->isLength(); | 19 && startRect.bottom()->isLength() != endRect.bottom()->isLength(); |
20 } | 20 } |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 PassRefPtr<LengthBoxStyleInterpolation> LengthBoxStyleInterpolation::maybeCreate
From(CSSValue& start, CSSValue& end, CSSPropertyID id) | 24 PassRefPtr<LengthBoxStyleInterpolation> LengthBoxStyleInterpolation::maybeCreate
From(CSSValue& start, CSSValue& end, CSSPropertyID id) |
25 { | 25 { |
26 bool startRect = start.isQuadValue() && toCSSQuadValue(start).serializationT
ype() == CSSQuadValue::SerializationType::SerializeAsRect; | 26 bool startRect = start.isQuadValue() && toCSSQuadValue(start).serializationT
ype() == CSSQuadValue::TypeForSerialization::SerializeAsRect; |
27 bool endRect = end.isQuadValue() && toCSSQuadValue(end).serializationType()
== CSSQuadValue::SerializationType::SerializeAsRect; | 27 bool endRect = end.isQuadValue() && toCSSQuadValue(end).serializationType()
== CSSQuadValue::TypeForSerialization::SerializeAsRect; |
28 | 28 |
29 if (startRect && endRect) | 29 if (startRect && endRect) |
30 return adoptRef(new LengthBoxStyleInterpolation(lengthBoxtoInterpolableV
alue(start, end, false), lengthBoxtoInterpolableValue(end, start, true), id, &st
art, &end)); | 30 return adoptRef(new LengthBoxStyleInterpolation(lengthBoxtoInterpolableV
alue(start, end, false), lengthBoxtoInterpolableValue(end, start, true), id, &st
art, &end)); |
31 return nullptr; | 31 return nullptr; |
32 } | 32 } |
33 | 33 |
34 PassOwnPtr<InterpolableValue> LengthBoxStyleInterpolation::lengthBoxtoInterpolab
leValue(const CSSValue& lengthBox, const CSSValue& matchingValue, bool isEndInte
rpolation) | 34 PassOwnPtr<InterpolableValue> LengthBoxStyleInterpolation::lengthBoxtoInterpolab
leValue(const CSSValue& lengthBox, const CSSValue& matchingValue, bool isEndInte
rpolation) |
35 { | 35 { |
36 const int numberOfSides = 4; | 36 const int numberOfSides = 4; |
37 OwnPtr<InterpolableList> result = InterpolableList::create(numberOfSides); | 37 OwnPtr<InterpolableList> result = InterpolableList::create(numberOfSides); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 void LengthBoxStyleInterpolation::apply(StyleResolverState& state) const | 101 void LengthBoxStyleInterpolation::apply(StyleResolverState& state) const |
102 { | 102 { |
103 if (m_cachedValue.get()->isBool()) | 103 if (m_cachedValue.get()->isBool()) |
104 StyleBuilder::applyProperty(m_id, state, toInterpolableBool(m_cachedValu
e.get())->value() ? m_endCSSValue.get() : m_startCSSValue.get()); | 104 StyleBuilder::applyProperty(m_id, state, toInterpolableBool(m_cachedValu
e.get())->value() ? m_endCSSValue.get() : m_startCSSValue.get()); |
105 else | 105 else |
106 StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthBox(m_
cachedValue.get(), *m_startCSSValue, *m_endCSSValue).get()); | 106 StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthBox(m_
cachedValue.get(), *m_startCSSValue, *m_endCSSValue).get()); |
107 } | 107 } |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |