Bug 73682

Summary: Attribute: Remove style() since it returns the same as decl().
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Status: RESOLVED INVALID    
Severity: Normal CC: andersca, eric, hyatt
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review-, darin: commit-queue-

Description Andreas Kling 2011-12-02 12:07:15 PST
Attribute::style() is an artifact of the deprecated Attr::style() API that we need to support because it shipped in Obj-C bindings.
It returns the same as Attribute::decl() albeit with a lower return type specificity. We should just remove it and switch the few call sites to decl().
Comment 1 Andreas Kling 2011-12-02 12:47:29 PST
Created attachment 117670 [details]
Patch
Comment 2 Darin Adler 2011-12-03 20:25:59 PST
Comment on attachment 117670 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=117670&action=review

Great idea. The name decl is so sad.

review- because I don’t want to add that static_cast.

> Source/WebCore/svg/SVGStyledElement.cpp:440
> -    return cssSVGAttr->style()->getPropertyCSSValue(name);
> +    return static_cast<CSSStyleDeclaration*>(cssSVGAttr->decl())->getPropertyCSSValue(name);

This cast is not the right way to code this. There are three ways to do it that I am OK with:

1) If we think it’s OK that CSSMutableStyleDeclaration hides the string overloads for the getters, then we should write:

    cssSVGAttr->decl()->CSSStyleDeclaration::getPropertyCSSValue(name);

2) Or we could write:

    CSSStyleDeclaration* style = cssSVGAttr->decl();
    return style->getPropertyCSSValue(name);

3) But, best of all, we should probably do this:

    using CSSStyleDeclaration::getPropertyCSSValue;

If we put that in CSSMutableStyleDeclaration.h then it should bring down the overloads of getPropertyCSSValue so they are visible and not hidden by the function we are overriding with.
Comment 3 Andreas Kling 2012-01-24 07:24:45 PST
D'oh, forgot about this long enough until it got fixed by someone else (Antti) on bug 76904.