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


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


Note

You need to log in before you can comment on or make changes to this bug.


Description From 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 From 2012-02-22 17:00:46 PST -------
Created an attachment (id=128337) [details]
Le Patch
------- Comment #2 From 2012-02-22 17:07:10 PST -------
(From update of attachment 128337 [details])
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 From 2012-02-22 17:39:48 PST -------
(From update of attachment 128337 [details])
Clearing flags on attachment: 128337

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