| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) | 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "core/css/CSSReflectValue.h" | 49 #include "core/css/CSSReflectValue.h" |
| 50 #include "core/css/CSSSVGDocumentValue.h" | 50 #include "core/css/CSSSVGDocumentValue.h" |
| 51 #include "core/css/CSSShadowValue.h" | 51 #include "core/css/CSSShadowValue.h" |
| 52 #include "core/css/CSSTimingFunctionValue.h" | 52 #include "core/css/CSSTimingFunctionValue.h" |
| 53 #include "core/css/CSSUnicodeRangeValue.h" | 53 #include "core/css/CSSUnicodeRangeValue.h" |
| 54 #include "core/css/CSSUnsetValue.h" | 54 #include "core/css/CSSUnsetValue.h" |
| 55 #include "core/css/CSSValueList.h" | 55 #include "core/css/CSSValueList.h" |
| 56 | 56 |
| 57 namespace blink { | 57 namespace blink { |
| 58 | 58 |
| 59 struct SameSizeAsCSSValue : public RefCountedWillBeGarbageCollectedFinalized<Sam
eSizeAsCSSValue> | 59 struct SameSizeAsCSSValueObject : public RefCountedWillBeGarbageCollectedFinaliz
ed<SameSizeAsCSSValueObject> |
| 60 { | 60 { |
| 61 uint32_t bitfields; | 61 uint32_t bitfields; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 static_assert(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), "CSSValue should s
tay small"); | 64 static_assert(sizeof(CSSValueObject) <= sizeof(SameSizeAsCSSValueObject), "CSSVa
lCSSValueObjectue should stay small"); |
| 65 | 65 |
| 66 bool CSSValue::isImplicitInitialValue() const | 66 bool CSSValueObject::isImplicitInitialValue() const |
| 67 { | 67 { |
| 68 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); | 68 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool CSSValue::hasFailedOrCanceledSubresources() const | 71 bool CSSValueObject::hasFailedOrCanceledSubresources() const |
| 72 { | 72 { |
| 73 if (isValueList()) | 73 if (isValueList()) |
| 74 return toCSSValueList(this)->hasFailedOrCanceledSubresources(); | 74 return toCSSValueList(this)->hasFailedOrCanceledSubresources(); |
| 75 if (classType() == FontFaceSrcClass) | 75 if (classType() == FontFaceSrcClass) |
| 76 return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources(); | 76 return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources(); |
| 77 if (classType() == ImageClass) | 77 if (classType() == ImageClass) |
| 78 return toCSSImageValue(this)->hasFailedOrCanceledSubresources(); | 78 return toCSSImageValue(this)->hasFailedOrCanceledSubresources(); |
| 79 if (classType() == CrossfadeClass) | 79 if (classType() == CrossfadeClass) |
| 80 return toCSSCrossfadeValue(this)->hasFailedOrCanceledSubresources(); | 80 return toCSSCrossfadeValue(this)->hasFailedOrCanceledSubresources(); |
| 81 if (classType() == ImageSetClass) | 81 if (classType() == ImageSetClass) |
| 82 return toCSSImageSetValue(this)->hasFailedOrCanceledSubresources(); | 82 return toCSSImageSetValue(this)->hasFailedOrCanceledSubresources(); |
| 83 | 83 |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 | 86 |
| 87 template<class ChildClassType> | 87 template<class ChildClassType> |
| 88 inline static bool compareCSSValues(const CSSValue& first, const CSSValue& secon
d) | 88 inline static bool compareCSSValues(const CSSValueObject& first, const CSSValueO
bject& second) |
| 89 { | 89 { |
| 90 return static_cast<const ChildClassType&>(first).equals(static_cast<const Ch
ildClassType&>(second)); | 90 return static_cast<const ChildClassType&>(first).equals(static_cast<const Ch
ildClassType&>(second)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool CSSValue::equals(const CSSValue& other) const | 93 bool CSSValueObject::equals(const CSSValueObject& other) const |
| 94 { | 94 { |
| 95 if (m_classType == other.m_classType) { | 95 if (m_classType == other.m_classType) { |
| 96 switch (m_classType) { | 96 switch (m_classType) { |
| 97 case BorderImageSliceClass: | 97 case BorderImageSliceClass: |
| 98 return compareCSSValues<CSSBorderImageSliceValue>(*this, other); | 98 return compareCSSValues<CSSBorderImageSliceValue>(*this, other); |
| 99 case CanvasClass: | 99 case CanvasClass: |
| 100 return compareCSSValues<CSSCanvasValue>(*this, other); | 100 return compareCSSValues<CSSCanvasValue>(*this, other); |
| 101 case CursorImageClass: | 101 case CursorImageClass: |
| 102 return compareCSSValues<CSSCursorImageValue>(*this, other); | 102 return compareCSSValues<CSSCursorImageValue>(*this, other); |
| 103 case FontFaceSrcClass: | 103 case FontFaceSrcClass: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 case CSSContentDistributionClass: | 151 case CSSContentDistributionClass: |
| 152 return compareCSSValues<CSSContentDistributionValue>(*this, other); | 152 return compareCSSValues<CSSContentDistributionValue>(*this, other); |
| 153 default: | 153 default: |
| 154 ASSERT_NOT_REACHED(); | 154 ASSERT_NOT_REACHED(); |
| 155 return false; | 155 return false; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 String CSSValue::cssText() const | 161 String CSSValueObject::cssText() const |
| 162 { | 162 { |
| 163 switch (classType()) { | 163 switch (classType()) { |
| 164 case BorderImageSliceClass: | 164 case BorderImageSliceClass: |
| 165 return toCSSBorderImageSliceValue(this)->customCSSText(); | 165 return toCSSBorderImageSliceValue(this)->customCSSText(); |
| 166 case CanvasClass: | 166 case CanvasClass: |
| 167 return toCSSCanvasValue(this)->customCSSText(); | 167 return toCSSCanvasValue(this)->customCSSText(); |
| 168 case CursorImageClass: | 168 case CursorImageClass: |
| 169 return toCSSCursorImageValue(this)->customCSSText(); | 169 return toCSSCursorImageValue(this)->customCSSText(); |
| 170 case FontFaceSrcClass: | 170 case FontFaceSrcClass: |
| 171 return toCSSFontFaceSrcValue(this)->customCSSText(); | 171 return toCSSFontFaceSrcValue(this)->customCSSText(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return toCSSImageSetValue(this)->customCSSText(); | 215 return toCSSImageSetValue(this)->customCSSText(); |
| 216 case CSSSVGDocumentClass: | 216 case CSSSVGDocumentClass: |
| 217 return toCSSSVGDocumentValue(this)->customCSSText(); | 217 return toCSSSVGDocumentValue(this)->customCSSText(); |
| 218 case CSSContentDistributionClass: | 218 case CSSContentDistributionClass: |
| 219 return toCSSContentDistributionValue(this)->customCSSText(); | 219 return toCSSContentDistributionValue(this)->customCSSText(); |
| 220 } | 220 } |
| 221 ASSERT_NOT_REACHED(); | 221 ASSERT_NOT_REACHED(); |
| 222 return String(); | 222 return String(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void CSSValue::destroy() | 225 void CSSValueObject::destroy() |
| 226 { | 226 { |
| 227 switch (classType()) { | 227 switch (classType()) { |
| 228 case BorderImageSliceClass: | 228 case BorderImageSliceClass: |
| 229 delete toCSSBorderImageSliceValue(this); | 229 delete toCSSBorderImageSliceValue(this); |
| 230 return; | 230 return; |
| 231 case CanvasClass: | 231 case CanvasClass: |
| 232 delete toCSSCanvasValue(this); | 232 delete toCSSCanvasValue(this); |
| 233 return; | 233 return; |
| 234 case CursorImageClass: | 234 case CursorImageClass: |
| 235 delete toCSSCursorImageValue(this); | 235 delete toCSSCursorImageValue(this); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 case CSSSVGDocumentClass: | 306 case CSSSVGDocumentClass: |
| 307 delete toCSSSVGDocumentValue(this); | 307 delete toCSSSVGDocumentValue(this); |
| 308 return; | 308 return; |
| 309 case CSSContentDistributionClass: | 309 case CSSContentDistributionClass: |
| 310 delete toCSSContentDistributionValue(this); | 310 delete toCSSContentDistributionValue(this); |
| 311 return; | 311 return; |
| 312 } | 312 } |
| 313 ASSERT_NOT_REACHED(); | 313 ASSERT_NOT_REACHED(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void CSSValue::finalizeGarbageCollectedObject() | 316 void CSSValueObject::finalizeGarbageCollectedObject() |
| 317 { | 317 { |
| 318 switch (classType()) { | 318 switch (classType()) { |
| 319 case BorderImageSliceClass: | 319 case BorderImageSliceClass: |
| 320 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue(); | 320 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue(); |
| 321 return; | 321 return; |
| 322 case CanvasClass: | 322 case CanvasClass: |
| 323 toCSSCanvasValue(this)->~CSSCanvasValue(); | 323 toCSSCanvasValue(this)->~CSSCanvasValue(); |
| 324 return; | 324 return; |
| 325 case CursorImageClass: | 325 case CursorImageClass: |
| 326 toCSSCursorImageValue(this)->~CSSCursorImageValue(); | 326 toCSSCursorImageValue(this)->~CSSCursorImageValue(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 case CSSSVGDocumentClass: | 397 case CSSSVGDocumentClass: |
| 398 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue(); | 398 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue(); |
| 399 return; | 399 return; |
| 400 case CSSContentDistributionClass: | 400 case CSSContentDistributionClass: |
| 401 toCSSContentDistributionValue(this)->~CSSContentDistributionValue(); | 401 toCSSContentDistributionValue(this)->~CSSContentDistributionValue(); |
| 402 return; | 402 return; |
| 403 } | 403 } |
| 404 ASSERT_NOT_REACHED(); | 404 ASSERT_NOT_REACHED(); |
| 405 } | 405 } |
| 406 | 406 |
| 407 DEFINE_TRACE(CSSValue) | 407 DEFINE_TRACE(CSSValueObject) |
| 408 { | 408 { |
| 409 switch (classType()) { | 409 switch (classType()) { |
| 410 case BorderImageSliceClass: | 410 case BorderImageSliceClass: |
| 411 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor); | 411 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor); |
| 412 return; | 412 return; |
| 413 case CanvasClass: | 413 case CanvasClass: |
| 414 toCSSCanvasValue(this)->traceAfterDispatch(visitor); | 414 toCSSCanvasValue(this)->traceAfterDispatch(visitor); |
| 415 return; | 415 return; |
| 416 case CursorImageClass: | 416 case CursorImageClass: |
| 417 toCSSCursorImageValue(this)->traceAfterDispatch(visitor); | 417 toCSSCursorImageValue(this)->traceAfterDispatch(visitor); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 case CSSSVGDocumentClass: | 488 case CSSSVGDocumentClass: |
| 489 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor); | 489 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor); |
| 490 return; | 490 return; |
| 491 case CSSContentDistributionClass: | 491 case CSSContentDistributionClass: |
| 492 toCSSContentDistributionValue(this)->traceAfterDispatch(visitor); | 492 toCSSContentDistributionValue(this)->traceAfterDispatch(visitor); |
| 493 return; | 493 return; |
| 494 } | 494 } |
| 495 ASSERT_NOT_REACHED(); | 495 ASSERT_NOT_REACHED(); |
| 496 } | 496 } |
| 497 | 497 |
| 498 DEFINE_TRACE(NullableCSSValue) |
| 499 { |
| 500 if (m_data) |
| 501 visitor->trace(*m_data); |
| 498 } | 502 } |
| 503 |
| 504 DEFINE_TRACE(CSSValue) |
| 505 { |
| 506 ASSERT(m_data); |
| 507 visitor->trace(*m_data); |
| 508 } |
| 509 |
| 510 } |
| OLD | NEW |