Bug 79304

Summary: Make parsing color presentation attributes do less pointless work.
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 78070    
Attachments:
Description Flags
Le Patch none

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.