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

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

Issue 2043273002: Defer compositor keyframe snapshots until the next style resolve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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
(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 "core/animation/DeferredLegacyStyleInterpolation.h"
6
7 #include "core/css/CSSBasicShapeValues.h"
8 #include "core/css/CSSImageValue.h"
9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/CSSQuadValue.h"
11 #include "core/css/CSSSVGDocumentValue.h"
12 #include "core/css/CSSShadowValue.h"
13 #include "core/css/CSSValueList.h"
14 #include "core/css/CSSValuePair.h"
15
16 namespace blink {
17
18 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value)
19 {
20 // FIXME: should not require resolving styles for inherit/initial/unset.
21 if (value.isCSSWideKeyword())
22 return true;
23 if (value.isBasicShapeCircleValue())
24 return interpolationRequiresStyleResolve(toCSSBasicShapeCircleValue(valu e));
25 if (value.isBasicShapeEllipseValue())
26 return interpolationRequiresStyleResolve(toCSSBasicShapeEllipseValue(val ue));
27 if (value.isBasicShapePolygonValue())
28 return interpolationRequiresStyleResolve(toCSSBasicShapePolygonValue(val ue));
29 if (value.isBasicShapeInsetValue())
30 return interpolationRequiresStyleResolve(toCSSBasicShapeInsetValue(value ));
31 if (value.isColorValue())
32 return false;
33 if (value.isStringValue() || value.isURIValue() || value.isCustomIdentValue( ))
34 return false;
35 if (value.isPrimitiveValue())
36 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value));
37 if (value.isQuadValue())
38 return interpolationRequiresStyleResolve(toCSSQuadValue(value));
39 if (value.isValueList())
40 return interpolationRequiresStyleResolve(toCSSValueList(value));
41 if (value.isValuePair())
42 return interpolationRequiresStyleResolve(toCSSValuePair(value));
43 if (value.isImageValue())
44 return interpolationRequiresStyleResolve(toCSSImageValue(value));
45 if (value.isShadowValue())
46 return interpolationRequiresStyleResolve(toCSSShadowValue(value));
47 if (value.isSVGDocumentValue())
48 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value));
49 // FIXME: consider other custom types.
50 return true;
51 }
52
53 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSPrimitiveValue& primitiveValue)
54 {
55 // FIXME: consider other types.
56 if (primitiveValue.isNumber() || primitiveValue.isPercentage() || primitiveV alue.isAngle())
57 return false;
58
59 if (primitiveValue.isLength())
60 return primitiveValue.isFontRelativeLength() || primitiveValue.isViewpor tPercentageLength();
61
62 if (primitiveValue.isCalculated()) {
63 CSSLengthArray lengthArray;
64 primitiveValue.accumulateLengthArray(lengthArray);
65 return lengthArray.values[CSSPrimitiveValue::UnitTypeFontSize] != 0
66 || lengthArray.values[CSSPrimitiveValue::UnitTypeFontXSize] != 0
67 || lengthArray.values[CSSPrimitiveValue::UnitTypeRootFontSize] != 0
68 || lengthArray.values[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0
69 || lengthArray.values[CSSPrimitiveValue::UnitTypeViewportWidth] != 0
70 || lengthArray.values[CSSPrimitiveValue::UnitTypeViewportHeight] != 0
71 || lengthArray.values[CSSPrimitiveValue::UnitTypeViewportMin] != 0
72 || lengthArray.values[CSSPrimitiveValue::UnitTypeViewportMax] != 0;
73 }
74
75 CSSValueID id = primitiveValue.getValueID();
76 bool isColor = ((id >= CSSValueAqua && id <= CSSValueTransparent)
77 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen)
78 || id == CSSValueGrey);
79 return (id != CSSValueNone) && !isColor;
80 }
81
82 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSImageValue& imageValue)
83 {
84 return false;
85 }
86
87 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSShadowValue& shadowValue)
88 {
89 return (shadowValue.x && interpolationRequiresStyleResolve(*shadowValue.x))
90 || (shadowValue.y && interpolationRequiresStyleResolve(*shadowValue.y))
91 || (shadowValue.blur && interpolationRequiresStyleResolve(*shadowValue.b lur))
92 || (shadowValue.spread && interpolationRequiresStyleResolve(*shadowValue .spread))
93 || (shadowValue.style && interpolationRequiresStyleResolve(*shadowValue. style))
94 || (shadowValue.color && interpolationRequiresStyleResolve(*shadowValue. color));
95 }
96
97 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSSVGDocumentValue& documentValue)
98 {
99 return true;
100 }
101
102 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValueList& valueList)
103 {
104 size_t length = valueList.length();
105 for (size_t index = 0; index < length; ++index) {
106 if (interpolationRequiresStyleResolve(valueList.item(index)))
107 return true;
108 }
109 return false;
110 }
111
112 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValuePair& pair)
113 {
114 return interpolationRequiresStyleResolve(pair.first())
115 || interpolationRequiresStyleResolve(pair.second());
116 }
117
118 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSBasicShapeCircleValue& shape)
119 {
120 // FIXME: Should inspect the members.
121 return false;
122 }
123
124 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSBasicShapeEllipseValue& shape)
125 {
126 // FIXME: Should inspect the members.
127 return false;
128 }
129
130 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSBasicShapePolygonValue& shape)
131 {
132 // FIXME: Should inspect the members.
133 return false;
134 }
135
136 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSBasicShapeInsetValue& shape)
137 {
138 // FIXME: Should inspect the members.
139 return false;
140 }
141
142 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSQuadValue& quad)
143 {
144 return interpolationRequiresStyleResolve(*quad.top())
145 || interpolationRequiresStyleResolve(*quad.right())
146 || interpolationRequiresStyleResolve(*quad.bottom())
147 || interpolationRequiresStyleResolve(*quad.left());
148 }
149
150 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698