| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "core/css/CSSInitialValue.h" | 48 #include "core/css/CSSInitialValue.h" |
| 49 #include "core/css/CSSLineBoxContainValue.h" | 49 #include "core/css/CSSLineBoxContainValue.h" |
| 50 #include "core/css/CSSPrimitiveValue.h" | 50 #include "core/css/CSSPrimitiveValue.h" |
| 51 #include "core/css/CSSReflectValue.h" | 51 #include "core/css/CSSReflectValue.h" |
| 52 #include "core/css/CSSSVGDocumentValue.h" | 52 #include "core/css/CSSSVGDocumentValue.h" |
| 53 #include "core/css/CSSShadowValue.h" | 53 #include "core/css/CSSShadowValue.h" |
| 54 #include "core/css/CSSTimingFunctionValue.h" | 54 #include "core/css/CSSTimingFunctionValue.h" |
| 55 #include "core/css/CSSTransformValue.h" | 55 #include "core/css/CSSTransformValue.h" |
| 56 #include "core/css/CSSUnicodeRangeValue.h" | 56 #include "core/css/CSSUnicodeRangeValue.h" |
| 57 #include "core/css/CSSValueList.h" | 57 #include "core/css/CSSValueList.h" |
| 58 #include "core/svg/SVGPaint.h" | |
| 59 | 58 |
| 60 namespace WebCore { | 59 namespace WebCore { |
| 61 | 60 |
| 62 struct SameSizeAsCSSValue : public RefCountedWillBeGarbageCollectedFinalized<Sam
eSizeAsCSSValue> { | 61 struct SameSizeAsCSSValue : public RefCountedWillBeGarbageCollectedFinalized<Sam
eSizeAsCSSValue> { |
| 63 uint32_t bitfields; | 62 uint32_t bitfields; |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 COMPILE_ASSERT(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), CSS_value_should_
stay_small); | 65 COMPILE_ASSERT(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), CSS_value_should_
stay_small); |
| 67 | 66 |
| 68 class TextCloneCSSValue : public CSSValue { | 67 class TextCloneCSSValue : public CSSValue { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 case LineBoxContainClass: | 191 case LineBoxContainClass: |
| 193 return compareCSSValues<CSSLineBoxContainValue>(*this, other); | 192 return compareCSSValues<CSSLineBoxContainValue>(*this, other); |
| 194 case CalculationClass: | 193 case CalculationClass: |
| 195 return compareCSSValues<CSSCalcValue>(*this, other); | 194 return compareCSSValues<CSSCalcValue>(*this, other); |
| 196 case ImageSetClass: | 195 case ImageSetClass: |
| 197 return compareCSSValues<CSSImageSetValue>(*this, other); | 196 return compareCSSValues<CSSImageSetValue>(*this, other); |
| 198 case CSSFilterClass: | 197 case CSSFilterClass: |
| 199 return compareCSSValues<CSSFilterValue>(*this, other); | 198 return compareCSSValues<CSSFilterValue>(*this, other); |
| 200 case CSSArrayFunctionValueClass: | 199 case CSSArrayFunctionValueClass: |
| 201 return compareCSSValues<CSSArrayFunctionValue>(*this, other); | 200 return compareCSSValues<CSSArrayFunctionValue>(*this, other); |
| 202 case SVGPaintClass: | |
| 203 return compareCSSValues<SVGPaint>(*this, other); | |
| 204 case CSSSVGDocumentClass: | 201 case CSSSVGDocumentClass: |
| 205 return compareCSSValues<CSSSVGDocumentValue>(*this, other); | 202 return compareCSSValues<CSSSVGDocumentValue>(*this, other); |
| 206 default: | 203 default: |
| 207 ASSERT_NOT_REACHED(); | 204 ASSERT_NOT_REACHED(); |
| 208 return false; | 205 return false; |
| 209 } | 206 } |
| 210 } else if (m_classType == ValueListClass && other.m_classType != ValueListCl
ass) | 207 } else if (m_classType == ValueListClass && other.m_classType != ValueListCl
ass) |
| 211 return toCSSValueList(this)->equals(other); | 208 return toCSSValueList(this)->equals(other); |
| 212 else if (m_classType != ValueListClass && other.m_classType == ValueListClas
s) | 209 else if (m_classType != ValueListClass && other.m_classType == ValueListClas
s) |
| 213 return static_cast<const CSSValueList&>(other).equals(*this); | 210 return static_cast<const CSSValueList&>(other).equals(*this); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 case LineBoxContainClass: | 271 case LineBoxContainClass: |
| 275 return toCSSLineBoxContainValue(this)->customCSSText(); | 272 return toCSSLineBoxContainValue(this)->customCSSText(); |
| 276 case CalculationClass: | 273 case CalculationClass: |
| 277 return toCSSCalcValue(this)->customCSSText(); | 274 return toCSSCalcValue(this)->customCSSText(); |
| 278 case ImageSetClass: | 275 case ImageSetClass: |
| 279 return toCSSImageSetValue(this)->customCSSText(); | 276 return toCSSImageSetValue(this)->customCSSText(); |
| 280 case CSSFilterClass: | 277 case CSSFilterClass: |
| 281 return toCSSFilterValue(this)->customCSSText(); | 278 return toCSSFilterValue(this)->customCSSText(); |
| 282 case CSSArrayFunctionValueClass: | 279 case CSSArrayFunctionValueClass: |
| 283 return toCSSArrayFunctionValue(this)->customCSSText(); | 280 return toCSSArrayFunctionValue(this)->customCSSText(); |
| 284 case SVGPaintClass: | |
| 285 return toSVGPaint(this)->customCSSText(); | |
| 286 case CSSSVGDocumentClass: | 281 case CSSSVGDocumentClass: |
| 287 return toCSSSVGDocumentValue(this)->customCSSText(); | 282 return toCSSSVGDocumentValue(this)->customCSSText(); |
| 288 } | 283 } |
| 289 ASSERT_NOT_REACHED(); | 284 ASSERT_NOT_REACHED(); |
| 290 return String(); | 285 return String(); |
| 291 } | 286 } |
| 292 | 287 |
| 293 void CSSValue::destroy() | 288 void CSSValue::destroy() |
| 294 { | 289 { |
| 295 if (m_isTextClone) { | 290 if (m_isTextClone) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 return; | 375 return; |
| 381 case ImageSetClass: | 376 case ImageSetClass: |
| 382 delete toCSSImageSetValue(this); | 377 delete toCSSImageSetValue(this); |
| 383 return; | 378 return; |
| 384 case CSSFilterClass: | 379 case CSSFilterClass: |
| 385 delete toCSSFilterValue(this); | 380 delete toCSSFilterValue(this); |
| 386 return; | 381 return; |
| 387 case CSSArrayFunctionValueClass: | 382 case CSSArrayFunctionValueClass: |
| 388 delete toCSSArrayFunctionValue(this); | 383 delete toCSSArrayFunctionValue(this); |
| 389 return; | 384 return; |
| 390 case SVGPaintClass: | |
| 391 delete toSVGPaint(this); | |
| 392 return; | |
| 393 case CSSSVGDocumentClass: | 385 case CSSSVGDocumentClass: |
| 394 delete toCSSSVGDocumentValue(this); | 386 delete toCSSSVGDocumentValue(this); |
| 395 return; | 387 return; |
| 396 } | 388 } |
| 397 ASSERT_NOT_REACHED(); | 389 ASSERT_NOT_REACHED(); |
| 398 } | 390 } |
| 399 | 391 |
| 400 void CSSValue::finalizeGarbageCollectedObject() | 392 void CSSValue::finalizeGarbageCollectedObject() |
| 401 { | 393 { |
| 402 if (m_isTextClone) { | 394 if (m_isTextClone) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 return; | 479 return; |
| 488 case ImageSetClass: | 480 case ImageSetClass: |
| 489 toCSSImageSetValue(this)->~CSSImageSetValue(); | 481 toCSSImageSetValue(this)->~CSSImageSetValue(); |
| 490 return; | 482 return; |
| 491 case CSSFilterClass: | 483 case CSSFilterClass: |
| 492 toCSSFilterValue(this)->~CSSFilterValue(); | 484 toCSSFilterValue(this)->~CSSFilterValue(); |
| 493 return; | 485 return; |
| 494 case CSSArrayFunctionValueClass: | 486 case CSSArrayFunctionValueClass: |
| 495 toCSSArrayFunctionValue(this)->~CSSArrayFunctionValue(); | 487 toCSSArrayFunctionValue(this)->~CSSArrayFunctionValue(); |
| 496 return; | 488 return; |
| 497 case SVGPaintClass: | |
| 498 toSVGPaint(this)->~SVGPaint(); | |
| 499 return; | |
| 500 case CSSSVGDocumentClass: | 489 case CSSSVGDocumentClass: |
| 501 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue(); | 490 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue(); |
| 502 return; | 491 return; |
| 503 } | 492 } |
| 504 ASSERT_NOT_REACHED(); | 493 ASSERT_NOT_REACHED(); |
| 505 } | 494 } |
| 506 | 495 |
| 507 void CSSValue::trace(Visitor* visitor) | 496 void CSSValue::trace(Visitor* visitor) |
| 508 { | 497 { |
| 509 if (m_isTextClone) { | 498 if (m_isTextClone) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 return; | 583 return; |
| 595 case ImageSetClass: | 584 case ImageSetClass: |
| 596 toCSSImageSetValue(this)->traceAfterDispatch(visitor); | 585 toCSSImageSetValue(this)->traceAfterDispatch(visitor); |
| 597 return; | 586 return; |
| 598 case CSSFilterClass: | 587 case CSSFilterClass: |
| 599 toCSSFilterValue(this)->traceAfterDispatch(visitor); | 588 toCSSFilterValue(this)->traceAfterDispatch(visitor); |
| 600 return; | 589 return; |
| 601 case CSSArrayFunctionValueClass: | 590 case CSSArrayFunctionValueClass: |
| 602 toCSSArrayFunctionValue(this)->traceAfterDispatch(visitor); | 591 toCSSArrayFunctionValue(this)->traceAfterDispatch(visitor); |
| 603 return; | 592 return; |
| 604 case SVGPaintClass: | |
| 605 toSVGPaint(this)->traceAfterDispatch(visitor); | |
| 606 return; | |
| 607 case CSSSVGDocumentClass: | 593 case CSSSVGDocumentClass: |
| 608 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor); | 594 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor); |
| 609 return; | 595 return; |
| 610 } | 596 } |
| 611 ASSERT_NOT_REACHED(); | 597 ASSERT_NOT_REACHED(); |
| 612 } | 598 } |
| 613 | 599 |
| 614 PassRefPtrWillBeRawPtr<CSSValue> CSSValue::cloneForCSSOM() const | 600 PassRefPtrWillBeRawPtr<CSSValue> CSSValue::cloneForCSSOM() const |
| 615 { | 601 { |
| 616 switch (classType()) { | 602 switch (classType()) { |
| 617 case PrimitiveClass: | 603 case PrimitiveClass: |
| 618 return toCSSPrimitiveValue(this)->cloneForCSSOM(); | 604 return toCSSPrimitiveValue(this)->cloneForCSSOM(); |
| 619 case ValueListClass: | 605 case ValueListClass: |
| 620 return toCSSValueList(this)->cloneForCSSOM(); | 606 return toCSSValueList(this)->cloneForCSSOM(); |
| 621 case ImageClass: | 607 case ImageClass: |
| 622 case CursorImageClass: | 608 case CursorImageClass: |
| 623 return toCSSImageValue(this)->cloneForCSSOM(); | 609 return toCSSImageValue(this)->cloneForCSSOM(); |
| 624 case CSSFilterClass: | 610 case CSSFilterClass: |
| 625 return toCSSFilterValue(this)->cloneForCSSOM(); | 611 return toCSSFilterValue(this)->cloneForCSSOM(); |
| 626 case CSSArrayFunctionValueClass: | 612 case CSSArrayFunctionValueClass: |
| 627 return toCSSArrayFunctionValue(this)->cloneForCSSOM(); | 613 return toCSSArrayFunctionValue(this)->cloneForCSSOM(); |
| 628 case CSSTransformClass: | 614 case CSSTransformClass: |
| 629 return toCSSTransformValue(this)->cloneForCSSOM(); | 615 return toCSSTransformValue(this)->cloneForCSSOM(); |
| 630 case ImageSetClass: | 616 case ImageSetClass: |
| 631 return toCSSImageSetValue(this)->cloneForCSSOM(); | 617 return toCSSImageSetValue(this)->cloneForCSSOM(); |
| 632 case SVGPaintClass: | |
| 633 return toSVGPaint(this)->cloneForCSSOM(); | |
| 634 default: | 618 default: |
| 635 ASSERT(!isSubtypeExposedToCSSOM()); | 619 ASSERT(!isSubtypeExposedToCSSOM()); |
| 636 return TextCloneCSSValue::create(classType(), cssText()); | 620 return TextCloneCSSValue::create(classType(), cssText()); |
| 637 } | 621 } |
| 638 } | 622 } |
| 639 | 623 |
| 640 } | 624 } |
| OLD | NEW |