Closed Bug 269031 Opened 20 years ago Closed 19 years ago

memory cache for CSS stylesheets?

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 219276

People

(Reporter: dbaron, Assigned: dbaron)

Details

Darin suggests it might be useful to have a memory cache for parsed CSS stylesheets, much like the image cache. This could get the freshness lifetime from the channel and even set load flags so that it can keep its current tree if it gets a 304 response. The XUL prototype cache does some stylesheet caching already, but it's using the same objects, which wouldn't be sufficient for DOM mutation, I think. nsCSSStyleSheet also has inner/outer code to handle DOM mutation, but I'm not really sure how well tested that is, either. (Do we use it for UA stylesheets?)
> The XUL prototype cache does some stylesheet caching already, but it's using > the same objects, which wouldn't be sufficient for DOM mutation Note that we Clone() those (which uses the same inner and clones the outer)... More on that in a bit. > but I'm not really sure how well tested that is, either. It's not very well tested at all, to be frank. The cloning thing works OK until someone starts to modify the CSSOm. Then it screws up the internal state of the sheet at times (eg rules in sheet A will point to sheet B as their parentSheet in some circumstances). After ensuring unique inners, the style contexts for the page point to the rules in the old inner, while you're modifying the new inner, so changes to it don't get reflected in the page very well. Finally, anything involving cloning and @import is just broken. We have some bugs on this, but they've been pretty low priority so far. > (Do we use it for UA stylesheets?) We don't really clone those; we just reuse the same pointer in all the style contexts... this is why changing these with DOM inspector really screws with things. ;)
Related to/duplicate of bug 219276?
*** This bug has been marked as a duplicate of 219276 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.