Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "core/animation/interpolation/DeferredLegacyStyleInterpolation.h" | |
| 7 | |
| 8 #include "core/animation/interpolation/LegacyStyleInterpolation.h" | |
| 9 #include "core/css/CSSPrimitiveValue.h" | |
| 10 #include "core/css/CSSShadowValue.h" | |
| 11 #include "core/css/CSSValueList.h" | |
| 12 #include "core/css/Pair.h" | |
| 13 #include "core/css/Rect.h" | |
| 14 #include "core/css/resolver/StyleResolver.h" | |
| 15 #include "core/css/resolver/StyleResolverState.h" | |
| 16 | |
| 17 namespace WebCore { | |
| 18 | |
| 19 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const | |
| 20 { | |
| 21 RefPtrWillBeRawPtr<LegacyStyleInterpolation> innerInterpolation = LegacyStyl eInterpolation::create( | |
| 22 StyleResolver::createAnimatableValueSnapshot(*state.element(), m_id, *m_ startCSSValue, *state.style()), | |
| 23 StyleResolver::createAnimatableValueSnapshot(*state.element(), m_id, *m_ endCSSValue, *state.style()), | |
| 24 m_id); | |
| 25 innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); | |
| 26 innerInterpolation->apply(state); | |
| 27 } | |
| 28 | |
| 29 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value) | |
| 30 { | |
| 31 switch (value.cssValueType()) { | |
| 32 case CSSValue::CSS_INHERIT: | |
| 33 return true; | |
| 34 case CSSValue::CSS_PRIMITIVE_VALUE: | |
| 35 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); | |
| 36 case CSSValue::CSS_VALUE_LIST: | |
| 37 return interpolationRequiresStyleResolve(toCSSValueList(value)); | |
| 38 case CSSValue::CSS_CUSTOM: | |
| 39 if (value.isShadowValue()) | |
| 40 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); | |
| 41 return true; | |
|
dstockwell
2014/05/26 11:20:40
I think we need to handle transform here now.
+fi
alancutter (OOO until 2018)
2014/05/26 15:51:32
Transforms are handled by the CSS_VALUE_LIST branc
dstockwell
2014/05/26 23:40:15
What does the list contain?
alancutter (OOO until 2018)
2014/05/26 23:48:26
The transform arguments.
https://chromium.googleso
| |
| 42 case CSSValue::CSS_INITIAL: | |
| 43 // FIXME: should not require resolving styles for initial. | |
| 44 return true; | |
| 45 default: | |
| 46 ASSERT_NOT_REACHED(); | |
| 47 return true; | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSPrimitiveValue& primitiveValue) | |
| 52 { | |
| 53 if (primitiveValue.isCalculated()) { | |
| 54 CSSLengthArray lengthArray(CSSPrimitiveValue::LengthUnitTypeCount); | |
| 55 primitiveValue.accumulateLengthArray(lengthArray); | |
| 56 return lengthArray[CSSPrimitiveValue::UnitTypeFontSize] != 0 | |
| 57 || lengthArray[CSSPrimitiveValue::UnitTypeFontXSize] != 0 | |
| 58 || lengthArray[CSSPrimitiveValue::UnitTypeRootFontSize] != 0 | |
| 59 || lengthArray[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0 | |
| 60 || lengthArray[CSSPrimitiveValue::UnitTypeViewportWidth] != 0 | |
| 61 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 | |
| 62 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0 | |
| 63 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0; | |
| 64 } | |
| 65 | |
| 66 if (primitiveValue.isLength()) | |
| 67 return primitiveValue.isFontRelativeLength() || primitiveValue.isViewpor tPercentageLength(); | |
| 68 | |
| 69 if (Pair* pair = primitiveValue.getPairValue()) { | |
| 70 return interpolationRequiresStyleResolve(*pair->first()) | |
| 71 || interpolationRequiresStyleResolve(*pair->second()); | |
| 72 } | |
| 73 | |
| 74 if (Rect* rect = primitiveValue.getRectValue()) { | |
| 75 return interpolationRequiresStyleResolve(*rect->top()) | |
| 76 || interpolationRequiresStyleResolve(*rect->right()) | |
| 77 || interpolationRequiresStyleResolve(*rect->bottom()) | |
| 78 || interpolationRequiresStyleResolve(*rect->left()); | |
| 79 } | |
| 80 | |
| 81 if (Quad* quad = primitiveValue.getQuadValue()) { | |
| 82 return interpolationRequiresStyleResolve(*quad->top()) | |
| 83 || interpolationRequiresStyleResolve(*quad->right()) | |
| 84 || interpolationRequiresStyleResolve(*quad->bottom()) | |
| 85 || interpolationRequiresStyleResolve(*quad->left()); | |
| 86 } | |
| 87 | |
| 88 switch (primitiveValue.getValueID()) { | |
| 89 case CSSValueAqua: | |
| 90 case CSSValueBlack: | |
| 91 case CSSValueBlue: | |
| 92 case CSSValueFuchsia: | |
| 93 case CSSValueGray: | |
| 94 case CSSValueGreen: | |
| 95 case CSSValueLime: | |
| 96 case CSSValueMaroon: | |
| 97 case CSSValueNavy: | |
| 98 case CSSValueOlive: | |
| 99 case CSSValueOrange: | |
| 100 case CSSValuePurple: | |
| 101 case CSSValueRed: | |
| 102 case CSSValueSilver: | |
| 103 case CSSValueTeal: | |
| 104 case CSSValueWhite: | |
| 105 case CSSValueYellow: | |
| 106 case CSSValueAliceblue: | |
| 107 case CSSValueAlpha: | |
| 108 case CSSValueAntiquewhite: | |
| 109 case CSSValueAquamarine: | |
| 110 case CSSValueAzure: | |
| 111 case CSSValueBeige: | |
| 112 case CSSValueBisque: | |
| 113 case CSSValueBlanchedalmond: | |
| 114 case CSSValueBlueviolet: | |
| 115 case CSSValueBrown: | |
| 116 case CSSValueBurlywood: | |
| 117 case CSSValueCadetblue: | |
| 118 case CSSValueChartreuse: | |
| 119 case CSSValueChocolate: | |
| 120 case CSSValueCoral: | |
| 121 case CSSValueCornflowerblue: | |
| 122 case CSSValueCornsilk: | |
| 123 case CSSValueCrimson: | |
| 124 case CSSValueCyan: | |
| 125 case CSSValueDarkblue: | |
| 126 case CSSValueDarkcyan: | |
| 127 case CSSValueDarkgoldenrod: | |
| 128 case CSSValueDarkgray: | |
| 129 case CSSValueDarkgreen: | |
| 130 case CSSValueDarkgrey: | |
| 131 case CSSValueDarkkhaki: | |
| 132 case CSSValueDarkmagenta: | |
| 133 case CSSValueDarkolivegreen: | |
| 134 case CSSValueDarkorange: | |
| 135 case CSSValueDarkorchid: | |
| 136 case CSSValueDarkred: | |
| 137 case CSSValueDarksalmon: | |
| 138 case CSSValueDarkseagreen: | |
| 139 case CSSValueDarkslateblue: | |
| 140 case CSSValueDarkslategray: | |
| 141 case CSSValueDarkslategrey: | |
| 142 case CSSValueDarkturquoise: | |
| 143 case CSSValueDarkviolet: | |
| 144 case CSSValueDeeppink: | |
| 145 case CSSValueDeepskyblue: | |
| 146 case CSSValueDimgray: | |
| 147 case CSSValueDimgrey: | |
| 148 case CSSValueDodgerblue: | |
| 149 case CSSValueFirebrick: | |
| 150 case CSSValueFloralwhite: | |
| 151 case CSSValueForestgreen: | |
| 152 case CSSValueGainsboro: | |
| 153 case CSSValueGhostwhite: | |
| 154 case CSSValueGold: | |
| 155 case CSSValueGoldenrod: | |
| 156 case CSSValueGreenyellow: | |
| 157 case CSSValueHoneydew: | |
| 158 case CSSValueHotpink: | |
| 159 case CSSValueIndianred: | |
| 160 case CSSValueIndigo: | |
| 161 case CSSValueIvory: | |
| 162 case CSSValueKhaki: | |
| 163 case CSSValueLavender: | |
| 164 case CSSValueLavenderblush: | |
| 165 case CSSValueLawngreen: | |
| 166 case CSSValueLemonchiffon: | |
| 167 case CSSValueLightblue: | |
| 168 case CSSValueLightcoral: | |
| 169 case CSSValueLightcyan: | |
| 170 case CSSValueLightgoldenrodyellow: | |
| 171 case CSSValueLightgray: | |
| 172 case CSSValueLightgreen: | |
| 173 case CSSValueLightgrey: | |
| 174 case CSSValueLightpink: | |
| 175 case CSSValueLightsalmon: | |
| 176 case CSSValueLightseagreen: | |
| 177 case CSSValueLightskyblue: | |
| 178 case CSSValueLightslategray: | |
| 179 case CSSValueLightslategrey: | |
| 180 case CSSValueLightsteelblue: | |
| 181 case CSSValueLightyellow: | |
| 182 case CSSValueLimegreen: | |
| 183 case CSSValueLinen: | |
| 184 case CSSValueLuminance: | |
| 185 case CSSValueMagenta: | |
| 186 case CSSValueMediumaquamarine: | |
| 187 case CSSValueMediumblue: | |
| 188 case CSSValueMediumorchid: | |
| 189 case CSSValueMediumpurple: | |
| 190 case CSSValueMediumseagreen: | |
| 191 case CSSValueMediumslateblue: | |
| 192 case CSSValueMediumspringgreen: | |
| 193 case CSSValueMediumturquoise: | |
| 194 case CSSValueMediumvioletred: | |
| 195 case CSSValueMidnightblue: | |
| 196 case CSSValueMistyrose: | |
| 197 case CSSValueMoccasin: | |
| 198 case CSSValueNavajowhite: | |
| 199 case CSSValueOldlace: | |
| 200 case CSSValueOlivedrab: | |
| 201 case CSSValueOrangered: | |
| 202 case CSSValueOrchid: | |
| 203 case CSSValuePalegoldenrod: | |
| 204 case CSSValuePalegreen: | |
| 205 case CSSValuePaleturquoise: | |
| 206 case CSSValuePalevioletred: | |
| 207 case CSSValuePapayawhip: | |
| 208 case CSSValuePeachpuff: | |
| 209 case CSSValuePeru: | |
| 210 case CSSValuePink: | |
| 211 case CSSValuePlum: | |
| 212 case CSSValuePowderblue: | |
| 213 case CSSValueRosybrown: | |
| 214 case CSSValueRoyalblue: | |
| 215 case CSSValueSaddlebrown: | |
| 216 case CSSValueSalmon: | |
| 217 case CSSValueSandybrown: | |
| 218 case CSSValueSeagreen: | |
| 219 case CSSValueSeashell: | |
| 220 case CSSValueSienna: | |
| 221 case CSSValueSkyblue: | |
| 222 case CSSValueSlateblue: | |
| 223 case CSSValueSlategray: | |
| 224 case CSSValueSlategrey: | |
| 225 case CSSValueSnow: | |
| 226 case CSSValueSpringgreen: | |
| 227 case CSSValueSteelblue: | |
| 228 case CSSValueTan: | |
| 229 case CSSValueThistle: | |
| 230 case CSSValueTomato: | |
| 231 case CSSValueTurquoise: | |
| 232 case CSSValueViolet: | |
| 233 case CSSValueWheat: | |
| 234 case CSSValueWhitesmoke: | |
| 235 case CSSValueYellowgreen: | |
|
alancutter (OOO until 2018)
2014/05/26 10:12:10
This makes me sad. ):
I personally think the small
shans
2014/05/26 10:47:48
Are these contiguous? Comparisons with the min and
dstockwell
2014/05/26 11:20:40
I suppose we could just return true for all IDs fo
| |
| 236 return false; | |
| 237 | |
| 238 default: | |
| 239 return true; | |
| 240 } | |
| 241 } | |
| 242 | |
| 243 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSShadowValue& shadowValue) | |
| 244 { | |
| 245 return (shadowValue.x && interpolationRequiresStyleResolve(*shadowValue.x)) | |
| 246 || (shadowValue.y && interpolationRequiresStyleResolve(*shadowValue.y)) | |
| 247 || (shadowValue.blur && interpolationRequiresStyleResolve(*shadowValue.b lur)) | |
| 248 || (shadowValue.spread && interpolationRequiresStyleResolve(*shadowValue .spread)) | |
| 249 || (shadowValue.style && interpolationRequiresStyleResolve(*shadowValue. style)) | |
| 250 || (shadowValue.color && interpolationRequiresStyleResolve(*shadowValue. color)); | |
| 251 } | |
| 252 | |
| 253 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValueList& valueList) | |
| 254 { | |
| 255 size_t length = valueList.length(); | |
| 256 for (size_t index = 0; index < length; ++index) { | |
| 257 if (interpolationRequiresStyleResolve(*valueList.item(index))) | |
| 258 return true; | |
| 259 } | |
| 260 return false; | |
| 261 } | |
| 262 | |
| 263 void DeferredLegacyStyleInterpolation::trace(Visitor* visitor) | |
| 264 { | |
| 265 StyleInterpolation::trace(visitor); | |
| 266 visitor->trace(m_startCSSValue); | |
| 267 visitor->trace(m_endCSSValue); | |
| 268 } | |
| 269 | |
| 270 } | |
| OLD | NEW |