Open Bug 1435940 Opened 2 years ago Updated 1 year ago

stylo: Consider using invalidation for media feature values change


(Core :: CSS Parsing and Computation, defect, P3)




Tracking Status
firefox-esr52 --- unaffected
firefox58 --- wontfix
firefox59 --- wontfix
firefox60 --- affected


(Reporter: xidorn, Unassigned)


(Blocks 2 open bugs)


See the profiles in bug 1420423 comment 56. One of the obvious source of the regression on tresize is the full document restyle when @media rule match changes.

There are four restyles shown in that.

Looking at our chrome stylesheets, the only affected media rules seem to be:

All of them should only affect very small number of element (they are actually only apply to at most 2 elements with specific IDs), and they are only setting min-width, which is a reset property.

So I suppose we should use the similar mechanism we implemented for document state bits to only invalidate the affected elements by media rule changes, rather than always triggering a full document restyle.
FWIW, the four restyles take 56ms in total (14ms each on average), which is over half of the tresize regression excluding which has been explained by bug 1435939.
So, the easiest thing to do here I think would be to treat them as stylesheet addition / removals wrt invalidation. The reason for this is because I think we want to avoid the document traversal to be synchronous, though I could be wrong and we may reuse it I guess.

Whatever solution we end up doing, it clearly affects what we do with bug 1435949.

The annoying part of this is the XBL stuff of course... Right don't do any kind of stylesheet invalidation for those... I can try to take a look today.
Blocks: 1435949
Flags: needinfo?(emilio)
Assigning to Emilio because he said he would take a look.
Assignee: nobody → emilio
Xidorn says Emilio's fix for XUL sizing bug 1439875 will make this bug much less important.
Priority: P1 → P3
I don't think this is worth the churn right now.
Assignee: emilio → nobody
Flags: needinfo?(emilio)
You need to log in before you can comment on or make changes to this bug.