Open Bug 1199054 Opened 9 years ago Updated 1 year ago

TryToStartImageLoad gets called way too often for CSS variable values that resolve to images

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: seth, Unassigned)

References

Details

It's not clear why, but bug 1181907 revealed that we are calling TryToStartImageLoad very frequently for CSS variable values (i.e., CSS property values that contain variables). Although bug 1181907 ensures that we won't leak ImageValues as a result of this, it still costs us in terms of performance, so we should fix it.

The actual problem is probably more fundamentally that we are recomputing computed styles way too often for CSS variable values. (Forgive my no-doubt-terribly-correct terminology there.)
(Terribly-incorrect, of course.)
Component: General → CSS Parsing and Computation
Product: Firefox → Core
I talked about this with seth a bit.  Perhaps we need to cache the substituted token stream, and only reparse and recompute it when the substituted token stream changes.  (I don't think we have anything that does that now.)
Since any use of a variable causes the struct to be uncacheable in the rule tree, I think we can just store the cached result of the resolved property value on the nsCSSTokenStream itself.  (Or an array of values, for when we had a shorthand with a variable reference.)
> store the cached result of the resolved property value on the nsCSSTokenStream itself

Not really, unless we keyed those cached results off the individual style contexts.  I guess they need to go on the style context somewhere.
Blocks: 1304363
Severity: normal → S3
See Also: → 1812422
You need to log in before you can comment on or make changes to this bug.