| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/ShadowStyleInterpolation.h" | 6 #include "core/animation/ShadowStyleInterpolation.h" |
| 7 | 7 |
| 8 #include "core/animation/ColorStyleInterpolation.h" | 8 #include "core/animation/ColorStyleInterpolation.h" |
| 9 #include "core/animation/LengthStyleInterpolation.h" | 9 #include "core/animation/LengthStyleInterpolation.h" |
| 10 #include "core/css/CSSColorValue.h" |
| 10 #include "core/css/CSSPrimitiveValue.h" | 11 #include "core/css/CSSPrimitiveValue.h" |
| 11 #include "core/css/CSSValueList.h" | 12 #include "core/css/CSSValueList.h" |
| 12 #include "core/css/CSSValuePool.h" | 13 #include "core/css/CSSValuePool.h" |
| 13 #include "core/css/resolver/StyleBuilder.h" | 14 #include "core/css/resolver/StyleBuilder.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 bool ShadowStyleInterpolation::canCreateFrom(const CSSValue& start, const CSSVal
ue& end) | 18 bool ShadowStyleInterpolation::canCreateFrom(const CSSValue& start, const CSSVal
ue& end) |
| 18 { | 19 { |
| 19 if (!start.isShadowValue() || end.isShadowValue()) | 20 if (!start.isShadowValue() || end.isShadowValue()) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 56 } |
| 56 | 57 |
| 57 PassRefPtrWillBeRawPtr<CSSValue> ShadowStyleInterpolation::fromInterpolableValue
(const InterpolableValue& value, NonInterpolableType nonInterpolableData, Interp
olationRange range) | 58 PassRefPtrWillBeRawPtr<CSSValue> ShadowStyleInterpolation::fromInterpolableValue
(const InterpolableValue& value, NonInterpolableType nonInterpolableData, Interp
olationRange range) |
| 58 { | 59 { |
| 59 const InterpolableList* shadow = toInterpolableList(&value); | 60 const InterpolableList* shadow = toInterpolableList(&value); |
| 60 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = LengthStyleInterpolation::fromInte
rpolableValue(*shadow->get(0), RangeAll); | 61 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = LengthStyleInterpolation::fromInte
rpolableValue(*shadow->get(0), RangeAll); |
| 61 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = LengthStyleInterpolation::fromInte
rpolableValue(*shadow->get(1), RangeAll); | 62 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = LengthStyleInterpolation::fromInte
rpolableValue(*shadow->get(1), RangeAll); |
| 62 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = LengthStyleInterpolation::fromI
nterpolableValue(*shadow->get(2), RangeNonNegative); | 63 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = LengthStyleInterpolation::fromI
nterpolableValue(*shadow->get(2), RangeNonNegative); |
| 63 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = LengthStyleInterpolation::fro
mInterpolableValue(*shadow->get(3), RangeAll); | 64 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = LengthStyleInterpolation::fro
mInterpolableValue(*shadow->get(3), RangeAll); |
| 64 | 65 |
| 65 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = ColorStyleInterpolation::inter
polableValueToColor(*shadow->get(4)); | 66 RefPtrWillBeRawPtr<CSSColorValue> color = ColorStyleInterpolation::interpola
bleValueToColor(*shadow->get(4)); |
| 66 RefPtrWillBeRawPtr<CSSPrimitiveValue> style = nonInterpolableData ? CSSPrimi
tiveValue::createIdentifier(CSSValueInset) : CSSPrimitiveValue::createIdentifier
(CSSValueNone); | 67 RefPtrWillBeRawPtr<CSSPrimitiveValue> style = nonInterpolableData ? CSSPrimi
tiveValue::createIdentifier(CSSValueInset) : CSSPrimitiveValue::createIdentifier
(CSSValueNone); |
| 67 | 68 |
| 68 RefPtrWillBeRawPtr<CSSShadowValue> result = CSSShadowValue::create(x, y, blu
r, spread, style, color); | 69 RefPtrWillBeRawPtr<CSSShadowValue> result = CSSShadowValue::create(x, y, blu
r, spread, style, color); |
| 69 return result.release(); | 70 return result.release(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool ShadowStyleInterpolation::usesDefaultStyleInterpolation(const CSSValue& sta
rt, const CSSValue& end) | 73 bool ShadowStyleInterpolation::usesDefaultStyleInterpolation(const CSSValue& sta
rt, const CSSValue& end) |
| 73 { | 74 { |
| 74 if (start.isValueList() && end.isValueList() && toCSSValueList(start).length
() == toCSSValueList(end).length()) { | 75 if (start.isValueList() && end.isValueList() && toCSSValueList(start).length
() == toCSSValueList(end).length()) { |
| 75 const CSSValueList* startList = toCSSValueList(&start); | 76 const CSSValueList* startList = toCSSValueList(&start); |
| 76 const CSSValueList* endList = toCSSValueList(&end); | 77 const CSSValueList* endList = toCSSValueList(&end); |
| 77 for (size_t i = 0; i < toCSSValueList(start).length(); i++) { | 78 for (size_t i = 0; i < toCSSValueList(start).length(); i++) { |
| 78 if (startList->item(i)->isShadowValue() && endList->item(i)->isShado
wValue() | 79 if (startList->item(i)->isShadowValue() && endList->item(i)->isShado
wValue() |
| 79 && toCSSShadowValue(startList->item(i))->style != toCSSShadowVal
ue(endList->item(i))->style) | 80 && toCSSShadowValue(startList->item(i))->style != toCSSShadowVal
ue(endList->item(i))->style) |
| 80 return true; | 81 return true; |
| 81 } | 82 } |
| 82 } | 83 } |
| 83 return false; | 84 return false; |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |