Add styling flush notification

RESOLVED WONTFIX

Status

()

RESOLVED WONTFIX
2 years ago
2 years ago

People

(Reporter: mconley, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
In bug 1334642, sfoster is removing a synchronous style flush that we're doing via script when activating and deactivating browser windows.

It'd be great if we had some way of writing tests to ensure that between two points of interest in script, that no style flushes have occurred. That way, we could add tests for "critical user interactions" and ensure only the minimum number of flushes required occur (and no new ones get introduced).

Something similar was added for reflows in bug 453650.

Updated

2 years ago
Summary: Add styling flush observer → Add styling flush notification
(Reporter)

Comment 1

2 years ago
Hey ehsan, this is what we talked about this morning.
Flags: needinfo?(ehsan)
So one existing way we have to add tests for things like this is on DOMWindowUtils:  it has an "elementsRestyled" property that's just a counter that increments every time we restyle an element.  So if you want to assert that no elements have had their style recomputed in an interval, you can check that the counter at the end of that interval is the same as the counter at the beginning of the interval.

(It has similar framesConstructed and framesReflowed counters.)

See https://searchfox.org/mozilla-central/rev/7419b368156a6efa24777b21b0e5706be89a9c2f/dom/interfaces/﷒0
(And, FWIW, an observer seems like it's going to have more overhead than the incrementing counter, so if there's a reason the counter doesn't work and you actually need an observer instead, you should say so.)
(Reporter)

Comment 5

2 years ago
Yes, I think we can work with those counters. Thank you for pointing those out!
Flags: needinfo?(mconley)
(Reporter)

Comment 6

2 years ago
I think what dbaron pointed out is sufficient for now. Going to WONTFIX unless there's a good reason to add a new notification that the counters don't satisfy.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
(Reporter)

Updated

2 years ago
Flags: needinfo?(ehsan)
You need to log in before you can comment on or make changes to this bug.