1 /*
2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org)
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 */
26
27 #include "config.h"
28 #include "core/css/CSSValue.h"
29
30 #include "core/css/CSSArrayFunctionValue.h"
31 #include "core/css/CSSAspectRatioValue.h"
32 #include "core/css/CSSBorderImageSliceValue.h"
33 #include "core/css/CSSCalculationValue.h"
34 #include "core/css/CSSCanvasValue.h"
35 #include "core/css/CSSCrossfadeValue.h"
36 #include "core/css/CSSCursorImageValue.h"
37 #include "core/css/CSSFilterValue.h"
38 #include "core/css/CSSFontFaceSrcValue.h"
39 #include "core/css/CSSFontFeatureValue.h"
40 #include "core/css/CSSFontValue.h"
41 #include "core/css/CSSFunctionValue.h"
42 #include "core/css/CSSGradientValue.h"
43 #include "core/css/CSSGridLineNamesValue.h"
44 #include "core/css/CSSGridTemplateAreasValue.h"
45 #include "core/css/CSSImageSetValue.h"
46 #include "core/css/CSSImageValue.h"
47 #include "core/css/CSSInheritedValue.h"
48 #include "core/css/CSSInitialValue.h"
49 #include "core/css/CSSLineBoxContainValue.h"
50 #include "core/css/CSSPrimitiveValue.h"
51 #include "core/css/CSSReflectValue.h"
52 #include "core/css/CSSSVGDocumentValue.h"
53 #include "core/css/CSSShadowValue.h"
54 #include "core/css/CSSTimingFunctionValue.h"
55 #include "core/css/CSSTransformValue.h"
56 #include "core/css/CSSUnicodeRangeValue.h"
57 #include "core/css/CSSValueList.h"
58 #include "core/svg/SVGPaint.h"
59
60 namespace WebCore {
61
62 struct SameSizeAsCSSValue : public RefCountedWillBeGarbageCollectedFinalized<SameSizeAsCSSValue> {
63 uint32_t bitfields;
64 };
65
66 COMPILE_ASSERT(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small);
67
68 class TextCloneCSSValue : public CSSValue {
69 public:
create(ClassType classType,const String & text)70 static PassRefPtrWillBeRawPtr<TextCloneCSSValue> create(ClassType classType, const String& text)
71 {
72 return adoptRefWillBeNoop(new TextCloneCSSValue(classType, text));
73 }
74
cssText() const75 String cssText() const { return m_cssText; }
76
traceAfterDispatch(Visitor * visitor)77 void traceAfterDispatch(Visitor* visitor) { CSSValue::traceAfterDispatch(visitor); }
78
79 private:
TextCloneCSSValue(ClassType classType,const String & text)80 TextCloneCSSValue(ClassType classType, const String& text)
81 : CSSValue(classType, /*isCSSOMSafe*/ true)
82 , m_cssText(text)
83 {
84 m_isTextClone = true;
85 }
86
87 String m_cssText;
88 };
89
90 DEFINE_CSS_VALUE_TYPE_CASTS(TextCloneCSSValue, isTextCloneCSSValue());
91
isImplicitInitialValue() const92 bool CSSValue::isImplicitInitialValue() const
93 {
94 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit();
95 }
96
cssValueType() const97 CSSValue::Type CSSValue::cssValueType() const
98 {
99 if (isInheritedValue())
100 return CSS_INHERIT;
101 if (isPrimitiveValue())
102 return CSS_PRIMITIVE_VALUE;
103 if (isValueList())
104 return CSS_VALUE_LIST;
105 if (isInitialValue())
106 return CSS_INITIAL;
107 return CSS_CUSTOM;
108 }
109
hasFailedOrCanceledSubresources() const110 bool CSSValue::hasFailedOrCanceledSubresources() const
111 {
112 // This should get called for internal instances only.
113 ASSERT(!isCSSOMSafe());
114
115 if (isValueList())
116 return toCSSValueList(this)->hasFailedOrCanceledSubresources();
117 if (classType() == FontFaceSrcClass)
118 return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources();
119 if (classType() == ImageClass)
120 return toCSSImageValue(this)->hasFailedOrCanceledSubresources();
121 if (classType() == CrossfadeClass)
122 return toCSSCrossfadeValue(this)->hasFailedOrCanceledSubresources();
123 if (classType() == ImageSetClass)
124 return toCSSImageSetValue(this)->hasFailedOrCanceledSubresources();
125
126 return false;
127 }
128
129 template<class ChildClassType>
compareCSSValues(const CSSValue & first,const CSSValue & second)130 inline static bool compareCSSValues(const CSSValue& first, const CSSValue& second)
131 {
132 return static_cast<const ChildClassType&>(first).equals(static_cast<const ChildClassType&>(second));
133 }
134
equals(const CSSValue & other) const135 bool CSSValue::equals(const CSSValue& other) const
136 {
137 if (m_isTextClone) {
138 ASSERT(isCSSOMSafe());
139 return toTextCloneCSSValue(this)->cssText() == other.cssText();
140 }
141
142 if (m_classType == other.m_classType) {
143 switch (m_classType) {
144 case AspectRatioClass:
145 return compareCSSValues<CSSAspectRatioValue>(*this, other);
146 case BorderImageSliceClass:
147 return compareCSSValues<CSSBorderImageSliceValue>(*this, other);
148 case CanvasClass:
149 return compareCSSValues<CSSCanvasValue>(*this, other);
150 case CursorImageClass:
151 return compareCSSValues<CSSCursorImageValue>(*this, other);
152 case FontClass:
153 return compareCSSValues<CSSFontValue>(*this, other);
154 case FontFaceSrcClass:
155 return compareCSSValues<CSSFontFaceSrcValue>(*this, other);
156 case FontFeatureClass:
157 return compareCSSValues<CSSFontFeatureValue>(*this, other);
158 case FunctionClass:
159 return compareCSSValues<CSSFunctionValue>(*this, other);
160 case LinearGradientClass:
161 return compareCSSValues<CSSLinearGradientValue>(*this, other);
162 case RadialGradientClass:
163 return compareCSSValues<CSSRadialGradientValue>(*this, other);
164 case CrossfadeClass:
165 return compareCSSValues<CSSCrossfadeValue>(*this, other);
166 case ImageClass:
167 return compareCSSValues<CSSImageValue>(*this, other);
168 case InheritedClass:
169 return compareCSSValues<CSSInheritedValue>(*this, other);
170 case InitialClass:
171 return compareCSSValues<CSSInitialValue>(*this, other);
172 case GridLineNamesClass:
173 return compareCSSValues<CSSGridLineNamesValue>(*this, other);
174 case GridTemplateAreasClass:
175 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other);
176 case PrimitiveClass:
177 return compareCSSValues<CSSPrimitiveValue>(*this, other);
178 case ReflectClass:
179 return compareCSSValues<CSSReflectValue>(*this, other);
180 case ShadowClass:
181 return compareCSSValues<CSSShadowValue>(*this, other);
182 case CubicBezierTimingFunctionClass:
183 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, other);
184 case StepsTimingFunctionClass:
185 return compareCSSValues<CSSStepsTimingFunctionValue>(*this, other);
186 case UnicodeRangeClass:
187 return compareCSSValues<CSSUnicodeRangeValue>(*this, other);
188 case ValueListClass:
189 return compareCSSValues<CSSValueList>(*this, other);
190 case CSSTransformClass:
191 return compareCSSValues<CSSTransformValue>(*this, other);
192 case LineBoxContainClass:
193 return compareCSSValues<CSSLineBoxContainValue>(*this, other);
194 case CalculationClass:
195 return compareCSSValues<CSSCalcValue>(*this, other);
196 case ImageSetClass:
197 return compareCSSValues<CSSImageSetValue>(*this, other);
198 case CSSFilterClass:
199 return compareCSSValues<CSSFilterValue>(*this, other);
200 case CSSArrayFunctionValueClass:
201 return compareCSSValues<CSSArrayFunctionValue>(*this, other);
202 case SVGPaintClass:
203 return compareCSSValues<SVGPaint>(*this, other);
204 case CSSSVGDocumentClass:
205 return compareCSSValues<CSSSVGDocumentValue>(*this, other);
206 default:
207 ASSERT_NOT_REACHED();
208 return false;
209 }
210 } else if (m_classType == ValueListClass && other.m_classType != ValueListClass)
211 return toCSSValueList(this)->equals(other);
212 else if (m_classType != ValueListClass && other.m_classType == ValueListClass)
213 return static_cast<const CSSValueList&>(other).equals(*this);
214 return false;
215 }
216
cssText() const217 String CSSValue::cssText() const
218 {
219 if (m_isTextClone) {
220 ASSERT(isCSSOMSafe());
221 return toTextCloneCSSValue(this)->cssText();
222 }
223 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
224
225 switch (classType()) {
226 case AspectRatioClass:
227 return toCSSAspectRatioValue(this)->customCSSText();
228 case BorderImageSliceClass:
229 return toCSSBorderImageSliceValue(this)->customCSSText();
230 case CanvasClass:
231 return toCSSCanvasValue(this)->customCSSText();
232 case CursorImageClass:
233 return toCSSCursorImageValue(this)->customCSSText();
234 case FontClass:
235 return toCSSFontValue(this)->customCSSText();
236 case FontFaceSrcClass:
237 return toCSSFontFaceSrcValue(this)->customCSSText();
238 case FontFeatureClass:
239 return toCSSFontFeatureValue(this)->customCSSText();
240 case FunctionClass:
241 return toCSSFunctionValue(this)->customCSSText();
242 case LinearGradientClass:
243 return toCSSLinearGradientValue(this)->customCSSText();
244 case RadialGradientClass:
245 return toCSSRadialGradientValue(this)->customCSSText();
246 case CrossfadeClass:
247 return toCSSCrossfadeValue(this)->customCSSText();
248 case ImageClass:
249 return toCSSImageValue(this)->customCSSText();
250 case InheritedClass:
251 return toCSSInheritedValue(this)->customCSSText();
252 case InitialClass:
253 return toCSSInitialValue(this)->customCSSText();
254 case GridLineNamesClass:
255 return toCSSGridLineNamesValue(this)->customCSSText();
256 case GridTemplateAreasClass:
257 return toCSSGridTemplateAreasValue(this)->customCSSText();
258 case PrimitiveClass:
259 return toCSSPrimitiveValue(this)->customCSSText();
260 case ReflectClass:
261 return toCSSReflectValue(this)->customCSSText();
262 case ShadowClass:
263 return toCSSShadowValue(this)->customCSSText();
264 case CubicBezierTimingFunctionClass:
265 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText();
266 case StepsTimingFunctionClass:
267 return toCSSStepsTimingFunctionValue(this)->customCSSText();
268 case UnicodeRangeClass:
269 return toCSSUnicodeRangeValue(this)->customCSSText();
270 case ValueListClass:
271 return toCSSValueList(this)->customCSSText();
272 case CSSTransformClass:
273 return toCSSTransformValue(this)->customCSSText();
274 case LineBoxContainClass:
275 return toCSSLineBoxContainValue(this)->customCSSText();
276 case CalculationClass:
277 return toCSSCalcValue(this)->customCSSText();
278 case ImageSetClass:
279 return toCSSImageSetValue(this)->customCSSText();
280 case CSSFilterClass:
281 return toCSSFilterValue(this)->customCSSText();
282 case CSSArrayFunctionValueClass:
283 return toCSSArrayFunctionValue(this)->customCSSText();
284 case SVGPaintClass:
285 return toSVGPaint(this)->customCSSText();
286 case CSSSVGDocumentClass:
287 return toCSSSVGDocumentValue(this)->customCSSText();
288 }
289 ASSERT_NOT_REACHED();
290 return String();
291 }
292
destroy()293 void CSSValue::destroy()
294 {
295 if (m_isTextClone) {
296 ASSERT(isCSSOMSafe());
297 delete toTextCloneCSSValue(this);
298 return;
299 }
300 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
301
302 switch (classType()) {
303 case AspectRatioClass:
304 delete toCSSAspectRatioValue(this);
305 return;
306 case BorderImageSliceClass:
307 delete toCSSBorderImageSliceValue(this);
308 return;
309 case CanvasClass:
310 delete toCSSCanvasValue(this);
311 return;
312 case CursorImageClass:
313 delete toCSSCursorImageValue(this);
314 return;
315 case FontClass:
316 delete toCSSFontValue(this);
317 return;
318 case FontFaceSrcClass:
319 delete toCSSFontFaceSrcValue(this);
320 return;
321 case FontFeatureClass:
322 delete toCSSFontFeatureValue(this);
323 return;
324 case FunctionClass:
325 delete toCSSFunctionValue(this);
326 return;
327 case LinearGradientClass:
328 delete toCSSLinearGradientValue(this);
329 return;
330 case RadialGradientClass:
331 delete toCSSRadialGradientValue(this);
332 return;
333 case CrossfadeClass:
334 delete toCSSCrossfadeValue(this);
335 return;
336 case ImageClass:
337 delete toCSSImageValue(this);
338 return;
339 case InheritedClass:
340 delete toCSSInheritedValue(this);
341 return;
342 case InitialClass:
343 delete toCSSInitialValue(this);
344 return;
345 case GridLineNamesClass:
346 delete toCSSGridLineNamesValue(this);
347 return;
348 case GridTemplateAreasClass:
349 delete toCSSGridTemplateAreasValue(this);
350 return;
351 case PrimitiveClass:
352 delete toCSSPrimitiveValue(this);
353 return;
354 case ReflectClass:
355 delete toCSSReflectValue(this);
356 return;
357 case ShadowClass:
358 delete toCSSShadowValue(this);
359 return;
360 case CubicBezierTimingFunctionClass:
361 delete toCSSCubicBezierTimingFunctionValue(this);
362 return;
363 case StepsTimingFunctionClass:
364 delete toCSSStepsTimingFunctionValue(this);
365 return;
366 case UnicodeRangeClass:
367 delete toCSSUnicodeRangeValue(this);
368 return;
369 case ValueListClass:
370 delete toCSSValueList(this);
371 return;
372 case CSSTransformClass:
373 delete toCSSTransformValue(this);
374 return;
375 case LineBoxContainClass:
376 delete toCSSLineBoxContainValue(this);
377 return;
378 case CalculationClass:
379 delete toCSSCalcValue(this);
380 return;
381 case ImageSetClass:
382 delete toCSSImageSetValue(this);
383 return;
384 case CSSFilterClass:
385 delete toCSSFilterValue(this);
386 return;
387 case CSSArrayFunctionValueClass:
388 delete toCSSArrayFunctionValue(this);
389 return;
390 case SVGPaintClass:
391 delete toSVGPaint(this);
392 return;
393 case CSSSVGDocumentClass:
394 delete toCSSSVGDocumentValue(this);
395 return;
396 }
397 ASSERT_NOT_REACHED();
398 }
399
finalizeGarbageCollectedObject()400 void CSSValue::finalizeGarbageCollectedObject()
401 {
402 if (m_isTextClone) {
403 ASSERT(isCSSOMSafe());
404 static_cast<TextCloneCSSValue*>(this)->~TextCloneCSSValue();
405 return;
406 }
407 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
408
409 switch (classType()) {
410 case AspectRatioClass:
411 toCSSAspectRatioValue(this)->~CSSAspectRatioValue();
412 return;
413 case BorderImageSliceClass:
414 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue();
415 return;
416 case CanvasClass:
417 toCSSCanvasValue(this)->~CSSCanvasValue();
418 return;
419 case CursorImageClass:
420 toCSSCursorImageValue(this)->~CSSCursorImageValue();
421 return;
422 case FontClass:
423 toCSSFontValue(this)->~CSSFontValue();
424 return;
425 case FontFaceSrcClass:
426 toCSSFontFaceSrcValue(this)->~CSSFontFaceSrcValue();
427 return;
428 case FontFeatureClass:
429 toCSSFontFeatureValue(this)->~CSSFontFeatureValue();
430 return;
431 case FunctionClass:
432 toCSSFunctionValue(this)->~CSSFunctionValue();
433 return;
434 case LinearGradientClass:
435 toCSSLinearGradientValue(this)->~CSSLinearGradientValue();
436 return;
437 case RadialGradientClass:
438 toCSSRadialGradientValue(this)->~CSSRadialGradientValue();
439 return;
440 case CrossfadeClass:
441 toCSSCrossfadeValue(this)->~CSSCrossfadeValue();
442 return;
443 case ImageClass:
444 toCSSImageValue(this)->~CSSImageValue();
445 return;
446 case InheritedClass:
447 toCSSInheritedValue(this)->~CSSInheritedValue();
448 return;
449 case InitialClass:
450 toCSSInitialValue(this)->~CSSInitialValue();
451 return;
452 case GridLineNamesClass:
453 toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue();
454 return;
455 case GridTemplateAreasClass:
456 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue();
457 return;
458 case PrimitiveClass:
459 toCSSPrimitiveValue(this)->~CSSPrimitiveValue();
460 return;
461 case ReflectClass:
462 toCSSReflectValue(this)->~CSSReflectValue();
463 return;
464 case ShadowClass:
465 toCSSShadowValue(this)->~CSSShadowValue();
466 return;
467 case CubicBezierTimingFunctionClass:
468 toCSSCubicBezierTimingFunctionValue(this)->~CSSCubicBezierTimingFunctionValue();
469 return;
470 case StepsTimingFunctionClass:
471 toCSSStepsTimingFunctionValue(this)->~CSSStepsTimingFunctionValue();
472 return;
473 case UnicodeRangeClass:
474 toCSSUnicodeRangeValue(this)->~CSSUnicodeRangeValue();
475 return;
476 case ValueListClass:
477 toCSSValueList(this)->~CSSValueList();
478 return;
479 case CSSTransformClass:
480 toCSSTransformValue(this)->~CSSTransformValue();
481 return;
482 case LineBoxContainClass:
483 toCSSLineBoxContainValue(this)->~CSSLineBoxContainValue();
484 return;
485 case CalculationClass:
486 toCSSCalcValue(this)->~CSSCalcValue();
487 return;
488 case ImageSetClass:
489 toCSSImageSetValue(this)->~CSSImageSetValue();
490 return;
491 case CSSFilterClass:
492 toCSSFilterValue(this)->~CSSFilterValue();
493 return;
494 case CSSArrayFunctionValueClass:
495 toCSSArrayFunctionValue(this)->~CSSArrayFunctionValue();
496 return;
497 case SVGPaintClass:
498 toSVGPaint(this)->~SVGPaint();
499 return;
500 case CSSSVGDocumentClass:
501 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue();
502 return;
503 }
504 ASSERT_NOT_REACHED();
505 }
506
trace(Visitor * visitor)507 void CSSValue::trace(Visitor* visitor)
508 {
509 if (m_isTextClone) {
510 ASSERT(isCSSOMSafe());
511 static_cast<TextCloneCSSValue*>(this)->traceAfterDispatch(visitor);
512 return;
513 }
514 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
515
516 switch (classType()) {
517 case AspectRatioClass:
518 toCSSAspectRatioValue(this)->traceAfterDispatch(visitor);
519 return;
520 case BorderImageSliceClass:
521 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor);
522 return;
523 case CanvasClass:
524 toCSSCanvasValue(this)->traceAfterDispatch(visitor);
525 return;
526 case CursorImageClass:
527 toCSSCursorImageValue(this)->traceAfterDispatch(visitor);
528 return;
529 case FontClass:
530 toCSSFontValue(this)->traceAfterDispatch(visitor);
531 return;
532 case FontFaceSrcClass:
533 toCSSFontFaceSrcValue(this)->traceAfterDispatch(visitor);
534 return;
535 case FontFeatureClass:
536 toCSSFontFeatureValue(this)->traceAfterDispatch(visitor);
537 return;
538 case FunctionClass:
539 toCSSFunctionValue(this)->traceAfterDispatch(visitor);
540 return;
541 case LinearGradientClass:
542 toCSSLinearGradientValue(this)->traceAfterDispatch(visitor);
543 return;
544 case RadialGradientClass:
545 toCSSRadialGradientValue(this)->traceAfterDispatch(visitor);
546 return;
547 case CrossfadeClass:
548 toCSSCrossfadeValue(this)->traceAfterDispatch(visitor);
549 return;
550 case ImageClass:
551 toCSSImageValue(this)->traceAfterDispatch(visitor);
552 return;
553 case InheritedClass:
554 toCSSInheritedValue(this)->traceAfterDispatch(visitor);
555 return;
556 case InitialClass:
557 toCSSInitialValue(this)->traceAfterDispatch(visitor);
558 return;
559 case GridLineNamesClass:
560 toCSSGridLineNamesValue(this)->traceAfterDispatch(visitor);
561 return;
562 case GridTemplateAreasClass:
563 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor);
564 return;
565 case PrimitiveClass:
566 toCSSPrimitiveValue(this)->traceAfterDispatch(visitor);
567 return;
568 case ReflectClass:
569 toCSSReflectValue(this)->traceAfterDispatch(visitor);
570 return;
571 case ShadowClass:
572 toCSSShadowValue(this)->traceAfterDispatch(visitor);
573 return;
574 case CubicBezierTimingFunctionClass:
575 toCSSCubicBezierTimingFunctionValue(this)->traceAfterDispatch(visitor);
576 return;
577 case StepsTimingFunctionClass:
578 toCSSStepsTimingFunctionValue(this)->traceAfterDispatch(visitor);
579 return;
580 case UnicodeRangeClass:
581 toCSSUnicodeRangeValue(this)->traceAfterDispatch(visitor);
582 return;
583 case ValueListClass:
584 toCSSValueList(this)->traceAfterDispatch(visitor);
585 return;
586 case CSSTransformClass:
587 toCSSTransformValue(this)->traceAfterDispatch(visitor);
588 return;
589 case LineBoxContainClass:
590 toCSSLineBoxContainValue(this)->traceAfterDispatch(visitor);
591 return;
592 case CalculationClass:
593 toCSSCalcValue(this)->traceAfterDispatch(visitor);
594 return;
595 case ImageSetClass:
596 toCSSImageSetValue(this)->traceAfterDispatch(visitor);
597 return;
598 case CSSFilterClass:
599 toCSSFilterValue(this)->traceAfterDispatch(visitor);
600 return;
601 case CSSArrayFunctionValueClass:
602 toCSSArrayFunctionValue(this)->traceAfterDispatch(visitor);
603 return;
604 case SVGPaintClass:
605 toSVGPaint(this)->traceAfterDispatch(visitor);
606 return;
607 case CSSSVGDocumentClass:
608 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor);
609 return;
610 }
611 ASSERT_NOT_REACHED();
612 }
613
cloneForCSSOM() const614 PassRefPtrWillBeRawPtr<CSSValue> CSSValue::cloneForCSSOM() const
615 {
616 switch (classType()) {
617 case PrimitiveClass:
618 return toCSSPrimitiveValue(this)->cloneForCSSOM();
619 case ValueListClass:
620 return toCSSValueList(this)->cloneForCSSOM();
621 case ImageClass:
622 case CursorImageClass:
623 return toCSSImageValue(this)->cloneForCSSOM();
624 case CSSFilterClass:
625 return toCSSFilterValue(this)->cloneForCSSOM();
626 case CSSArrayFunctionValueClass:
627 return toCSSArrayFunctionValue(this)->cloneForCSSOM();
628 case CSSTransformClass:
629 return toCSSTransformValue(this)->cloneForCSSOM();
630 case ImageSetClass:
631 return toCSSImageSetValue(this)->cloneForCSSOM();
632 case SVGPaintClass:
633 return toSVGPaint(this)->cloneForCSSOM();
634 default:
635 ASSERT(!isSubtypeExposedToCSSOM());
636 return TextCloneCSSValue::create(classType(), cssText());
637 }
638 }
639
640 }
641