| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 TextCloneCSSValue(ClassType classType, const String& text) | 78 TextCloneCSSValue(ClassType classType, const String& text) |
| 79 : CSSValue(classType, /*isCSSOMSafe*/ true) | 79 : CSSValue(classType, /*isCSSOMSafe*/ true) |
| 80 , m_cssText(text) | 80 , m_cssText(text) |
| 81 { | 81 { |
| 82 m_isTextClone = true; | 82 m_isTextClone = true; |
| 83 } | 83 } |
| 84 | 84 |
| 85 String m_cssText; | 85 String m_cssText; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 DEFINE_CSS_VALUE_TYPE_CASTS(TextCloneCSSValue, isTextCloneCSSValue()); |
| 89 |
| 88 bool CSSValue::isImplicitInitialValue() const | 90 bool CSSValue::isImplicitInitialValue() const |
| 89 { | 91 { |
| 90 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); | 92 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); |
| 91 } | 93 } |
| 92 | 94 |
| 93 CSSValue::Type CSSValue::cssValueType() const | 95 CSSValue::Type CSSValue::cssValueType() const |
| 94 { | 96 { |
| 95 if (isInheritedValue()) | 97 if (isInheritedValue()) |
| 96 return CSS_INHERIT; | 98 return CSS_INHERIT; |
| 97 if (isPrimitiveValue()) | 99 if (isPrimitiveValue()) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 template<class ChildClassType> | 142 template<class ChildClassType> |
| 141 inline static bool compareCSSValues(const CSSValue& first, const CSSValue& secon
d) | 143 inline static bool compareCSSValues(const CSSValue& first, const CSSValue& secon
d) |
| 142 { | 144 { |
| 143 return static_cast<const ChildClassType&>(first).equals(static_cast<const Ch
ildClassType&>(second)); | 145 return static_cast<const ChildClassType&>(first).equals(static_cast<const Ch
ildClassType&>(second)); |
| 144 } | 146 } |
| 145 | 147 |
| 146 bool CSSValue::equals(const CSSValue& other) const | 148 bool CSSValue::equals(const CSSValue& other) const |
| 147 { | 149 { |
| 148 if (m_isTextClone) { | 150 if (m_isTextClone) { |
| 149 ASSERT(isCSSOMSafe()); | 151 ASSERT(isCSSOMSafe()); |
| 150 return static_cast<const TextCloneCSSValue*>(this)->cssText() == other.c
ssText(); | 152 return toTextCloneCSSValue(this)->cssText() == other.cssText(); |
| 151 } | 153 } |
| 152 | 154 |
| 153 if (m_classType == other.m_classType) { | 155 if (m_classType == other.m_classType) { |
| 154 switch (m_classType) { | 156 switch (m_classType) { |
| 155 case AspectRatioClass: | 157 case AspectRatioClass: |
| 156 return compareCSSValues<CSSAspectRatioValue>(*this, other); | 158 return compareCSSValues<CSSAspectRatioValue>(*this, other); |
| 157 case BorderImageSliceClass: | 159 case BorderImageSliceClass: |
| 158 return compareCSSValues<CSSBorderImageSliceValue>(*this, other); | 160 return compareCSSValues<CSSBorderImageSliceValue>(*this, other); |
| 159 case CanvasClass: | 161 case CanvasClass: |
| 160 return compareCSSValues<CSSCanvasValue>(*this, other); | 162 return compareCSSValues<CSSCanvasValue>(*this, other); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return toCSSValueList(this)->equals(other); | 230 return toCSSValueList(this)->equals(other); |
| 229 else if (m_classType != ValueListClass && other.m_classType == ValueListClas
s) | 231 else if (m_classType != ValueListClass && other.m_classType == ValueListClas
s) |
| 230 return static_cast<const CSSValueList&>(other).equals(*this); | 232 return static_cast<const CSSValueList&>(other).equals(*this); |
| 231 return false; | 233 return false; |
| 232 } | 234 } |
| 233 | 235 |
| 234 String CSSValue::cssText() const | 236 String CSSValue::cssText() const |
| 235 { | 237 { |
| 236 if (m_isTextClone) { | 238 if (m_isTextClone) { |
| 237 ASSERT(isCSSOMSafe()); | 239 ASSERT(isCSSOMSafe()); |
| 238 return static_cast<const TextCloneCSSValue*>(this)->cssText(); | 240 return toTextCloneCSSValue(this)->cssText(); |
| 239 } | 241 } |
| 240 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); | 242 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
| 241 | 243 |
| 242 switch (classType()) { | 244 switch (classType()) { |
| 243 case AspectRatioClass: | 245 case AspectRatioClass: |
| 244 return toCSSAspectRatioValue(this)->customCSSText(); | 246 return toCSSAspectRatioValue(this)->customCSSText(); |
| 245 case BorderImageSliceClass: | 247 case BorderImageSliceClass: |
| 246 return toCSSBorderImageSliceValue(this)->customCSSText(); | 248 return toCSSBorderImageSliceValue(this)->customCSSText(); |
| 247 case CanvasClass: | 249 case CanvasClass: |
| 248 return toCSSCanvasValue(this)->customCSSText(); | 250 return toCSSCanvasValue(this)->customCSSText(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 return toCSSTransformValue(this)->customSerializeResolvingVariables(vari
ables); | 328 return toCSSTransformValue(this)->customSerializeResolvingVariables(vari
ables); |
| 327 default: | 329 default: |
| 328 return cssText(); | 330 return cssText(); |
| 329 } | 331 } |
| 330 } | 332 } |
| 331 | 333 |
| 332 void CSSValue::destroy() | 334 void CSSValue::destroy() |
| 333 { | 335 { |
| 334 if (m_isTextClone) { | 336 if (m_isTextClone) { |
| 335 ASSERT(isCSSOMSafe()); | 337 ASSERT(isCSSOMSafe()); |
| 336 delete static_cast<TextCloneCSSValue*>(this); | 338 delete toTextCloneCSSValue(this); |
| 337 return; | 339 return; |
| 338 } | 340 } |
| 339 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); | 341 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
| 340 | 342 |
| 341 switch (classType()) { | 343 switch (classType()) { |
| 342 case AspectRatioClass: | 344 case AspectRatioClass: |
| 343 delete toCSSAspectRatioValue(this); | 345 delete toCSSAspectRatioValue(this); |
| 344 return; | 346 return; |
| 345 case BorderImageSliceClass: | 347 case BorderImageSliceClass: |
| 346 delete toCSSBorderImageSliceValue(this); | 348 delete toCSSBorderImageSliceValue(this); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 return toSVGColor(this)->cloneForCSSOM(); | 471 return toSVGColor(this)->cloneForCSSOM(); |
| 470 case SVGPaintClass: | 472 case SVGPaintClass: |
| 471 return toSVGPaint(this)->cloneForCSSOM(); | 473 return toSVGPaint(this)->cloneForCSSOM(); |
| 472 default: | 474 default: |
| 473 ASSERT(!isSubtypeExposedToCSSOM()); | 475 ASSERT(!isSubtypeExposedToCSSOM()); |
| 474 return TextCloneCSSValue::create(classType(), cssText()); | 476 return TextCloneCSSValue::create(classType(), cssText()); |
| 475 } | 477 } |
| 476 } | 478 } |
| 477 | 479 |
| 478 } | 480 } |
| OLD | NEW |