Bug 73682 - Attribute: Remove style() since it returns the same as decl().
Summary: Attribute: Remove style() since it returns the same as decl().
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 12:07 PST by Andreas Kling
Modified: 2012-01-24 07:25 PST (History)
3 users (show)

See Also:


Attachments
Patch (4.71 KB, patch)
2011-12-02 12:47 PST, Andreas Kling
darin: review-
darin: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.