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/CSSAspectRatioValue.h"
31 #include "core/css/CSSBorderImageSliceValue.h"
32 #include "core/css/CSSCalculationValue.h"
33 #include "core/css/CSSCanvasValue.h"
34 #include "core/css/CSSCrossfadeValue.h"
35 #include "core/css/CSSCursorImageValue.h"
36 #include "core/css/CSSFilterValue.h"
37 #include "core/css/CSSFontFaceSrcValue.h"
38 #include "core/css/CSSFontFeatureValue.h"
39 #include "core/css/CSSFontValue.h"
40 #include "core/css/CSSFunctionValue.h"
41 #include "core/css/CSSGradientValue.h"
42 #include "core/css/CSSGridLineNamesValue.h"
43 #include "core/css/CSSGridTemplateAreasValue.h"
44 #include "core/css/CSSImageSetValue.h"
45 #include "core/css/CSSImageValue.h"
46 #include "core/css/CSSInheritedValue.h"
47 #include "core/css/CSSInitialValue.h"
48 #include "core/css/CSSLineBoxContainValue.h"
49 #include "core/css/CSSPrimitiveValue.h"
50 #include "core/css/CSSReflectValue.h"
51 #include "core/css/CSSSVGDocumentValue.h"
52 #include "core/css/CSSShadowValue.h"
53 #include "core/css/CSSTimingFunctionValue.h"
54 #include "core/css/CSSTransformValue.h"
55 #include "core/css/CSSUnicodeRangeValue.h"
56 #include "core/css/CSSValueList.h"
57
58 namespace blink {
59
60 struct SameSizeAsCSSValue : public RefCountedWillBeGarbageCollectedFinalized<SameSizeAsCSSValue>
61 // VC++ 2013 doesn't support EBCO (Empty Base Class Optimization), and having
62 // multiple empty base classes makes the size of CSSValue bloat (Note that both
63 // of GarbageCollectedFinalized and ScriptWrappableBase are empty classes).
64 // See the following article for details.
65 // http://social.msdn.microsoft.com/forums/vstudio/en-US/504c6598-6076-4acf-96b6-e6acb475d302/vc-multiple-inheritance-empty-base-classes-bloats-object-size
66 //
67 // FIXME: Remove this #if directive once VC++'s issue gets fixed.
68 // Note that we're going to split CSSValue class into two classes; CSSOMValue
69 // (assumed name) which derives ScriptWrappable and CSSValue (new one) which
70 // doesn't derive ScriptWrappable or ScriptWrappableBase. Then, we can safely
71 // remove this #if directive.
72 #if ENABLE(OILPAN) && COMPILER(MSVC)
73 , public ScriptWrappableBase
74 #endif
75 {
76 uint32_t bitfields;
77 };
78
79 COMPILE_ASSERT(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small);
80
81 class TextCloneCSSValue : public CSSValue {
82 public:
create(ClassType classType,const String & text)83 static PassRefPtrWillBeRawPtr<TextCloneCSSValue> create(ClassType classType, const String& text)
84 {
85 return adoptRefWillBeNoop(new TextCloneCSSValue(classType, text));
86 }
87
cssText() const88 String cssText() const { return m_cssText; }
89
traceAfterDispatch(Visitor * visitor)90 void traceAfterDispatch(Visitor* visitor) { CSSValue::traceAfterDispatch(visitor); }
91
92 private:
TextCloneCSSValue(ClassType classType,const String & text)93 TextCloneCSSValue(ClassType classType, const String& text)
94 : CSSValue(classType, /*isCSSOMSafe*/ true)
95 , m_cssText(text)
96 {
97 m_isTextClone = true;
98 }
99
100 String m_cssText;
101 };
102
103 DEFINE_CSS_VALUE_TYPE_CASTS(TextCloneCSSValue, isTextCloneCSSValue());
104
isImplicitInitialValue() const105 bool CSSValue::isImplicitInitialValue() const
106 {
107 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit();
108 }
109
cssValueType() const110 CSSValue::Type CSSValue::cssValueType() const
111 {
112 if (isInheritedValue())
113 return CSS_INHERIT;
114 if (isPrimitiveValue())
115 return CSS_PRIMITIVE_VALUE;
116 if (isValueList())
117 return CSS_VALUE_LIST;
118 if (isInitialValue())
119 return CSS_INITIAL;
120 return CSS_CUSTOM;
121 }
122
hasFailedOrCanceledSubresources() const123 bool CSSValue::hasFailedOrCanceledSubresources() const
124 {
125 // This should get called for internal instances only.
126 ASSERT(!isCSSOMSafe());
127
128 if (isValueList())
129 return toCSSValueList(this)->hasFailedOrCanceledSubresources();
130 if (classType() == FontFaceSrcClass)
131 return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources();
132 if (classType() == ImageClass)
133 return toCSSImageValue(this)->hasFailedOrCanceledSubresources();
134 if (classType() == CrossfadeClass)
135 return toCSSCrossfadeValue(this)->hasFailedOrCanceledSubresources();
136 if (classType() == ImageSetClass)
137 return toCSSImageSetValue(this)->hasFailedOrCanceledSubresources();
138
139 return false;
140 }
141
142 template<class ChildClassType>
compareCSSValues(const CSSValue & first,const CSSValue & second)143 inline static bool compareCSSValues(const CSSValue& first, const CSSValue& second)
144 {
145 return static_cast<const ChildClassType&>(first).equals(static_cast<const ChildClassType&>(second));
146 }
147
equals(const CSSValue & other) const148 bool CSSValue::equals(const CSSValue& other) const
149 {
150 if (m_isTextClone) {
151 ASSERT(isCSSOMSafe());
152 return toTextCloneCSSValue(this)->cssText() == other.cssText();
153 }
154
155 if (m_classType == other.m_classType) {
156 switch (m_classType) {
157 case AspectRatioClass:
158 return compareCSSValues<CSSAspectRatioValue>(*this, other);
159 case BorderImageSliceClass:
160 return compareCSSValues<CSSBorderImageSliceValue>(*this, other);
161 case CanvasClass:
162 return compareCSSValues<CSSCanvasValue>(*this, other);
163 case CursorImageClass:
164 return compareCSSValues<CSSCursorImageValue>(*this, other);
165 case FontClass:
166 return compareCSSValues<CSSFontValue>(*this, other);
167 case FontFaceSrcClass:
168 return compareCSSValues<CSSFontFaceSrcValue>(*this, other);
169 case FontFeatureClass:
170 return compareCSSValues<CSSFontFeatureValue>(*this, other);
171 case FunctionClass:
172 return compareCSSValues<CSSFunctionValue>(*this, other);
173 case LinearGradientClass:
174 return compareCSSValues<CSSLinearGradientValue>(*this, other);
175 case RadialGradientClass:
176 return compareCSSValues<CSSRadialGradientValue>(*this, other);
177 case CrossfadeClass:
178 return compareCSSValues<CSSCrossfadeValue>(*this, other);
179 case ImageClass:
180 return compareCSSValues<CSSImageValue>(*this, other);
181 case InheritedClass:
182 return compareCSSValues<CSSInheritedValue>(*this, other);
183 case InitialClass:
184 return compareCSSValues<CSSInitialValue>(*this, other);
185 case GridLineNamesClass:
186 return compareCSSValues<CSSGridLineNamesValue>(*this, other);
187 case GridTemplateAreasClass:
188 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other);
189 case PrimitiveClass:
190 return compareCSSValues<CSSPrimitiveValue>(*this, other);
191 case ReflectClass:
192 return compareCSSValues<CSSReflectValue>(*this, other);
193 case ShadowClass:
194 return compareCSSValues<CSSShadowValue>(*this, other);
195 case CubicBezierTimingFunctionClass:
196 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, other);
197 case StepsTimingFunctionClass:
198 return compareCSSValues<CSSStepsTimingFunctionValue>(*this, other);
199 case UnicodeRangeClass:
200 return compareCSSValues<CSSUnicodeRangeValue>(*this, other);
201 case ValueListClass:
202 return compareCSSValues<CSSValueList>(*this, other);
203 case CSSTransformClass:
204 return compareCSSValues<CSSTransformValue>(*this, other);
205 case LineBoxContainClass:
206 return compareCSSValues<CSSLineBoxContainValue>(*this, other);
207 case CalculationClass:
208 return compareCSSValues<CSSCalcValue>(*this, other);
209 case ImageSetClass:
210 return compareCSSValues<CSSImageSetValue>(*this, other);
211 case CSSFilterClass:
212 return compareCSSValues<CSSFilterValue>(*this, other);
213 case CSSSVGDocumentClass:
214 return compareCSSValues<CSSSVGDocumentValue>(*this, other);
215 default:
216 ASSERT_NOT_REACHED();
217 return false;
218 }
219 } else if (m_classType == ValueListClass && other.m_classType != ValueListClass)
220 return toCSSValueList(this)->equals(other);
221 else if (m_classType != ValueListClass && other.m_classType == ValueListClass)
222 return static_cast<const CSSValueList&>(other).equals(*this);
223 return false;
224 }
225
cssText() const226 String CSSValue::cssText() const
227 {
228 if (m_isTextClone) {
229 ASSERT(isCSSOMSafe());
230 return toTextCloneCSSValue(this)->cssText();
231 }
232 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
233
234 switch (classType()) {
235 case AspectRatioClass:
236 return toCSSAspectRatioValue(this)->customCSSText();
237 case BorderImageSliceClass:
238 return toCSSBorderImageSliceValue(this)->customCSSText();
239 case CanvasClass:
240 return toCSSCanvasValue(this)->customCSSText();
241 case CursorImageClass:
242 return toCSSCursorImageValue(this)->customCSSText();
243 case FontClass:
244 return toCSSFontValue(this)->customCSSText();
245 case FontFaceSrcClass:
246 return toCSSFontFaceSrcValue(this)->customCSSText();
247 case FontFeatureClass:
248 return toCSSFontFeatureValue(this)->customCSSText();
249 case FunctionClass:
250 return toCSSFunctionValue(this)->customCSSText();
251 case LinearGradientClass:
252 return toCSSLinearGradientValue(this)->customCSSText();
253 case RadialGradientClass:
254 return toCSSRadialGradientValue(this)->customCSSText();
255 case CrossfadeClass:
256 return toCSSCrossfadeValue(this)->customCSSText();
257 case ImageClass:
258 return toCSSImageValue(this)->customCSSText();
259 case InheritedClass:
260 return toCSSInheritedValue(this)->customCSSText();
261 case InitialClass:
262 return toCSSInitialValue(this)->customCSSText();
263 case GridLineNamesClass:
264 return toCSSGridLineNamesValue(this)->customCSSText();
265 case GridTemplateAreasClass:
266 return toCSSGridTemplateAreasValue(this)->customCSSText();
267 case PrimitiveClass:
268 return toCSSPrimitiveValue(this)->customCSSText();
269 case ReflectClass:
270 return toCSSReflectValue(this)->customCSSText();
271 case ShadowClass:
272 return toCSSShadowValue(this)->customCSSText();
273 case CubicBezierTimingFunctionClass:
274 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText();
275 case StepsTimingFunctionClass:
276 return toCSSStepsTimingFunctionValue(this)->customCSSText();
277 case UnicodeRangeClass:
278 return toCSSUnicodeRangeValue(this)->customCSSText();
279 case ValueListClass:
280 return toCSSValueList(this)->customCSSText();
281 case CSSTransformClass:
282 return toCSSTransformValue(this)->customCSSText();
283 case LineBoxContainClass:
284 return toCSSLineBoxContainValue(this)->customCSSText();
285 case CalculationClass:
286 return toCSSCalcValue(this)->customCSSText();
287 case ImageSetClass:
288 return toCSSImageSetValue(this)->customCSSText();
289 case CSSFilterClass:
290 return toCSSFilterValue(this)->customCSSText();
291 case CSSSVGDocumentClass:
292 return toCSSSVGDocumentValue(this)->customCSSText();
293 }
294 ASSERT_NOT_REACHED();
295 return String();
296 }
297
destroy()298 void CSSValue::destroy()
299 {
300 if (m_isTextClone) {
301 ASSERT(isCSSOMSafe());
302 delete toTextCloneCSSValue(this);
303 return;
304 }
305 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
306
307 switch (classType()) {
308 case AspectRatioClass:
309 delete toCSSAspectRatioValue(this);
310 return;
311 case BorderImageSliceClass:
312 delete toCSSBorderImageSliceValue(this);
313 return;
314 case CanvasClass:
315 delete toCSSCanvasValue(this);
316 return;
317 case CursorImageClass:
318 delete toCSSCursorImageValue(this);
319 return;
320 case FontClass:
321 delete toCSSFontValue(this);
322 return;
323 case FontFaceSrcClass:
324 delete toCSSFontFaceSrcValue(this);
325 return;
326 case FontFeatureClass:
327 delete toCSSFontFeatureValue(this);
328 return;
329 case FunctionClass:
330 delete toCSSFunctionValue(this);
331 return;
332 case LinearGradientClass:
333 delete toCSSLinearGradientValue(this);
334 return;
335 case RadialGradientClass:
336 delete toCSSRadialGradientValue(this);
337 return;
338 case CrossfadeClass:
339 delete toCSSCrossfadeValue(this);
340 return;
341 case ImageClass:
342 delete toCSSImageValue(this);
343 return;
344 case InheritedClass:
345 delete toCSSInheritedValue(this);
346 return;
347 case InitialClass:
348 delete toCSSInitialValue(this);
349 return;
350 case GridLineNamesClass:
351 delete toCSSGridLineNamesValue(this);
352 return;
353 case GridTemplateAreasClass:
354 delete toCSSGridTemplateAreasValue(this);
355 return;
356 case PrimitiveClass:
357 delete toCSSPrimitiveValue(this);
358 return;
359 case ReflectClass:
360 delete toCSSReflectValue(this);
361 return;
362 case ShadowClass:
363 delete toCSSShadowValue(this);
364 return;
365 case CubicBezierTimingFunctionClass:
366 delete toCSSCubicBezierTimingFunctionValue(this);
367 return;
368 case StepsTimingFunctionClass:
369 delete toCSSStepsTimingFunctionValue(this);
370 return;
371 case UnicodeRangeClass:
372 delete toCSSUnicodeRangeValue(this);
373 return;
374 case ValueListClass:
375 delete toCSSValueList(this);
376 return;
377 case CSSTransformClass:
378 delete toCSSTransformValue(this);
379 return;
380 case LineBoxContainClass:
381 delete toCSSLineBoxContainValue(this);
382 return;
383 case CalculationClass:
384 delete toCSSCalcValue(this);
385 return;
386 case ImageSetClass:
387 delete toCSSImageSetValue(this);
388 return;
389 case CSSFilterClass:
390 delete toCSSFilterValue(this);
391 return;
392 case CSSSVGDocumentClass:
393 delete toCSSSVGDocumentValue(this);
394 return;
395 }
396 ASSERT_NOT_REACHED();
397 }
398
finalizeGarbageCollectedObject()399 void CSSValue::finalizeGarbageCollectedObject()
400 {
401 if (m_isTextClone) {
402 ASSERT(isCSSOMSafe());
403 toTextCloneCSSValue(this)->~TextCloneCSSValue();
404 return;
405 }
406 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
407
408 switch (classType()) {
409 case AspectRatioClass:
410 toCSSAspectRatioValue(this)->~CSSAspectRatioValue();
411 return;
412 case BorderImageSliceClass:
413 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue();
414 return;
415 case CanvasClass:
416 toCSSCanvasValue(this)->~CSSCanvasValue();
417 return;
418 case CursorImageClass:
419 toCSSCursorImageValue(this)->~CSSCursorImageValue();
420 return;
421 case FontClass:
422 toCSSFontValue(this)->~CSSFontValue();
423 return;
424 case FontFaceSrcClass:
425 toCSSFontFaceSrcValue(this)->~CSSFontFaceSrcValue();
426 return;
427 case FontFeatureClass:
428 toCSSFontFeatureValue(this)->~CSSFontFeatureValue();
429 return;
430 case FunctionClass:
431 toCSSFunctionValue(this)->~CSSFunctionValue();
432 return;
433 case LinearGradientClass:
434 toCSSLinearGradientValue(this)->~CSSLinearGradientValue();
435 return;
436 case RadialGradientClass:
437 toCSSRadialGradientValue(this)->~CSSRadialGradientValue();
438 return;
439 case CrossfadeClass:
440 toCSSCrossfadeValue(this)->~CSSCrossfadeValue();
441 return;
442 case ImageClass:
443 toCSSImageValue(this)->~CSSImageValue();
444 return;
445 case InheritedClass:
446 toCSSInheritedValue(this)->~CSSInheritedValue();
447 return;
448 case InitialClass:
449 toCSSInitialValue(this)->~CSSInitialValue();
450 return;
451 case GridLineNamesClass:
452 toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue();
453 return;
454 case GridTemplateAreasClass:
455 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue();
456 return;
457 case PrimitiveClass:
458 toCSSPrimitiveValue(this)->~CSSPrimitiveValue();
459 return;
460 case ReflectClass:
461 toCSSReflectValue(this)->~CSSReflectValue();
462 return;
463 case ShadowClass:
464 toCSSShadowValue(this)->~CSSShadowValue();
465 return;
466 case CubicBezierTimingFunctionClass:
467 toCSSCubicBezierTimingFunctionValue(this)->~CSSCubicBezierTimingFunctionValue();
468 return;
469 case StepsTimingFunctionClass:
470 toCSSStepsTimingFunctionValue(this)->~CSSStepsTimingFunctionValue();
471 return;
472 case UnicodeRangeClass:
473 toCSSUnicodeRangeValue(this)->~CSSUnicodeRangeValue();
474 return;
475 case ValueListClass:
476 toCSSValueList(this)->~CSSValueList();
477 return;
478 case CSSTransformClass:
479 toCSSTransformValue(this)->~CSSTransformValue();
480 return;
481 case LineBoxContainClass:
482 toCSSLineBoxContainValue(this)->~CSSLineBoxContainValue();
483 return;
484 case CalculationClass:
485 toCSSCalcValue(this)->~CSSCalcValue();
486 return;
487 case ImageSetClass:
488 toCSSImageSetValue(this)->~CSSImageSetValue();
489 return;
490 case CSSFilterClass:
491 toCSSFilterValue(this)->~CSSFilterValue();
492 return;
493 case CSSSVGDocumentClass:
494 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue();
495 return;
496 }
497 ASSERT_NOT_REACHED();
498 }
499
trace(Visitor * visitor)500 void CSSValue::trace(Visitor* visitor)
501 {
502 if (m_isTextClone) {
503 ASSERT(isCSSOMSafe());
504 toTextCloneCSSValue(this)->traceAfterDispatch(visitor);
505 return;
506 }
507 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
508
509 switch (classType()) {
510 case AspectRatioClass:
511 toCSSAspectRatioValue(this)->traceAfterDispatch(visitor);
512 return;
513 case BorderImageSliceClass:
514 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor);
515 return;
516 case CanvasClass:
517 toCSSCanvasValue(this)->traceAfterDispatch(visitor);
518 return;
519 case CursorImageClass:
520 toCSSCursorImageValue(this)->traceAfterDispatch(visitor);
521 return;
522 case FontClass:
523 toCSSFontValue(this)->traceAfterDispatch(visitor);
524 return;
525 case FontFaceSrcClass:
526 toCSSFontFaceSrcValue(this)->traceAfterDispatch(visitor);
527 return;
528 case FontFeatureClass:
529 toCSSFontFeatureValue(this)->traceAfterDispatch(visitor);
530 return;
531 case FunctionClass:
532 toCSSFunctionValue(this)->traceAfterDispatch(visitor);
533 return;
534 case LinearGradientClass:
535 toCSSLinearGradientValue(this)->traceAfterDispatch(visitor);
536 return;
537 case RadialGradientClass:
538 toCSSRadialGradientValue(this)->traceAfterDispatch(visitor);
539 return;
540 case CrossfadeClass:
541 toCSSCrossfadeValue(this)->traceAfterDispatch(visitor);
542 return;
543 case ImageClass:
544 toCSSImageValue(this)->traceAfterDispatch(visitor);
545 return;
546 case InheritedClass:
547 toCSSInheritedValue(this)->traceAfterDispatch(visitor);
548 return;
549 case InitialClass:
550 toCSSInitialValue(this)->traceAfterDispatch(visitor);
551 return;
552 case GridLineNamesClass:
553 toCSSGridLineNamesValue(this)->traceAfterDispatch(visitor);
554 return;
555 case GridTemplateAreasClass:
556 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor);
557 return;
558 case PrimitiveClass:
559 toCSSPrimitiveValue(this)->traceAfterDispatch(visitor);
560 return;
561 case ReflectClass:
562 toCSSReflectValue(this)->traceAfterDispatch(visitor);
563 return;
564 case ShadowClass:
565 toCSSShadowValue(this)->traceAfterDispatch(visitor);
566 return;
567 case CubicBezierTimingFunctionClass:
568 toCSSCubicBezierTimingFunctionValue(this)->traceAfterDispatch(visitor);
569 return;
570 case StepsTimingFunctionClass:
571 toCSSStepsTimingFunctionValue(this)->traceAfterDispatch(visitor);
572 return;
573 case UnicodeRangeClass:
574 toCSSUnicodeRangeValue(this)->traceAfterDispatch(visitor);
575 return;
576 case ValueListClass:
577 toCSSValueList(this)->traceAfterDispatch(visitor);
578 return;
579 case CSSTransformClass:
580 toCSSTransformValue(this)->traceAfterDispatch(visitor);
581 return;
582 case LineBoxContainClass:
583 toCSSLineBoxContainValue(this)->traceAfterDispatch(visitor);
584 return;
585 case CalculationClass:
586 toCSSCalcValue(this)->traceAfterDispatch(visitor);
587 return;
588 case ImageSetClass:
589 toCSSImageSetValue(this)->traceAfterDispatch(visitor);
590 return;
591 case CSSFilterClass:
592 toCSSFilterValue(this)->traceAfterDispatch(visitor);
593 return;
594 case CSSSVGDocumentClass:
595 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor);
596 return;
597 }
598 ASSERT_NOT_REACHED();
599 }
600
cloneForCSSOM() const601 PassRefPtrWillBeRawPtr<CSSValue> CSSValue::cloneForCSSOM() const
602 {
603 switch (classType()) {
604 case PrimitiveClass:
605 return toCSSPrimitiveValue(this)->cloneForCSSOM();
606 case ValueListClass:
607 return toCSSValueList(this)->cloneForCSSOM();
608 case ImageClass:
609 case CursorImageClass:
610 return toCSSImageValue(this)->cloneForCSSOM();
611 case CSSFilterClass:
612 return toCSSFilterValue(this)->cloneForCSSOM();
613 case CSSTransformClass:
614 return toCSSTransformValue(this)->cloneForCSSOM();
615 case ImageSetClass:
616 return toCSSImageSetValue(this)->cloneForCSSOM();
617 default:
618 ASSERT(!isSubtypeExposedToCSSOM());
619 return TextCloneCSSValue::create(classType(), cssText());
620 }
621 }
622
623 }
624