1 | /*
|
---|
2 | * Copyright (C) 2011 Andreas Kling ([email protected])
|
---|
3 | * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
|
---|
4 | * Copyright (C) 2021 Apple Inc. All rights reserved.
|
---|
5 | *
|
---|
6 | * Redistribution and use in source and binary forms, with or without
|
---|
7 | * modification, are permitted provided that the following conditions
|
---|
8 | * are met:
|
---|
9 | * 1. Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | *
|
---|
15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
|
---|
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
---|
18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
|
---|
19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
---|
20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
---|
21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
---|
22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
---|
23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
26 | *
|
---|
27 | */
|
---|
28 |
|
---|
29 | #include "config.h"
|
---|
30 | #include "CSSValue.h"
|
---|
31 |
|
---|
32 | #include "CSSAspectRatioValue.h"
|
---|
33 | #include "CSSBorderImageSliceValue.h"
|
---|
34 | #include "CSSBorderImageWidthValue.h"
|
---|
35 | #include "CSSCalcValue.h"
|
---|
36 | #include "CSSCanvasValue.h"
|
---|
37 | #include "CSSContentDistributionValue.h"
|
---|
38 | #include "CSSCrossfadeValue.h"
|
---|
39 | #include "CSSCursorImageValue.h"
|
---|
40 | #include "CSSCustomPropertyValue.h"
|
---|
41 | #include "CSSFilterImageValue.h"
|
---|
42 | #include "CSSFontFaceSrcValue.h"
|
---|
43 | #include "CSSFontFeatureValue.h"
|
---|
44 | #include "CSSFontPaletteValuesOverrideColorsValue.h"
|
---|
45 | #include "CSSFontStyleRangeValue.h"
|
---|
46 | #include "CSSFontStyleValue.h"
|
---|
47 | #include "CSSFontValue.h"
|
---|
48 | #include "CSSFontVariationValue.h"
|
---|
49 | #include "CSSFunctionValue.h"
|
---|
50 | #include "CSSGradientValue.h"
|
---|
51 | #include "CSSImageSetValue.h"
|
---|
52 | #include "CSSImageValue.h"
|
---|
53 | #include "CSSLineBoxContainValue.h"
|
---|
54 | #include "CSSNamedImageValue.h"
|
---|
55 | #include "CSSOffsetRotateValue.h"
|
---|
56 | #include "CSSPaintImageValue.h"
|
---|
57 | #include "CSSPendingSubstitutionValue.h"
|
---|
58 | #include "CSSPrimitiveValue.h"
|
---|
59 | #include "CSSProperty.h"
|
---|
60 | #include "CSSRayValue.h"
|
---|
61 | #include "CSSReflectValue.h"
|
---|
62 | #include "CSSShadowValue.h"
|
---|
63 | #include "CSSTimingFunctionValue.h"
|
---|
64 | #include "CSSUnicodeRangeValue.h"
|
---|
65 | #include "CSSValueList.h"
|
---|
66 | #include "CSSValuePair.h"
|
---|
67 | #include "CSSVariableReferenceValue.h"
|
---|
68 |
|
---|
69 | #include "CSSGridAutoRepeatValue.h"
|
---|
70 | #include "CSSGridIntegerRepeatValue.h"
|
---|
71 | #include "CSSGridLineNamesValue.h"
|
---|
72 | #include "CSSGridTemplateAreasValue.h"
|
---|
73 | #include "CSSSubgridValue.h"
|
---|
74 |
|
---|
75 | #include "DeprecatedCSSOMPrimitiveValue.h"
|
---|
76 | #include "DeprecatedCSSOMValueList.h"
|
---|
77 |
|
---|
78 | namespace WebCore {
|
---|
79 |
|
---|
80 | struct SameSizeAsCSSValue {
|
---|
81 | uint32_t refCount;
|
---|
82 | uint32_t bitfields;
|
---|
83 | };
|
---|
84 |
|
---|
85 | static_assert(sizeof(CSSValue) == sizeof(SameSizeAsCSSValue), "CSS value should stay small");
|
---|
86 |
|
---|
87 | DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(CSSValue);
|
---|
88 |
|
---|
89 | CSSValue::Type CSSValue::cssValueType() const
|
---|
90 | {
|
---|
91 | if (isInheritValue())
|
---|
92 | return CSS_INHERIT;
|
---|
93 | if (isPrimitiveValue())
|
---|
94 | return CSS_PRIMITIVE_VALUE;
|
---|
95 | if (isValueList())
|
---|
96 | return CSS_VALUE_LIST;
|
---|
97 | if (isInitialValue())
|
---|
98 | return CSS_INITIAL;
|
---|
99 | if (isUnsetValue())
|
---|
100 | return CSS_UNSET;
|
---|
101 | if (isRevertValue())
|
---|
102 | return CSS_REVERT;
|
---|
103 | return CSS_CUSTOM;
|
---|
104 | }
|
---|
105 |
|
---|
106 | bool CSSValue::traverseSubresources(const Function<bool(const CachedResource&)>& handler) const
|
---|
107 | {
|
---|
108 | if (is<CSSValueList>(*this))
|
---|
109 | return downcast<CSSValueList>(*this).traverseSubresources(handler);
|
---|
110 | if (is<CSSFontFaceSrcValue>(*this))
|
---|
111 | return downcast<CSSFontFaceSrcValue>(*this).traverseSubresources(handler);
|
---|
112 | if (is<CSSImageValue>(*this))
|
---|
113 | return downcast<CSSImageValue>(*this).traverseSubresources(handler);
|
---|
114 | if (is<CSSCrossfadeValue>(*this))
|
---|
115 | return downcast<CSSCrossfadeValue>(*this).traverseSubresources(handler);
|
---|
116 | if (is<CSSFilterImageValue>(*this))
|
---|
117 | return downcast<CSSFilterImageValue>(*this).traverseSubresources(handler);
|
---|
118 | if (is<CSSImageSetValue>(*this))
|
---|
119 | return downcast<CSSImageSetValue>(*this).traverseSubresources(handler);
|
---|
120 | return false;
|
---|
121 | }
|
---|
122 |
|
---|
123 | void CSSValue::collectDirectComputationalDependencies(HashSet<CSSPropertyID>& values) const
|
---|
124 | {
|
---|
125 | if (is<CSSPrimitiveValue>(*this))
|
---|
126 | downcast<CSSPrimitiveValue>(*this).collectDirectComputationalDependencies(values);
|
---|
127 | }
|
---|
128 |
|
---|
129 | void CSSValue::collectDirectRootComputationalDependencies(HashSet<CSSPropertyID>& values) const
|
---|
130 | {
|
---|
131 | if (is<CSSPrimitiveValue>(*this))
|
---|
132 | downcast<CSSPrimitiveValue>(*this).collectDirectRootComputationalDependencies(values);
|
---|
133 | }
|
---|
134 |
|
---|
135 | template<class ChildClassType>
|
---|
136 | inline static bool compareCSSValues(const CSSValue& first, const CSSValue& second)
|
---|
137 | {
|
---|
138 | return static_cast<const ChildClassType&>(first).equals(static_cast<const ChildClassType&>(second));
|
---|
139 | }
|
---|
140 |
|
---|
141 | bool CSSValue::equals(const CSSValue& other) const
|
---|
142 | {
|
---|
143 | if (m_classType == other.m_classType) {
|
---|
144 | switch (m_classType) {
|
---|
145 | case AspectRatioClass:
|
---|
146 | return compareCSSValues<CSSAspectRatioValue>(*this, other);
|
---|
147 | case BorderImageSliceClass:
|
---|
148 | return compareCSSValues<CSSBorderImageSliceValue>(*this, other);
|
---|
149 | case BorderImageWidthClass:
|
---|
150 | return compareCSSValues<CSSBorderImageWidthValue>(*this, other);
|
---|
151 | case CanvasClass:
|
---|
152 | return compareCSSValues<CSSCanvasValue>(*this, other);
|
---|
153 | case NamedImageClass:
|
---|
154 | return compareCSSValues<CSSNamedImageValue>(*this, other);
|
---|
155 | case CursorImageClass:
|
---|
156 | return compareCSSValues<CSSCursorImageValue>(*this, other);
|
---|
157 | case FilterImageClass:
|
---|
158 | return compareCSSValues<CSSFilterImageValue>(*this, other);
|
---|
159 | #if ENABLE(CSS_PAINTING_API)
|
---|
160 | case PaintImageClass:
|
---|
161 | return compareCSSValues<CSSPaintImageValue>(*this, other);
|
---|
162 | #endif
|
---|
163 | case FontClass:
|
---|
164 | return compareCSSValues<CSSFontValue>(*this, other);
|
---|
165 | case FontFaceSrcClass:
|
---|
166 | return compareCSSValues<CSSFontFaceSrcValue>(*this, other);
|
---|
167 | case FontPaletteValuesOverrideColorsClass:
|
---|
168 | return compareCSSValues<CSSFontPaletteValuesOverrideColorsValue>(*this, other);
|
---|
169 | case FontFeatureClass:
|
---|
170 | return compareCSSValues<CSSFontFeatureValue>(*this, other);
|
---|
171 | case FontVariationClass:
|
---|
172 | return compareCSSValues<CSSFontVariationValue>(*this, other);
|
---|
173 | case FunctionClass:
|
---|
174 | return compareCSSValues<CSSFunctionValue>(*this, other);
|
---|
175 | case LinearGradientClass:
|
---|
176 | return compareCSSValues<CSSLinearGradientValue>(*this, other);
|
---|
177 | case RadialGradientClass:
|
---|
178 | return compareCSSValues<CSSRadialGradientValue>(*this, other);
|
---|
179 | case ConicGradientClass:
|
---|
180 | return compareCSSValues<CSSConicGradientValue>(*this, other);
|
---|
181 | case CrossfadeClass:
|
---|
182 | return compareCSSValues<CSSCrossfadeValue>(*this, other);
|
---|
183 | case ImageClass:
|
---|
184 | return compareCSSValues<CSSImageValue>(*this, other);
|
---|
185 | case GridAutoRepeatClass:
|
---|
186 | return compareCSSValues<CSSGridAutoRepeatValue>(*this, other);
|
---|
187 | case GridIntegerRepeatClass:
|
---|
188 | return compareCSSValues<CSSGridIntegerRepeatValue>(*this, other);
|
---|
189 | case GridLineNamesClass:
|
---|
190 | return compareCSSValues<CSSGridLineNamesValue>(*this, other);
|
---|
191 | case SubgridClass:
|
---|
192 | return compareCSSValues<CSSSubgridValue>(*this, other);
|
---|
193 | case GridTemplateAreasClass:
|
---|
194 | return compareCSSValues<CSSGridTemplateAreasValue>(*this, other);
|
---|
195 | case PrimitiveClass:
|
---|
196 | return compareCSSValues<CSSPrimitiveValue>(*this, other);
|
---|
197 | case ReflectClass:
|
---|
198 | return compareCSSValues<CSSReflectValue>(*this, other);
|
---|
199 | case ShadowClass:
|
---|
200 | return compareCSSValues<CSSShadowValue>(*this, other);
|
---|
201 | case CubicBezierTimingFunctionClass:
|
---|
202 | return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, other);
|
---|
203 | case StepsTimingFunctionClass:
|
---|
204 | return compareCSSValues<CSSStepsTimingFunctionValue>(*this, other);
|
---|
205 | case SpringTimingFunctionClass:
|
---|
206 | return compareCSSValues<CSSSpringTimingFunctionValue>(*this, other);
|
---|
207 | case UnicodeRangeClass:
|
---|
208 | return compareCSSValues<CSSUnicodeRangeValue>(*this, other);
|
---|
209 | case ValueListClass:
|
---|
210 | return compareCSSValues<CSSValueList>(*this, other);
|
---|
211 | case LineBoxContainClass:
|
---|
212 | return compareCSSValues<CSSLineBoxContainValue>(*this, other);
|
---|
213 | case CalculationClass:
|
---|
214 | return compareCSSValues<CSSCalcValue>(*this, other);
|
---|
215 | case ImageSetClass:
|
---|
216 | return compareCSSValues<CSSImageSetValue>(*this, other);
|
---|
217 | case CSSContentDistributionClass:
|
---|
218 | return compareCSSValues<CSSContentDistributionValue>(*this, other);
|
---|
219 | case CustomPropertyClass:
|
---|
220 | return compareCSSValues<CSSCustomPropertyValue>(*this, other);
|
---|
221 | case VariableReferenceClass:
|
---|
222 | return compareCSSValues<CSSVariableReferenceValue>(*this, other);
|
---|
223 | case PendingSubstitutionValueClass:
|
---|
224 | return compareCSSValues<CSSPendingSubstitutionValue>(*this, other);
|
---|
225 | case OffsetRotateClass:
|
---|
226 | return compareCSSValues<CSSOffsetRotateValue>(*this, other);
|
---|
227 | case RayClass:
|
---|
228 | return compareCSSValues<CSSRayValue>(*this, other);
|
---|
229 | case FontStyleClass:
|
---|
230 | return compareCSSValues<CSSFontStyleValue>(*this, other);
|
---|
231 | case FontStyleRangeClass:
|
---|
232 | return compareCSSValues<CSSFontStyleRangeValue>(*this, other);
|
---|
233 | default:
|
---|
234 | ASSERT_NOT_REACHED();
|
---|
235 | return false;
|
---|
236 | }
|
---|
237 | } else if (is<CSSValueList>(*this) && !is<CSSValueList>(other))
|
---|
238 | return downcast<CSSValueList>(*this).equals(other);
|
---|
239 | else if (!is<CSSValueList>(*this) && is<CSSValueList>(other))
|
---|
240 | return static_cast<const CSSValueList&>(other).equals(*this);
|
---|
241 | return false;
|
---|
242 | }
|
---|
243 |
|
---|
244 | bool CSSValue::isCSSLocalURL(StringView relativeURL)
|
---|
245 | {
|
---|
246 | return relativeURL.isEmpty() || relativeURL.startsWith('#');
|
---|
247 | }
|
---|
248 |
|
---|
249 | String CSSValue::cssText(Document* document) const
|
---|
250 | {
|
---|
251 | switch (classType()) {
|
---|
252 | case AspectRatioClass:
|
---|
253 | return downcast<CSSAspectRatioValue>(*this).customCSSText();
|
---|
254 | case BorderImageSliceClass:
|
---|
255 | return downcast<CSSBorderImageSliceValue>(*this).customCSSText();
|
---|
256 | case BorderImageWidthClass:
|
---|
257 | return downcast<CSSBorderImageWidthValue>(*this).customCSSText();
|
---|
258 | case CanvasClass:
|
---|
259 | return downcast<CSSCanvasValue>(*this).customCSSText();
|
---|
260 | case NamedImageClass:
|
---|
261 | return downcast<CSSNamedImageValue>(*this).customCSSText();
|
---|
262 | case CursorImageClass:
|
---|
263 | return downcast<CSSCursorImageValue>(*this).customCSSText();
|
---|
264 | case FilterImageClass:
|
---|
265 | return downcast<CSSFilterImageValue>(*this).customCSSText();
|
---|
266 | #if ENABLE(CSS_PAINTING_API)
|
---|
267 | case PaintImageClass:
|
---|
268 | return downcast<CSSPaintImageValue>(*this).customCSSText();
|
---|
269 | #endif
|
---|
270 | case FontClass:
|
---|
271 | return downcast<CSSFontValue>(*this).customCSSText();
|
---|
272 | case FontFaceSrcClass:
|
---|
273 | return downcast<CSSFontFaceSrcValue>(*this).customCSSText();
|
---|
274 | case FontPaletteValuesOverrideColorsClass:
|
---|
275 | return downcast<CSSFontPaletteValuesOverrideColorsValue>(*this).customCSSText();
|
---|
276 | case FontFeatureClass:
|
---|
277 | return downcast<CSSFontFeatureValue>(*this).customCSSText();
|
---|
278 | case FontVariationClass:
|
---|
279 | return downcast<CSSFontVariationValue>(*this).customCSSText();
|
---|
280 | case FunctionClass:
|
---|
281 | return downcast<CSSFunctionValue>(*this).customCSSText(document);
|
---|
282 | case LinearGradientClass:
|
---|
283 | return downcast<CSSLinearGradientValue>(*this).customCSSText();
|
---|
284 | case RadialGradientClass:
|
---|
285 | return downcast<CSSRadialGradientValue>(*this).customCSSText();
|
---|
286 | case ConicGradientClass:
|
---|
287 | return downcast<CSSConicGradientValue>(*this).customCSSText();
|
---|
288 | case CrossfadeClass:
|
---|
289 | return downcast<CSSCrossfadeValue>(*this).customCSSText();
|
---|
290 | case ImageClass:
|
---|
291 | return downcast<CSSImageValue>(*this).customCSSText();
|
---|
292 | case GridAutoRepeatClass:
|
---|
293 | return downcast<CSSGridAutoRepeatValue>(*this).customCSSText();
|
---|
294 | case GridIntegerRepeatClass:
|
---|
295 | return downcast<CSSGridIntegerRepeatValue>(*this).customCSSText();
|
---|
296 | case GridLineNamesClass:
|
---|
297 | return downcast<CSSGridLineNamesValue>(*this).customCSSText();
|
---|
298 | case SubgridClass:
|
---|
299 | return downcast<CSSSubgridValue>(*this).customCSSText();
|
---|
300 | case GridTemplateAreasClass:
|
---|
301 | return downcast<CSSGridTemplateAreasValue>(*this).customCSSText();
|
---|
302 | case PrimitiveClass:
|
---|
303 | return downcast<CSSPrimitiveValue>(*this).customCSSText(document);
|
---|
304 | case ReflectClass:
|
---|
305 | return downcast<CSSReflectValue>(*this).customCSSText();
|
---|
306 | case ShadowClass:
|
---|
307 | return downcast<CSSShadowValue>(*this).customCSSText();
|
---|
308 | case CubicBezierTimingFunctionClass:
|
---|
309 | return downcast<CSSCubicBezierTimingFunctionValue>(*this).customCSSText();
|
---|
310 | case StepsTimingFunctionClass:
|
---|
311 | return downcast<CSSStepsTimingFunctionValue>(*this).customCSSText();
|
---|
312 | case SpringTimingFunctionClass:
|
---|
313 | return downcast<CSSSpringTimingFunctionValue>(*this).customCSSText();
|
---|
314 | case UnicodeRangeClass:
|
---|
315 | return downcast<CSSUnicodeRangeValue>(*this).customCSSText();
|
---|
316 | case ValueListClass:
|
---|
317 | return downcast<CSSValueList>(*this).customCSSText(document);
|
---|
318 | case ValuePairClass:
|
---|
319 | return downcast<CSSValuePair>(*this).customCSSText();
|
---|
320 | case LineBoxContainClass:
|
---|
321 | return downcast<CSSLineBoxContainValue>(*this).customCSSText();
|
---|
322 | case CalculationClass:
|
---|
323 | return downcast<CSSCalcValue>(*this).customCSSText();
|
---|
324 | case ImageSetClass:
|
---|
325 | return downcast<CSSImageSetValue>(*this).customCSSText();
|
---|
326 | case CSSContentDistributionClass:
|
---|
327 | return downcast<CSSContentDistributionValue>(*this).customCSSText();
|
---|
328 | case CustomPropertyClass:
|
---|
329 | return downcast<CSSCustomPropertyValue>(*this).customCSSText();
|
---|
330 | case VariableReferenceClass:
|
---|
331 | return downcast<CSSVariableReferenceValue>(*this).customCSSText();
|
---|
332 | case PendingSubstitutionValueClass:
|
---|
333 | return downcast<CSSPendingSubstitutionValue>(*this).customCSSText();
|
---|
334 | case OffsetRotateClass:
|
---|
335 | return downcast<CSSOffsetRotateValue>(*this).customCSSText();
|
---|
336 | case RayClass:
|
---|
337 | return downcast<CSSRayValue>(*this).customCSSText();
|
---|
338 | case FontStyleClass:
|
---|
339 | return downcast<CSSFontStyleValue>(*this).customCSSText();
|
---|
340 | case FontStyleRangeClass:
|
---|
341 | return downcast<CSSFontStyleRangeValue>(*this).customCSSText();
|
---|
342 | }
|
---|
343 |
|
---|
344 | ASSERT_NOT_REACHED();
|
---|
345 | return String();
|
---|
346 | }
|
---|
347 |
|
---|
348 | ASCIILiteral CSSValue::separatorCSSText() const
|
---|
349 | {
|
---|
350 | switch (m_valueSeparator) {
|
---|
351 | case SpaceSeparator:
|
---|
352 | return " "_s;
|
---|
353 | case CommaSeparator:
|
---|
354 | return ", "_s;
|
---|
355 | case SlashSeparator:
|
---|
356 | return " / "_s;
|
---|
357 | default:
|
---|
358 | ASSERT_NOT_REACHED();
|
---|
359 | }
|
---|
360 | return " "_s;
|
---|
361 | }
|
---|
362 |
|
---|
363 | void CSSValue::destroy()
|
---|
364 | {
|
---|
365 | switch (classType()) {
|
---|
366 | case AspectRatioClass:
|
---|
367 | delete downcast<CSSAspectRatioValue>(this);
|
---|
368 | return;
|
---|
369 | case BorderImageSliceClass:
|
---|
370 | delete downcast<CSSBorderImageSliceValue>(this);
|
---|
371 | return;
|
---|
372 | case BorderImageWidthClass:
|
---|
373 | delete downcast<CSSBorderImageWidthValue>(this);
|
---|
374 | return;
|
---|
375 | case CanvasClass:
|
---|
376 | delete downcast<CSSCanvasValue>(this);
|
---|
377 | return;
|
---|
378 | case NamedImageClass:
|
---|
379 | delete downcast<CSSNamedImageValue>(this);
|
---|
380 | return;
|
---|
381 | case CursorImageClass:
|
---|
382 | delete downcast<CSSCursorImageValue>(this);
|
---|
383 | return;
|
---|
384 | case FontClass:
|
---|
385 | delete downcast<CSSFontValue>(this);
|
---|
386 | return;
|
---|
387 | case FontFaceSrcClass:
|
---|
388 | delete downcast<CSSFontFaceSrcValue>(this);
|
---|
389 | return;
|
---|
390 | case FontPaletteValuesOverrideColorsClass:
|
---|
391 | delete downcast<CSSFontPaletteValuesOverrideColorsValue>(this);
|
---|
392 | return;
|
---|
393 | case FontFeatureClass:
|
---|
394 | delete downcast<CSSFontFeatureValue>(this);
|
---|
395 | return;
|
---|
396 | case FontVariationClass:
|
---|
397 | delete downcast<CSSFontVariationValue>(this);
|
---|
398 | return;
|
---|
399 | case FunctionClass:
|
---|
400 | delete downcast<CSSFunctionValue>(this);
|
---|
401 | return;
|
---|
402 | case LinearGradientClass:
|
---|
403 | delete downcast<CSSLinearGradientValue>(this);
|
---|
404 | return;
|
---|
405 | case RadialGradientClass:
|
---|
406 | delete downcast<CSSRadialGradientValue>(this);
|
---|
407 | return;
|
---|
408 | case ConicGradientClass:
|
---|
409 | delete downcast<CSSConicGradientValue>(this);
|
---|
410 | return;
|
---|
411 | case CrossfadeClass:
|
---|
412 | delete downcast<CSSCrossfadeValue>(this);
|
---|
413 | return;
|
---|
414 | case ImageClass:
|
---|
415 | delete downcast<CSSImageValue>(this);
|
---|
416 | return;
|
---|
417 | case GridAutoRepeatClass:
|
---|
418 | delete downcast<CSSGridAutoRepeatValue>(this);
|
---|
419 | return;
|
---|
420 | case GridIntegerRepeatClass:
|
---|
421 | delete downcast<CSSGridIntegerRepeatValue>(this);
|
---|
422 | return;
|
---|
423 | case GridLineNamesClass:
|
---|
424 | delete downcast<CSSGridLineNamesValue>(this);
|
---|
425 | return;
|
---|
426 | case SubgridClass:
|
---|
427 | delete downcast<CSSSubgridValue>(this);
|
---|
428 | return;
|
---|
429 | case GridTemplateAreasClass:
|
---|
430 | delete downcast<CSSGridTemplateAreasValue>(this);
|
---|
431 | return;
|
---|
432 | case PrimitiveClass:
|
---|
433 | delete downcast<CSSPrimitiveValue>(this);
|
---|
434 | return;
|
---|
435 | case ReflectClass:
|
---|
436 | delete downcast<CSSReflectValue>(this);
|
---|
437 | return;
|
---|
438 | case ShadowClass:
|
---|
439 | delete downcast<CSSShadowValue>(this);
|
---|
440 | return;
|
---|
441 | case CubicBezierTimingFunctionClass:
|
---|
442 | delete downcast<CSSCubicBezierTimingFunctionValue>(this);
|
---|
443 | return;
|
---|
444 | case StepsTimingFunctionClass:
|
---|
445 | delete downcast<CSSStepsTimingFunctionValue>(this);
|
---|
446 | return;
|
---|
447 | case SpringTimingFunctionClass:
|
---|
448 | delete downcast<CSSSpringTimingFunctionValue>(this);
|
---|
449 | return;
|
---|
450 | case UnicodeRangeClass:
|
---|
451 | delete downcast<CSSUnicodeRangeValue>(this);
|
---|
452 | return;
|
---|
453 | case ValueListClass:
|
---|
454 | delete downcast<CSSValueList>(this);
|
---|
455 | return;
|
---|
456 | case ValuePairClass:
|
---|
457 | delete downcast<CSSValuePair>(this);
|
---|
458 | return;
|
---|
459 | case LineBoxContainClass:
|
---|
460 | delete downcast<CSSLineBoxContainValue>(this);
|
---|
461 | return;
|
---|
462 | case CalculationClass:
|
---|
463 | delete downcast<CSSCalcValue>(this);
|
---|
464 | return;
|
---|
465 | case ImageSetClass:
|
---|
466 | delete downcast<CSSImageSetValue>(this);
|
---|
467 | return;
|
---|
468 | case FilterImageClass:
|
---|
469 | delete downcast<CSSFilterImageValue>(this);
|
---|
470 | return;
|
---|
471 | #if ENABLE(CSS_PAINTING_API)
|
---|
472 | case PaintImageClass:
|
---|
473 | delete downcast<CSSPaintImageValue>(this);
|
---|
474 | return;
|
---|
475 | #endif
|
---|
476 | case CSSContentDistributionClass:
|
---|
477 | delete downcast<CSSContentDistributionValue>(this);
|
---|
478 | return;
|
---|
479 | case CustomPropertyClass:
|
---|
480 | delete downcast<CSSCustomPropertyValue>(this);
|
---|
481 | return;
|
---|
482 | case VariableReferenceClass:
|
---|
483 | delete downcast<CSSVariableReferenceValue>(this);
|
---|
484 | return;
|
---|
485 | case PendingSubstitutionValueClass:
|
---|
486 | delete downcast<CSSPendingSubstitutionValue>(this);
|
---|
487 | return;
|
---|
488 | case OffsetRotateClass:
|
---|
489 | delete downcast<CSSOffsetRotateValue>(this);
|
---|
490 | return;
|
---|
491 | case RayClass:
|
---|
492 | delete downcast<CSSRayValue>(this);
|
---|
493 | return;
|
---|
494 | case FontStyleClass:
|
---|
495 | delete downcast<CSSFontStyleValue>(this);
|
---|
496 | return;
|
---|
497 | case FontStyleRangeClass:
|
---|
498 | delete downcast<CSSFontStyleRangeValue>(this);
|
---|
499 | return;
|
---|
500 | }
|
---|
501 | ASSERT_NOT_REACHED();
|
---|
502 | }
|
---|
503 |
|
---|
504 | Ref<DeprecatedCSSOMValue> CSSValue::createDeprecatedCSSOMWrapper(CSSStyleDeclaration& styleDeclaration) const
|
---|
505 | {
|
---|
506 | if (isImageValue())
|
---|
507 | return downcast<CSSImageValue>(this)->createDeprecatedCSSOMWrapper(styleDeclaration);
|
---|
508 | if (isPrimitiveValue())
|
---|
509 | return DeprecatedCSSOMPrimitiveValue::create(downcast<CSSPrimitiveValue>(*this), styleDeclaration);
|
---|
510 | if (isValueList())
|
---|
511 | return DeprecatedCSSOMValueList::create(downcast<CSSValueList>(*this), styleDeclaration);
|
---|
512 | return DeprecatedCSSOMComplexValue::create(*this, styleDeclaration);
|
---|
513 | }
|
---|
514 |
|
---|
515 | bool CSSValue::treatAsInheritedValue(CSSPropertyID propertyID) const
|
---|
516 | {
|
---|
517 | return isInheritValue() || (isUnsetValue() && CSSProperty::isInheritedProperty(propertyID));
|
---|
518 | }
|
---|
519 |
|
---|
520 | bool CSSValue::treatAsInitialValue(CSSPropertyID propertyID) const
|
---|
521 | {
|
---|
522 | return isInitialValue() || (isUnsetValue() && !CSSProperty::isInheritedProperty(propertyID));
|
---|
523 | }
|
---|
524 |
|
---|
525 | bool CSSValue::isInitialValue() const
|
---|
526 | {
|
---|
527 | return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isInitialValue();
|
---|
528 | }
|
---|
529 |
|
---|
530 | bool CSSValue::isImplicitInitialValue() const
|
---|
531 | {
|
---|
532 | return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isImplicitInitialValue();
|
---|
533 | }
|
---|
534 |
|
---|
535 | bool CSSValue::isInheritValue() const
|
---|
536 | {
|
---|
537 | return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isInheritValue();
|
---|
538 | }
|
---|
539 |
|
---|
540 | bool CSSValue::isUnsetValue() const
|
---|
541 | {
|
---|
542 | return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isUnsetValue();
|
---|
543 | }
|
---|
544 |
|
---|
545 | bool CSSValue::isRevertValue() const
|
---|
546 | {
|
---|
547 | return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isRevertValue();
|
---|
548 | }
|
---|
549 |
|
---|
550 | bool CSSValue::isRevertLayerValue() const
|
---|
551 | {
|
---|
552 | return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isRevertLayerValue();
|
---|
553 | }
|
---|
554 |
|
---|
555 | bool CSSValue::isCSSWideKeyword() const
|
---|
556 | {
|
---|
557 | return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isCSSWideKeyword();
|
---|
558 | }
|
---|
559 |
|
---|
560 |
|
---|
561 | }
|
---|