Bug 1652618 - Ensure UA widgets are attached and detached synchronously. r=smaug
This changes the UA widget setup (again). What is going on in this test-case is that we have a marquee inside a video, two things that have their own UA widget. Given how the code is currently written, the runnable to attach and set up the marquee's widget is posted before than the video one (which is potentially reasonable). However that means that the marquee one runs before and flushes layout, and catches the video in an inconsistent state (in the composed doc, but without a shadow root). That in turn messes up reflow because nsVideoFrame assumes stuff. Rather than putting the attach / detach logic in script runners, just run that bit synchronously, and post only the event async. I audited the consumers of those events and it seems fine to me, they either already deal with the possibility of the shadow root being already detached or they don't care. For teardown, none of the destructors of the UA widgets rely on the shadow root being still attached to the element. Differential Revision: https://phabricator.services.mozilla.com/D84487
This commit is contained in:
@@ -4222,7 +4222,6 @@ nsresult HTMLInputElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
||||
IsInComposedDoc()) {
|
||||
// Construct Shadow Root so web content can be hidden in the DOM.
|
||||
AttachAndSetUAShadowRoot();
|
||||
NotifyUAWidgetSetupOrChange();
|
||||
}
|
||||
|
||||
if (mType == NS_FORM_INPUT_PASSWORD) {
|
||||
@@ -4487,7 +4486,6 @@ void HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify) {
|
||||
} else if (mType == NS_FORM_INPUT_TIME || mType == NS_FORM_INPUT_DATE) {
|
||||
// Switch to date/time type.
|
||||
AttachAndSetUAShadowRoot();
|
||||
NotifyUAWidgetSetupOrChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user