[Bug 19276] [Shadow]: Consider simplifying addStyleSheet parameters

https://www.w3.org/Bugs/Public/show_bug.cgi?id=19276

Takashi Sakamoto <tasak@google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tasak@google.com

--- Comment #1 from Takashi Sakamoto <tasak@google.com> ---
(In reply to comment #0)
> Both HTMLLinkElement and HTMLStyleElement are used here as the glorified
> dictionaries, and that seems like abuse of their intended purpose.
> 
> We should do something simpler.
> 
> a) use actual dictionaries
> b) use two calls, one to add a stylesheet by URL, one to add a stylesheet as
> string.

Talking about b),  I'm not sure whether it is ok to create any hash key from
css text or not...

If we cannot quickly check whether the given css text (string) is the same as
the one which has been already parsed or not, we have to parse the same css
text many and many times.

I mean, from the view of implementation, is it possible to do (1)->(2)->(3) in
WebKit?

Suppose that we have some css text as WTF::String.
(1) we generate some hash key from the css text.
(2) we look up some hash table, mapping from some hash key (integer?) to an
instance of class StyleSheet.
(3) if some StyleSheet is found, we use the found one. Otherwise, we parse the
css text by using CSSParser and create a new StyleSheet (and register it with
the hash table).

If we run CSSParser every time we invoke addStyleSheet, it might cause
performance problem...

Best regards,
Takashi Sakamoto

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 12 October 2012 05:58:12 UTC