Bug 79304 - Make parsing color presentation attributes do less pointless work.
: Make parsing color presentation attributes do less pointless work.
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: HTML DOM
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To: Andreas Kling
:
Depends on:
Blocks: 78070
  Show dependency treegraph
 
Reported: 2012-02-22 16:47 PST by Andreas Kling
Modified: 2012-02-22 17:39 PST (History)
0 users

See Also:


Attachments
Le Patch (6.71 KB, patch)
2012-02-22 17:00 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2012-02-22 16:47:47 PST
HTMLElement::addHTMLColorToStyle() already knows how to extract a color from the string it receives. We should create the CSSValue there instead of simply validating the string before sending it through CSSParser.
Comment 1 Andreas Kling 2012-02-22 17:00:46 PST
Created attachment 128337 [details]
Le Patch
Comment 2 Antti Koivisto 2012-02-22 17:07:10 PST
Comment on attachment 128337 [details]
Le Patch

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

> Source/WebCore/ChangeLog:10
> +
> +        Let HTMLElement::addHTMLColorToStyle() construct the color CSSValue directly
> +        rather than passing a string that has to go through CSSParser.
> +

A word about performance?

> Source/WebCore/css/StylePropertySet.h:74
> +    // These expand shorthand properties into multiple properties.
> +    bool setProperty(int propertyID, const String& value, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
> +    void setProperty(int propertyID, PassRefPtr<CSSValue>, bool important = false);
> +
> +    // These do not. FIXME: This is too messy, we can do better.
>      bool setProperty(int propertyID, int value, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
>      bool setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
> -    bool setProperty(int propertyID, const String& value, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
>      void setProperty(const CSSProperty&, CSSProperty* slot = 0);

This really needs cleaning up. Oh well, you have the FIXME.
Comment 3 Andreas Kling 2012-02-22 17:39:48 PST
Comment on attachment 128337 [details]
Le Patch

Clearing flags on attachment: 128337

Committed r108586: <http://trac.webkit.org/changeset/108586>
Comment 4 Andreas Kling 2012-02-22 17:39:56 PST
All reviewed patches have been landed.  Closing bug.