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

Side by Side Diff: Source/core/animation/DeferredLegacyStyleInterpolation.cpp

Issue 1317523002: Changed Pair to be a CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add_const_to_primvalue
Patch Set: Rebase Created 5 years, 3 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 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/DeferredLegacyStyleInterpolation.h" 6 #include "core/animation/DeferredLegacyStyleInterpolation.h"
7 7
8 #include "core/animation/ElementAnimations.h" 8 #include "core/animation/ElementAnimations.h"
9 #include "core/animation/css/CSSAnimatableValueFactory.h" 9 #include "core/animation/css/CSSAnimatableValueFactory.h"
10 #include "core/css/CSSBasicShapes.h" 10 #include "core/css/CSSBasicShapes.h"
11 #include "core/css/CSSImageValue.h" 11 #include "core/css/CSSImageValue.h"
12 #include "core/css/CSSPrimitiveValue.h" 12 #include "core/css/CSSPrimitiveValue.h"
13 #include "core/css/CSSQuadValue.h" 13 #include "core/css/CSSQuadValue.h"
14 #include "core/css/CSSSVGDocumentValue.h" 14 #include "core/css/CSSSVGDocumentValue.h"
15 #include "core/css/CSSShadowValue.h" 15 #include "core/css/CSSShadowValue.h"
16 #include "core/css/CSSValueList.h" 16 #include "core/css/CSSValueList.h"
17 #include "core/css/Pair.h" 17 #include "core/css/CSSValuePair.h"
18 #include "core/css/resolver/StyleResolver.h" 18 #include "core/css/resolver/StyleResolver.h"
19 #include "core/css/resolver/StyleResolverState.h" 19 #include "core/css/resolver/StyleResolverState.h"
20 20
21 namespace blink { 21 namespace blink {
22 22
23 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const 23 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const
24 { 24 {
25 if (m_outdated || !state.element()->elementAnimations() || !state.element()- >elementAnimations()->isAnimationStyleChange()) { 25 if (m_outdated || !state.element()->elementAnimations() || !state.element()- >elementAnimations()->isAnimationStyleChange()) {
26 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue; 26 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue;
27 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue; 27 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue;
(...skipping 19 matching lines...) Expand all
47 { 47 {
48 // FIXME: should not require resolving styles for inherit/initial/unset. 48 // FIXME: should not require resolving styles for inherit/initial/unset.
49 if (value.isCSSWideKeyword()) 49 if (value.isCSSWideKeyword())
50 return true; 50 return true;
51 if (value.isPrimitiveValue()) 51 if (value.isPrimitiveValue())
52 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); 52 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value));
53 if (value.isQuadValue()) 53 if (value.isQuadValue())
54 return interpolationRequiresStyleResolve(toCSSQuadValue(value)); 54 return interpolationRequiresStyleResolve(toCSSQuadValue(value));
55 if (value.isValueList()) 55 if (value.isValueList())
56 return interpolationRequiresStyleResolve(toCSSValueList(value)); 56 return interpolationRequiresStyleResolve(toCSSValueList(value));
57 if (value.isValuePair())
58 return interpolationRequiresStyleResolve(toCSSValuePair(value));
57 if (value.isImageValue()) 59 if (value.isImageValue())
58 return interpolationRequiresStyleResolve(toCSSImageValue(value)); 60 return interpolationRequiresStyleResolve(toCSSImageValue(value));
59 if (value.isShadowValue()) 61 if (value.isShadowValue())
60 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); 62 return interpolationRequiresStyleResolve(toCSSShadowValue(value));
61 if (value.isSVGDocumentValue()) 63 if (value.isSVGDocumentValue())
62 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value)); 64 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value));
63 // FIXME: consider other custom types. 65 // FIXME: consider other custom types.
64 return true; 66 return true;
65 } 67 }
66 68
(...skipping 12 matching lines...) Expand all
79 return lengthArray[CSSPrimitiveValue::UnitTypeFontSize] != 0 81 return lengthArray[CSSPrimitiveValue::UnitTypeFontSize] != 0
80 || lengthArray[CSSPrimitiveValue::UnitTypeFontXSize] != 0 82 || lengthArray[CSSPrimitiveValue::UnitTypeFontXSize] != 0
81 || lengthArray[CSSPrimitiveValue::UnitTypeRootFontSize] != 0 83 || lengthArray[CSSPrimitiveValue::UnitTypeRootFontSize] != 0
82 || lengthArray[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0 84 || lengthArray[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0
83 || lengthArray[CSSPrimitiveValue::UnitTypeViewportWidth] != 0 85 || lengthArray[CSSPrimitiveValue::UnitTypeViewportWidth] != 0
84 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 86 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0
85 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0 87 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0
86 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0; 88 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0;
87 } 89 }
88 90
89 if (Pair* pair = primitiveValue.getPairValue()) {
90 return interpolationRequiresStyleResolve(*pair->first())
91 || interpolationRequiresStyleResolve(*pair->second());
92 }
93
94 if (primitiveValue.isShape()) 91 if (primitiveValue.isShape())
95 return interpolationRequiresStyleResolve(*primitiveValue.getShapeValue() ); 92 return interpolationRequiresStyleResolve(*primitiveValue.getShapeValue() );
96 93
97 CSSValueID id = primitiveValue.getValueID(); 94 CSSValueID id = primitiveValue.getValueID();
98 bool isColor = ((id >= CSSValueAqua && id <= CSSValueTransparent) 95 bool isColor = ((id >= CSSValueAqua && id <= CSSValueTransparent)
99 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) 96 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen)
100 || id == CSSValueGrey); 97 || id == CSSValueGrey);
101 return (id != CSSValueNone) && !isColor; 98 return (id != CSSValueNone) && !isColor;
102 } 99 }
103 100
(...skipping 20 matching lines...) Expand all
124 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValueList& valueList) 121 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValueList& valueList)
125 { 122 {
126 size_t length = valueList.length(); 123 size_t length = valueList.length();
127 for (size_t index = 0; index < length; ++index) { 124 for (size_t index = 0; index < length; ++index) {
128 if (interpolationRequiresStyleResolve(*valueList.item(index))) 125 if (interpolationRequiresStyleResolve(*valueList.item(index)))
129 return true; 126 return true;
130 } 127 }
131 return false; 128 return false;
132 } 129 }
133 130
131 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValuePair& pair)
132 {
133 return interpolationRequiresStyleResolve(*pair.first())
134 || interpolationRequiresStyleResolve(*pair.second());
135 }
136
134 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSBasicShape& shape) 137 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSBasicShape& shape)
135 { 138 {
136 // FIXME: Should determine the specific shape, and inspect the members. 139 // FIXME: Should determine the specific shape, and inspect the members.
137 return false; 140 return false;
138 } 141 }
139 142
140 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSQuadValue& quad) 143 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSQuadValue& quad)
141 { 144 {
142 return interpolationRequiresStyleResolve(*quad.top()) 145 return interpolationRequiresStyleResolve(*quad.top())
143 || interpolationRequiresStyleResolve(*quad.right()) 146 || interpolationRequiresStyleResolve(*quad.right())
144 || interpolationRequiresStyleResolve(*quad.bottom()) 147 || interpolationRequiresStyleResolve(*quad.bottom())
145 || interpolationRequiresStyleResolve(*quad.left()); 148 || interpolationRequiresStyleResolve(*quad.left());
146 } 149 }
147 150
148
149 DEFINE_TRACE(DeferredLegacyStyleInterpolation) 151 DEFINE_TRACE(DeferredLegacyStyleInterpolation)
150 { 152 {
151 visitor->trace(m_startCSSValue); 153 visitor->trace(m_startCSSValue);
152 visitor->trace(m_endCSSValue); 154 visitor->trace(m_endCSSValue);
153 visitor->trace(m_innerInterpolation); 155 visitor->trace(m_innerInterpolation);
154 StyleInterpolation::trace(visitor); 156 StyleInterpolation::trace(visitor);
155 } 157 }
156 158
157 } 159 }
OLDNEW
« no previous file with comments | « Source/core/animation/DeferredLegacyStyleInterpolation.h ('k') | Source/core/animation/LengthPairStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698