Ignore:
Timestamp:
Oct 10, 2013, 8:37:18 PM (12 years ago)
Author:
[email protected]
Message:

Add toSVGColor|Paint() to cleanup static_cast<>, and use it
https://bugs.webkit.org/show_bug.cgi?id=122630

Reviewed by Andreas Kling.

SVGColor and SVGPaint can't use CSS_VALUE_TYPE_CASTS(), this cl adds
toSVGColor() and toSVGPaint() manually. Those functions will help to
detect bad type cast.

  • css/CSSValue.cpp:

(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
(WebCore::CSSValue::cloneForCSSOM):

  • css/SVGCSSStyleSelector.cpp:

(WebCore::StyleResolver::applySVGProperty):

  • svg/SVGColor.h:

(WebCore::toSVGColor):

  • svg/SVGPaint.h:

(WebCore::toSVGPaint):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSValue.cpp

    r157211 r157286  
    350350#if ENABLE(SVG)
    351351    case SVGColorClass:
    352         return static_cast<const SVGColor*>(this)->customCSSText();
     352        return toSVGColor(this)->customCSSText();
    353353    case SVGPaintClass:
    354         return static_cast<const SVGPaint*>(this)->customCSSText();
     354        return toSVGPaint(this)->customCSSText();
    355355    case WebKitCSSSVGDocumentClass:
    356356        return toWebKitCSSSVGDocumentValue(this)->customCSSText();
     
    498498#if ENABLE(SVG)
    499499    case SVGColorClass:
    500         delete static_cast<SVGColor*>(this);
     500        delete toSVGColor(this);
    501501        return;
    502502    case SVGPaintClass:
    503         delete static_cast<SVGPaint*>(this);
     503        delete toSVGPaint(this);
    504504        return;
    505505    case WebKitCSSSVGDocumentClass:
     
    541541#if ENABLE(SVG)
    542542    case SVGColorClass:
    543         return static_cast<const SVGColor*>(this)->cloneForCSSOM();
     543        return toSVGColor(this)->cloneForCSSOM();
    544544    case SVGPaintClass:
    545         return static_cast<const SVGPaint*>(this)->cloneForCSSOM();
     545        return toSVGPaint(this)->cloneForCSSOM();
    546546#endif
    547547    default:
Note: See TracChangeset for help on using the changeset viewer.