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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/css/CSSValue.h" | 28 #include "core/css/CSSValue.h" |
29 | 29 |
30 #include "core/css/CSSAspectRatioValue.h" | |
31 #include "core/css/CSSBorderImageSliceValue.h" | 30 #include "core/css/CSSBorderImageSliceValue.h" |
32 #include "core/css/CSSCalculationValue.h" | 31 #include "core/css/CSSCalculationValue.h" |
33 #include "core/css/CSSCanvasValue.h" | 32 #include "core/css/CSSCanvasValue.h" |
34 #include "core/css/CSSCrossfadeValue.h" | 33 #include "core/css/CSSCrossfadeValue.h" |
35 #include "core/css/CSSCursorImageValue.h" | 34 #include "core/css/CSSCursorImageValue.h" |
36 #include "core/css/CSSFilterValue.h" | 35 #include "core/css/CSSFilterValue.h" |
37 #include "core/css/CSSFontFaceSrcValue.h" | 36 #include "core/css/CSSFontFaceSrcValue.h" |
38 #include "core/css/CSSFontFeatureValue.h" | 37 #include "core/css/CSSFontFeatureValue.h" |
39 #include "core/css/CSSFontValue.h" | 38 #include "core/css/CSSFontValue.h" |
40 #include "core/css/CSSFunctionValue.h" | 39 #include "core/css/CSSFunctionValue.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 146 |
148 bool CSSValue::equals(const CSSValue& other) const | 147 bool CSSValue::equals(const CSSValue& other) const |
149 { | 148 { |
150 if (m_isTextClone) { | 149 if (m_isTextClone) { |
151 ASSERT(isCSSOMSafe()); | 150 ASSERT(isCSSOMSafe()); |
152 return toTextCloneCSSValue(this)->cssText() == other.cssText(); | 151 return toTextCloneCSSValue(this)->cssText() == other.cssText(); |
153 } | 152 } |
154 | 153 |
155 if (m_classType == other.m_classType) { | 154 if (m_classType == other.m_classType) { |
156 switch (m_classType) { | 155 switch (m_classType) { |
157 case AspectRatioClass: | |
158 return compareCSSValues<CSSAspectRatioValue>(*this, other); | |
159 case BorderImageSliceClass: | 156 case BorderImageSliceClass: |
160 return compareCSSValues<CSSBorderImageSliceValue>(*this, other); | 157 return compareCSSValues<CSSBorderImageSliceValue>(*this, other); |
161 case CanvasClass: | 158 case CanvasClass: |
162 return compareCSSValues<CSSCanvasValue>(*this, other); | 159 return compareCSSValues<CSSCanvasValue>(*this, other); |
163 case CursorImageClass: | 160 case CursorImageClass: |
164 return compareCSSValues<CSSCursorImageValue>(*this, other); | 161 return compareCSSValues<CSSCursorImageValue>(*this, other); |
165 case FontClass: | 162 case FontClass: |
166 return compareCSSValues<CSSFontValue>(*this, other); | 163 return compareCSSValues<CSSFontValue>(*this, other); |
167 case FontFaceSrcClass: | 164 case FontFaceSrcClass: |
168 return compareCSSValues<CSSFontFaceSrcValue>(*this, other); | 165 return compareCSSValues<CSSFontFaceSrcValue>(*this, other); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 222 |
226 String CSSValue::cssText() const | 223 String CSSValue::cssText() const |
227 { | 224 { |
228 if (m_isTextClone) { | 225 if (m_isTextClone) { |
229 ASSERT(isCSSOMSafe()); | 226 ASSERT(isCSSOMSafe()); |
230 return toTextCloneCSSValue(this)->cssText(); | 227 return toTextCloneCSSValue(this)->cssText(); |
231 } | 228 } |
232 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); | 229 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
233 | 230 |
234 switch (classType()) { | 231 switch (classType()) { |
235 case AspectRatioClass: | |
236 return toCSSAspectRatioValue(this)->customCSSText(); | |
237 case BorderImageSliceClass: | 232 case BorderImageSliceClass: |
238 return toCSSBorderImageSliceValue(this)->customCSSText(); | 233 return toCSSBorderImageSliceValue(this)->customCSSText(); |
239 case CanvasClass: | 234 case CanvasClass: |
240 return toCSSCanvasValue(this)->customCSSText(); | 235 return toCSSCanvasValue(this)->customCSSText(); |
241 case CursorImageClass: | 236 case CursorImageClass: |
242 return toCSSCursorImageValue(this)->customCSSText(); | 237 return toCSSCursorImageValue(this)->customCSSText(); |
243 case FontClass: | 238 case FontClass: |
244 return toCSSFontValue(this)->customCSSText(); | 239 return toCSSFontValue(this)->customCSSText(); |
245 case FontFaceSrcClass: | 240 case FontFaceSrcClass: |
246 return toCSSFontFaceSrcValue(this)->customCSSText(); | 241 return toCSSFontFaceSrcValue(this)->customCSSText(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 void CSSValue::destroy() | 293 void CSSValue::destroy() |
299 { | 294 { |
300 if (m_isTextClone) { | 295 if (m_isTextClone) { |
301 ASSERT(isCSSOMSafe()); | 296 ASSERT(isCSSOMSafe()); |
302 delete toTextCloneCSSValue(this); | 297 delete toTextCloneCSSValue(this); |
303 return; | 298 return; |
304 } | 299 } |
305 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); | 300 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
306 | 301 |
307 switch (classType()) { | 302 switch (classType()) { |
308 case AspectRatioClass: | |
309 delete toCSSAspectRatioValue(this); | |
310 return; | |
311 case BorderImageSliceClass: | 303 case BorderImageSliceClass: |
312 delete toCSSBorderImageSliceValue(this); | 304 delete toCSSBorderImageSliceValue(this); |
313 return; | 305 return; |
314 case CanvasClass: | 306 case CanvasClass: |
315 delete toCSSCanvasValue(this); | 307 delete toCSSCanvasValue(this); |
316 return; | 308 return; |
317 case CursorImageClass: | 309 case CursorImageClass: |
318 delete toCSSCursorImageValue(this); | 310 delete toCSSCursorImageValue(this); |
319 return; | 311 return; |
320 case FontClass: | 312 case FontClass: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 void CSSValue::finalizeGarbageCollectedObject() | 391 void CSSValue::finalizeGarbageCollectedObject() |
400 { | 392 { |
401 if (m_isTextClone) { | 393 if (m_isTextClone) { |
402 ASSERT(isCSSOMSafe()); | 394 ASSERT(isCSSOMSafe()); |
403 toTextCloneCSSValue(this)->~TextCloneCSSValue(); | 395 toTextCloneCSSValue(this)->~TextCloneCSSValue(); |
404 return; | 396 return; |
405 } | 397 } |
406 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); | 398 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
407 | 399 |
408 switch (classType()) { | 400 switch (classType()) { |
409 case AspectRatioClass: | |
410 toCSSAspectRatioValue(this)->~CSSAspectRatioValue(); | |
411 return; | |
412 case BorderImageSliceClass: | 401 case BorderImageSliceClass: |
413 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue(); | 402 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue(); |
414 return; | 403 return; |
415 case CanvasClass: | 404 case CanvasClass: |
416 toCSSCanvasValue(this)->~CSSCanvasValue(); | 405 toCSSCanvasValue(this)->~CSSCanvasValue(); |
417 return; | 406 return; |
418 case CursorImageClass: | 407 case CursorImageClass: |
419 toCSSCursorImageValue(this)->~CSSCursorImageValue(); | 408 toCSSCursorImageValue(this)->~CSSCursorImageValue(); |
420 return; | 409 return; |
421 case FontClass: | 410 case FontClass: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 void CSSValue::trace(Visitor* visitor) | 489 void CSSValue::trace(Visitor* visitor) |
501 { | 490 { |
502 if (m_isTextClone) { | 491 if (m_isTextClone) { |
503 ASSERT(isCSSOMSafe()); | 492 ASSERT(isCSSOMSafe()); |
504 toTextCloneCSSValue(this)->traceAfterDispatch(visitor); | 493 toTextCloneCSSValue(this)->traceAfterDispatch(visitor); |
505 return; | 494 return; |
506 } | 495 } |
507 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); | 496 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
508 | 497 |
509 switch (classType()) { | 498 switch (classType()) { |
510 case AspectRatioClass: | |
511 toCSSAspectRatioValue(this)->traceAfterDispatch(visitor); | |
512 return; | |
513 case BorderImageSliceClass: | 499 case BorderImageSliceClass: |
514 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor); | 500 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor); |
515 return; | 501 return; |
516 case CanvasClass: | 502 case CanvasClass: |
517 toCSSCanvasValue(this)->traceAfterDispatch(visitor); | 503 toCSSCanvasValue(this)->traceAfterDispatch(visitor); |
518 return; | 504 return; |
519 case CursorImageClass: | 505 case CursorImageClass: |
520 toCSSCursorImageValue(this)->traceAfterDispatch(visitor); | 506 toCSSCursorImageValue(this)->traceAfterDispatch(visitor); |
521 return; | 507 return; |
522 case FontClass: | 508 case FontClass: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 return toCSSTransformValue(this)->cloneForCSSOM(); | 600 return toCSSTransformValue(this)->cloneForCSSOM(); |
615 case ImageSetClass: | 601 case ImageSetClass: |
616 return toCSSImageSetValue(this)->cloneForCSSOM(); | 602 return toCSSImageSetValue(this)->cloneForCSSOM(); |
617 default: | 603 default: |
618 ASSERT(!isSubtypeExposedToCSSOM()); | 604 ASSERT(!isSubtypeExposedToCSSOM()); |
619 return TextCloneCSSValue::create(classType(), cssText()); | 605 return TextCloneCSSValue::create(classType(), cssText()); |
620 } | 606 } |
621 } | 607 } |
622 | 608 |
623 } | 609 } |
OLD | NEW |