In the context of a headless browser, I'm trying to solve a problem with VirtualTime and StyleEngine. Suppose a page has an onload handler which adds a stylesheet with a webfont. Lets say we've turned on Virtual time with policy VirtualTimePolicy::DETERMINISTIC_LOADING. Virtual time is not supposed to advance while there are network fetches pending.
Unfortunately after the document has finished loading there's a gap between the stylesheet getting loaded and StyleEngine::ApplyRuleSetChanges getting called which triggers the load of the webfont, during which virtual time can advance when it probably shouldn't.
I'm thinking of wiring up a signal to the WebFrameScheduler to tell it about dirty styles, and I'm wondering if this can be really simple or of I need to do something more complex.
Specifically if StyleEngine::MarkDocumentDirty told WebFrameScheduler it was dirty and if StyleEngine::ApplyRuleSetChanges and StyleEngine::~StyleEngine cleared the bit would that work? The thing I;m worried about is there might be something that defers calling StyleEngine::ApplyRuleSetChanges which might cause virtual time to stall forever.
Does Blink try to be smart about when StyleEngine::ApplyRuleSetChanges is called?
Thanks!
Alex Clarke