Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 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 | |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 30 | #include "core/css/CSSArrayFunctionValue.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 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" |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 37 | #include "core/css/CSSFilterValue.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 38 | #include "core/css/CSSFontFaceSrcValue.h" |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 39 | #include "core/css/CSSFontFeatureValue.h" |
| 40 | #include "core/css/CSSFontValue.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 41 | #include "core/css/CSSFunctionValue.h" |
| 42 | #include "core/css/CSSGradientValue.h" |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 43 | #include "core/css/CSSGridLineNamesValue.h" |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 44 | #include "core/css/CSSGridTemplateAreasValue.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 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" |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 52 | #include "core/css/CSSSVGDocumentValue.h" |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 53 | #include "core/css/CSSShadowValue.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 54 | #include "core/css/CSSTimingFunctionValue.h" |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 55 | #include "core/css/CSSTransformValue.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 56 | #include "core/css/CSSUnicodeRangeValue.h" |
| 57 | #include "core/css/CSSValueList.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 58 | #include "core/svg/SVGPaint.h" |
| 59 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 60 | namespace WebCore { |
| 61 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 62 | struct SameSizeAsCSSValue : public RefCountedWillBeRefCountedGarbageCollected<SameSizeAsCSSValue> { |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 63 | uint32_t bitfields; |
| 64 | }; |
| 65 | |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 66 | COMPILE_ASSERT(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 67 | |
| 68 | class TextCloneCSSValue : public CSSValue { |
| 69 | public: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 70 | static PassRefPtrWillBeRawPtr<TextCloneCSSValue> create(ClassType classType, const String& text) |
| 71 | { |
| 72 | return adoptRefWillBeRefCountedGarbageCollected(new TextCloneCSSValue(classType, text)); |
| 73 | } |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 74 | |
| 75 | String cssText() const { return m_cssText; } |
| 76 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 77 | void traceAfterDispatch(Visitor* visitor) { CSSValue::traceAfterDispatch(visitor); } |
| 78 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 79 | private: |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 80 | TextCloneCSSValue(ClassType classType, const String& text) |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 81 | : CSSValue(classType, /*isCSSOMSafe*/ true) |
| 82 | , m_cssText(text) |
| 83 | { |
| 84 | m_isTextClone = true; |
| 85 | } |
| 86 | |
| 87 | String m_cssText; |
| 88 | }; |
| 89 | |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 90 | DEFINE_CSS_VALUE_TYPE_CASTS(TextCloneCSSValue, isTextCloneCSSValue()); |
| 91 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 92 | bool CSSValue::isImplicitInitialValue() const |
| 93 | { |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 94 | return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | 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 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 110 | bool CSSValue::hasFailedOrCanceledSubresources() const |
| 111 | { |
| 112 | // This should get called for internal instances only. |
| 113 | ASSERT(!isCSSOMSafe()); |
| 114 | |
| 115 | if (isValueList()) |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 116 | return toCSSValueList(this)->hasFailedOrCanceledSubresources(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 117 | if (classType() == FontFaceSrcClass) |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 118 | return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 119 | if (classType() == ImageClass) |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 120 | return toCSSImageValue(this)->hasFailedOrCanceledSubresources(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 121 | if (classType() == CrossfadeClass) |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 122 | return toCSSCrossfadeValue(this)->hasFailedOrCanceledSubresources(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 123 | if (classType() == ImageSetClass) |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 124 | return toCSSImageSetValue(this)->hasFailedOrCanceledSubresources(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 125 | |
| 126 | return false; |
| 127 | } |
| 128 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 129 | template<class ChildClassType> |
| 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 | |
| 135 | bool CSSValue::equals(const CSSValue& other) const |
| 136 | { |
| 137 | if (m_isTextClone) { |
| 138 | ASSERT(isCSSOMSafe()); |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 139 | return toTextCloneCSSValue(this)->cssText() == other.cssText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 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: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 153 | return compareCSSValues<CSSFontValue>(*this, other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 154 | case FontFaceSrcClass: |
| 155 | return compareCSSValues<CSSFontFaceSrcValue>(*this, other); |
| 156 | case FontFeatureClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 157 | return compareCSSValues<CSSFontFeatureValue>(*this, other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 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); |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 172 | case GridLineNamesClass: |
| 173 | return compareCSSValues<CSSGridLineNamesValue>(*this, other); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 174 | case GridTemplateAreasClass: |
| 175 | return compareCSSValues<CSSGridTemplateAreasValue>(*this, other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 176 | case PrimitiveClass: |
| 177 | return compareCSSValues<CSSPrimitiveValue>(*this, other); |
| 178 | case ReflectClass: |
| 179 | return compareCSSValues<CSSReflectValue>(*this, other); |
| 180 | case ShadowClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 181 | return compareCSSValues<CSSShadowValue>(*this, other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 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); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 190 | case CSSTransformClass: |
| 191 | return compareCSSValues<CSSTransformValue>(*this, other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 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); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 198 | case CSSFilterClass: |
| 199 | return compareCSSValues<CSSFilterValue>(*this, other); |
| 200 | case CSSArrayFunctionValueClass: |
| 201 | return compareCSSValues<CSSArrayFunctionValue>(*this, other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 202 | case SVGPaintClass: |
| 203 | return compareCSSValues<SVGPaint>(*this, other); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 204 | case CSSSVGDocumentClass: |
| 205 | return compareCSSValues<CSSSVGDocumentValue>(*this, other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 206 | default: |
| 207 | ASSERT_NOT_REACHED(); |
| 208 | return false; |
| 209 | } |
| 210 | } else if (m_classType == ValueListClass && other.m_classType != ValueListClass) |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 211 | return toCSSValueList(this)->equals(other); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 212 | else if (m_classType != ValueListClass && other.m_classType == ValueListClass) |
| 213 | return static_cast<const CSSValueList&>(other).equals(*this); |
| 214 | return false; |
| 215 | } |
| 216 | |
| 217 | String CSSValue::cssText() const |
| 218 | { |
| 219 | if (m_isTextClone) { |
| 220 | ASSERT(isCSSOMSafe()); |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 221 | return toTextCloneCSSValue(this)->cssText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 222 | } |
| 223 | ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
| 224 | |
| 225 | switch (classType()) { |
| 226 | case AspectRatioClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 227 | return toCSSAspectRatioValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 228 | case BorderImageSliceClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 229 | return toCSSBorderImageSliceValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 230 | case CanvasClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 231 | return toCSSCanvasValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 232 | case CursorImageClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 233 | return toCSSCursorImageValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 234 | case FontClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 235 | return toCSSFontValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 236 | case FontFaceSrcClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 237 | return toCSSFontFaceSrcValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 238 | case FontFeatureClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 239 | return toCSSFontFeatureValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 240 | case FunctionClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 241 | return toCSSFunctionValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 242 | case LinearGradientClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 243 | return toCSSLinearGradientValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 244 | case RadialGradientClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 245 | return toCSSRadialGradientValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 246 | case CrossfadeClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 247 | return toCSSCrossfadeValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 248 | case ImageClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 249 | return toCSSImageValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 250 | case InheritedClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 251 | return toCSSInheritedValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 252 | case InitialClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 253 | return toCSSInitialValue(this)->customCSSText(); |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 254 | case GridLineNamesClass: |
| 255 | return toCSSGridLineNamesValue(this)->customCSSText(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 256 | case GridTemplateAreasClass: |
| 257 | return toCSSGridTemplateAreasValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 258 | case PrimitiveClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 259 | return toCSSPrimitiveValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 260 | case ReflectClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 261 | return toCSSReflectValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 262 | case ShadowClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 263 | return toCSSShadowValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 264 | case CubicBezierTimingFunctionClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 265 | return toCSSCubicBezierTimingFunctionValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 266 | case StepsTimingFunctionClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 267 | return toCSSStepsTimingFunctionValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 268 | case UnicodeRangeClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 269 | return toCSSUnicodeRangeValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 270 | case ValueListClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 271 | return toCSSValueList(this)->customCSSText(); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 272 | case CSSTransformClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 273 | return toCSSTransformValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 274 | case LineBoxContainClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 275 | return toCSSLineBoxContainValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 276 | case CalculationClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 277 | return toCSSCalcValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 278 | case ImageSetClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 279 | return toCSSImageSetValue(this)->customCSSText(); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 280 | case CSSFilterClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 281 | return toCSSFilterValue(this)->customCSSText(); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 282 | case CSSArrayFunctionValueClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 283 | return toCSSArrayFunctionValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 284 | case SVGPaintClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 285 | return toSVGPaint(this)->customCSSText(); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 286 | case CSSSVGDocumentClass: |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 287 | return toCSSSVGDocumentValue(this)->customCSSText(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 288 | } |
| 289 | ASSERT_NOT_REACHED(); |
| 290 | return String(); |
| 291 | } |
| 292 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 293 | void CSSValue::destroy() |
| 294 | { |
| 295 | if (m_isTextClone) { |
| 296 | ASSERT(isCSSOMSafe()); |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 297 | delete toTextCloneCSSValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 298 | return; |
| 299 | } |
| 300 | ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
| 301 | |
| 302 | switch (classType()) { |
| 303 | case AspectRatioClass: |
Torne (Richard Coles) | 06f816c | 2013-09-26 13:25:12 +0100 | [diff] [blame] | 304 | delete toCSSAspectRatioValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 305 | return; |
| 306 | case BorderImageSliceClass: |
Torne (Richard Coles) | 06f816c | 2013-09-26 13:25:12 +0100 | [diff] [blame] | 307 | delete toCSSBorderImageSliceValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 308 | return; |
| 309 | case CanvasClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 310 | delete toCSSCanvasValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 311 | return; |
| 312 | case CursorImageClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 313 | delete toCSSCursorImageValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 314 | return; |
| 315 | case FontClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 316 | delete toCSSFontValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 317 | return; |
| 318 | case FontFaceSrcClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 319 | delete toCSSFontFaceSrcValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 320 | return; |
| 321 | case FontFeatureClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 322 | delete toCSSFontFeatureValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 323 | return; |
| 324 | case FunctionClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 325 | delete toCSSFunctionValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 326 | return; |
| 327 | case LinearGradientClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 328 | delete toCSSLinearGradientValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 329 | return; |
| 330 | case RadialGradientClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 331 | delete toCSSRadialGradientValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 332 | return; |
| 333 | case CrossfadeClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 334 | delete toCSSCrossfadeValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 335 | return; |
| 336 | case ImageClass: |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 337 | delete toCSSImageValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 338 | return; |
| 339 | case InheritedClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 340 | delete toCSSInheritedValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 341 | return; |
| 342 | case InitialClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 343 | delete toCSSInitialValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 344 | return; |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 345 | case GridLineNamesClass: |
| 346 | delete toCSSGridLineNamesValue(this); |
| 347 | return; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 348 | case GridTemplateAreasClass: |
| 349 | delete toCSSGridTemplateAreasValue(this); |
Torne (Richard Coles) | f5e4ad5 | 2013-08-05 13:57:57 +0100 | [diff] [blame] | 350 | return; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 351 | case PrimitiveClass: |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 352 | delete toCSSPrimitiveValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 353 | return; |
| 354 | case ReflectClass: |
Torne (Richard Coles) | 06f816c | 2013-09-26 13:25:12 +0100 | [diff] [blame] | 355 | delete toCSSReflectValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 356 | return; |
| 357 | case ShadowClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 358 | delete toCSSShadowValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 359 | return; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 360 | case CubicBezierTimingFunctionClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 361 | delete toCSSCubicBezierTimingFunctionValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 362 | return; |
| 363 | case StepsTimingFunctionClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 364 | delete toCSSStepsTimingFunctionValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 365 | return; |
| 366 | case UnicodeRangeClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 367 | delete toCSSUnicodeRangeValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 368 | return; |
| 369 | case ValueListClass: |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 370 | delete toCSSValueList(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 371 | return; |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 372 | case CSSTransformClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 373 | delete toCSSTransformValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 374 | return; |
| 375 | case LineBoxContainClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 376 | delete toCSSLineBoxContainValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 377 | return; |
| 378 | case CalculationClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 379 | delete toCSSCalcValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 380 | return; |
| 381 | case ImageSetClass: |
Torne (Richard Coles) | 06f816c | 2013-09-26 13:25:12 +0100 | [diff] [blame] | 382 | delete toCSSImageSetValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 383 | return; |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 384 | case CSSFilterClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 385 | delete toCSSFilterValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 386 | return; |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 387 | case CSSArrayFunctionValueClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 388 | delete toCSSArrayFunctionValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 389 | return; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 390 | case SVGPaintClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 391 | delete toSVGPaint(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 392 | return; |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 393 | case CSSSVGDocumentClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 394 | delete toCSSSVGDocumentValue(this); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 395 | return; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 396 | } |
| 397 | ASSERT_NOT_REACHED(); |
| 398 | } |
| 399 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 400 | void CSSValue::finalize() |
| 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: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 411 | toCSSAspectRatioValue(this)->~CSSAspectRatioValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 412 | return; |
| 413 | case BorderImageSliceClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 414 | toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 415 | return; |
| 416 | case CanvasClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 417 | toCSSCanvasValue(this)->~CSSCanvasValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 418 | return; |
| 419 | case CursorImageClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 420 | toCSSCursorImageValue(this)->~CSSCursorImageValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 421 | return; |
| 422 | case FontClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 423 | toCSSFontValue(this)->~CSSFontValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 424 | return; |
| 425 | case FontFaceSrcClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 426 | toCSSFontFaceSrcValue(this)->~CSSFontFaceSrcValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 427 | return; |
| 428 | case FontFeatureClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 429 | toCSSFontFeatureValue(this)->~CSSFontFeatureValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 430 | return; |
| 431 | case FunctionClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 432 | toCSSFunctionValue(this)->~CSSFunctionValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 433 | return; |
| 434 | case LinearGradientClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 435 | toCSSLinearGradientValue(this)->~CSSLinearGradientValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 436 | return; |
| 437 | case RadialGradientClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 438 | toCSSRadialGradientValue(this)->~CSSRadialGradientValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 439 | return; |
| 440 | case CrossfadeClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 441 | toCSSCrossfadeValue(this)->~CSSCrossfadeValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 442 | return; |
| 443 | case ImageClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 444 | toCSSImageValue(this)->~CSSImageValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 445 | return; |
| 446 | case InheritedClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 447 | toCSSInheritedValue(this)->~CSSInheritedValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 448 | return; |
| 449 | case InitialClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 450 | toCSSInitialValue(this)->~CSSInitialValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 451 | return; |
| 452 | case GridLineNamesClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 453 | toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 454 | return; |
| 455 | case GridTemplateAreasClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 456 | toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 457 | return; |
| 458 | case PrimitiveClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 459 | toCSSPrimitiveValue(this)->~CSSPrimitiveValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 460 | return; |
| 461 | case ReflectClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 462 | toCSSReflectValue(this)->~CSSReflectValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 463 | return; |
| 464 | case ShadowClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 465 | toCSSShadowValue(this)->~CSSShadowValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 466 | return; |
| 467 | case CubicBezierTimingFunctionClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 468 | toCSSCubicBezierTimingFunctionValue(this)->~CSSCubicBezierTimingFunctionValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 469 | return; |
| 470 | case StepsTimingFunctionClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 471 | toCSSStepsTimingFunctionValue(this)->~CSSStepsTimingFunctionValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 472 | return; |
| 473 | case UnicodeRangeClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 474 | toCSSUnicodeRangeValue(this)->~CSSUnicodeRangeValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 475 | return; |
| 476 | case ValueListClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 477 | toCSSValueList(this)->~CSSValueList(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 478 | return; |
| 479 | case CSSTransformClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 480 | toCSSTransformValue(this)->~CSSTransformValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 481 | return; |
| 482 | case LineBoxContainClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 483 | toCSSLineBoxContainValue(this)->~CSSLineBoxContainValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 484 | return; |
| 485 | case CalculationClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 486 | toCSSCalcValue(this)->~CSSCalcValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 487 | return; |
| 488 | case ImageSetClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 489 | toCSSImageSetValue(this)->~CSSImageSetValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 490 | return; |
| 491 | case CSSFilterClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 492 | toCSSFilterValue(this)->~CSSFilterValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 493 | return; |
| 494 | case CSSArrayFunctionValueClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 495 | toCSSArrayFunctionValue(this)->~CSSArrayFunctionValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 496 | return; |
| 497 | case SVGPaintClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 498 | toSVGPaint(this)->~SVGPaint(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 499 | return; |
| 500 | case CSSSVGDocumentClass: |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 501 | toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue(); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 502 | return; |
| 503 | } |
| 504 | ASSERT_NOT_REACHED(); |
| 505 | } |
| 506 | |
| 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 | static_cast<CSSAspectRatioValue*>(this)->traceAfterDispatch(visitor); |
| 519 | return; |
| 520 | case BorderImageSliceClass: |
| 521 | static_cast<CSSBorderImageSliceValue*>(this)->traceAfterDispatch(visitor); |
| 522 | return; |
| 523 | case CanvasClass: |
| 524 | static_cast<CSSCanvasValue*>(this)->traceAfterDispatch(visitor); |
| 525 | return; |
| 526 | case CursorImageClass: |
| 527 | static_cast<CSSCursorImageValue*>(this)->traceAfterDispatch(visitor); |
| 528 | return; |
| 529 | case FontClass: |
| 530 | static_cast<CSSFontValue*>(this)->traceAfterDispatch(visitor); |
| 531 | return; |
| 532 | case FontFaceSrcClass: |
| 533 | static_cast<CSSFontFaceSrcValue*>(this)->traceAfterDispatch(visitor); |
| 534 | return; |
| 535 | case FontFeatureClass: |
| 536 | static_cast<CSSFontFeatureValue*>(this)->traceAfterDispatch(visitor); |
| 537 | return; |
| 538 | case FunctionClass: |
| 539 | static_cast<CSSFunctionValue*>(this)->traceAfterDispatch(visitor); |
| 540 | return; |
| 541 | case LinearGradientClass: |
| 542 | static_cast<CSSLinearGradientValue*>(this)->traceAfterDispatch(visitor); |
| 543 | return; |
| 544 | case RadialGradientClass: |
| 545 | static_cast<CSSRadialGradientValue*>(this)->traceAfterDispatch(visitor); |
| 546 | return; |
| 547 | case CrossfadeClass: |
| 548 | static_cast<CSSCrossfadeValue*>(this)->traceAfterDispatch(visitor); |
| 549 | return; |
| 550 | case ImageClass: |
| 551 | static_cast<CSSImageValue*>(this)->traceAfterDispatch(visitor); |
| 552 | return; |
| 553 | case InheritedClass: |
| 554 | static_cast<CSSInheritedValue*>(this)->traceAfterDispatch(visitor); |
| 555 | return; |
| 556 | case InitialClass: |
| 557 | static_cast<CSSInitialValue*>(this)->traceAfterDispatch(visitor); |
| 558 | return; |
| 559 | case GridLineNamesClass: |
| 560 | static_cast<CSSGridLineNamesValue*>(this)->traceAfterDispatch(visitor); |
| 561 | return; |
| 562 | case GridTemplateAreasClass: |
| 563 | static_cast<CSSGridTemplateAreasValue*>(this)->traceAfterDispatch(visitor); |
| 564 | return; |
| 565 | case PrimitiveClass: |
| 566 | static_cast<CSSPrimitiveValue*>(this)->traceAfterDispatch(visitor); |
| 567 | return; |
| 568 | case ReflectClass: |
| 569 | static_cast<CSSReflectValue*>(this)->traceAfterDispatch(visitor); |
| 570 | return; |
| 571 | case ShadowClass: |
| 572 | static_cast<CSSShadowValue*>(this)->traceAfterDispatch(visitor); |
| 573 | return; |
| 574 | case CubicBezierTimingFunctionClass: |
| 575 | static_cast<CSSCubicBezierTimingFunctionValue*>(this)->traceAfterDispatch(visitor); |
| 576 | return; |
| 577 | case StepsTimingFunctionClass: |
| 578 | static_cast<CSSStepsTimingFunctionValue*>(this)->traceAfterDispatch(visitor); |
| 579 | return; |
| 580 | case UnicodeRangeClass: |
| 581 | static_cast<CSSUnicodeRangeValue*>(this)->traceAfterDispatch(visitor); |
| 582 | return; |
| 583 | case ValueListClass: |
| 584 | static_cast<CSSValueList*>(this)->traceAfterDispatch(visitor); |
| 585 | return; |
| 586 | case CSSTransformClass: |
| 587 | static_cast<CSSTransformValue*>(this)->traceAfterDispatch(visitor); |
| 588 | return; |
| 589 | case LineBoxContainClass: |
| 590 | static_cast<CSSLineBoxContainValue*>(this)->traceAfterDispatch(visitor); |
| 591 | return; |
| 592 | case CalculationClass: |
| 593 | static_cast<CSSCalcValue*>(this)->traceAfterDispatch(visitor); |
| 594 | return; |
| 595 | case ImageSetClass: |
| 596 | static_cast<CSSImageSetValue*>(this)->traceAfterDispatch(visitor); |
| 597 | return; |
| 598 | case CSSFilterClass: |
| 599 | static_cast<CSSFilterValue*>(this)->traceAfterDispatch(visitor); |
| 600 | return; |
| 601 | case CSSArrayFunctionValueClass: |
| 602 | static_cast<CSSArrayFunctionValue*>(this)->traceAfterDispatch(visitor); |
| 603 | return; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 604 | case SVGPaintClass: |
| 605 | static_cast<SVGPaint*>(this)->traceAfterDispatch(visitor); |
| 606 | return; |
| 607 | case CSSSVGDocumentClass: |
| 608 | static_cast<CSSSVGDocumentValue*>(this)->traceAfterDispatch(visitor); |
| 609 | return; |
| 610 | } |
| 611 | ASSERT_NOT_REACHED(); |
| 612 | } |
| 613 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame^] | 614 | PassRefPtrWillBeRawPtr<CSSValue> CSSValue::cloneForCSSOM() const |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 615 | { |
| 616 | switch (classType()) { |
| 617 | case PrimitiveClass: |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 618 | return toCSSPrimitiveValue(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 619 | case ValueListClass: |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 620 | return toCSSValueList(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 621 | case ImageClass: |
| 622 | case CursorImageClass: |
Torne (Richard Coles) | e524955 | 2013-05-15 11:35:13 +0100 | [diff] [blame] | 623 | return toCSSImageValue(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 624 | case CSSFilterClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 625 | return toCSSFilterValue(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 626 | case CSSArrayFunctionValueClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 627 | return toCSSArrayFunctionValue(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 628 | case CSSTransformClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 629 | return toCSSTransformValue(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 630 | case ImageSetClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 631 | return toCSSImageSetValue(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 632 | case SVGPaintClass: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 633 | return toSVGPaint(this)->cloneForCSSOM(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 634 | default: |
| 635 | ASSERT(!isSubtypeExposedToCSSOM()); |
| 636 | return TextCloneCSSValue::create(classType(), cssText()); |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | } |