зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 8323b7bb5e1a (bug 1652618) for mochitest failures on test_audiocontrols_dimensions.html . CLOSED TREE
This commit is contained in:
Родитель
3b776aad05
Коммит
ce05a24710
|
@ -1122,20 +1122,24 @@ already_AddRefed<ShadowRoot> Element::AttachShadowWithoutNameChecks(
|
|||
return shadowRoot.forget();
|
||||
}
|
||||
|
||||
void Element::AttachAndSetUAShadowRoot(NotifyUAWidgetSetup aNotify) {
|
||||
void Element::AttachAndSetUAShadowRoot() {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!CanAttachShadowDOM(),
|
||||
"Cannot be used to attach UI shadow DOM");
|
||||
|
||||
if (!GetShadowRoot()) {
|
||||
RefPtr<ShadowRoot> shadowRoot =
|
||||
AttachShadowWithoutNameChecks(ShadowRootMode::Closed);
|
||||
shadowRoot->SetIsUAWidget();
|
||||
}
|
||||
// Attach the UA Widget Shadow Root in a runnable so that the code runs
|
||||
// in the same order of NotifyUAWidget* calls.
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableFunction(
|
||||
"Element::AttachAndSetUAShadowRoot::Runnable",
|
||||
[self = RefPtr<Element>(this)]() {
|
||||
if (self->GetShadowRoot()) {
|
||||
MOZ_ASSERT(self->GetShadowRoot()->IsUAWidget());
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(GetShadowRoot()->IsUAWidget());
|
||||
if (aNotify == NotifyUAWidgetSetup::Yes) {
|
||||
NotifyUAWidgetSetupOrChange();
|
||||
}
|
||||
RefPtr<ShadowRoot> shadowRoot =
|
||||
self->AttachShadowWithoutNameChecks(ShadowRootMode::Closed);
|
||||
shadowRoot->SetIsUAWidget();
|
||||
}));
|
||||
}
|
||||
|
||||
void Element::NotifyUAWidgetSetupOrChange() {
|
||||
|
@ -1149,6 +1153,9 @@ void Element::NotifyUAWidgetSetupOrChange() {
|
|||
"Element::NotifyUAWidgetSetupOrChange::UAWidgetSetupOrChange",
|
||||
[self = RefPtr<Element>(this),
|
||||
ownerDoc = RefPtr<Document>(OwnerDoc())]() {
|
||||
MOZ_ASSERT(self->GetShadowRoot() &&
|
||||
self->GetShadowRoot()->IsUAWidget());
|
||||
|
||||
nsContentUtils::DispatchChromeEvent(ownerDoc, self,
|
||||
u"UAWidgetSetupOrChange"_ns,
|
||||
CanBubble::eYes, Cancelable::eNo);
|
||||
|
@ -1157,20 +1164,18 @@ void Element::NotifyUAWidgetSetupOrChange() {
|
|||
|
||||
void Element::NotifyUAWidgetTeardown(UnattachShadowRoot aUnattachShadowRoot) {
|
||||
MOZ_ASSERT(IsInComposedDoc());
|
||||
if (!GetShadowRoot()) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(GetShadowRoot()->IsUAWidget());
|
||||
if (aUnattachShadowRoot == UnattachShadowRoot::Yes) {
|
||||
UnattachShadow();
|
||||
}
|
||||
|
||||
// The runnable will dispatch an event to tear down UA Widget,
|
||||
// and unattach the Shadow Root.
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableFunction(
|
||||
"Element::NotifyUAWidgetTeardownAndUnattachShadow::UAWidgetTeardown",
|
||||
[self = RefPtr<Element>(this),
|
||||
[aUnattachShadowRoot, self = RefPtr<Element>(this),
|
||||
ownerDoc = RefPtr<Document>(OwnerDoc())]() {
|
||||
if (!self->GetShadowRoot()) {
|
||||
// No UA Widget Shadow Root was ever attached.
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(self->GetShadowRoot()->IsUAWidget());
|
||||
|
||||
// Bail out if the element is being collected by CC
|
||||
bool hasHadScriptObject = true;
|
||||
nsIScriptGlobalObject* scriptObject =
|
||||
|
@ -1179,9 +1184,16 @@ void Element::NotifyUAWidgetTeardown(UnattachShadowRoot aUnattachShadowRoot) {
|
|||
return;
|
||||
}
|
||||
|
||||
Unused << nsContentUtils::DispatchChromeEvent(
|
||||
nsresult rv = nsContentUtils::DispatchChromeEvent(
|
||||
ownerDoc, self, u"UAWidgetTeardown"_ns, CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aUnattachShadowRoot == UnattachShadowRoot::Yes) {
|
||||
self->UnattachShadow();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -1251,8 +1251,7 @@ class Element : public FragmentOrElement {
|
|||
ShadowRootMode aMode);
|
||||
|
||||
// Attach UA Shadow Root if it is not attached.
|
||||
enum class NotifyUAWidgetSetup : bool { No, Yes };
|
||||
void AttachAndSetUAShadowRoot(NotifyUAWidgetSetup = NotifyUAWidgetSetup::Yes);
|
||||
void AttachAndSetUAShadowRoot();
|
||||
|
||||
// Dispatch an event to UAWidgetsChild, triggering construction
|
||||
// or onchange callback on the existing widget.
|
||||
|
|
|
@ -2547,6 +2547,7 @@ void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
|||
thisEl->NotifyUAWidgetTeardown();
|
||||
} else if (!hadProblemState && hasProblemState) {
|
||||
thisEl->AttachAndSetUAShadowRoot();
|
||||
thisEl->NotifyUAWidgetSetupOrChange();
|
||||
}
|
||||
} else if (aOldType != mType) {
|
||||
// If our state changed, then we already recreated frames
|
||||
|
|
|
@ -4219,6 +4219,7 @@ 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) {
|
||||
|
@ -4483,6 +4484,7 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ nsresult HTMLMarqueeElement::BindToTree(BindContext& aContext,
|
|||
|
||||
if (IsInComposedDoc()) {
|
||||
AttachAndSetUAShadowRoot();
|
||||
NotifyUAWidgetSetupOrChange();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -4741,6 +4741,7 @@ nsresult HTMLMediaElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
|||
if (IsInComposedDoc()) {
|
||||
// Construct Shadow Root so web content can be hidden in the DOM.
|
||||
AttachAndSetUAShadowRoot();
|
||||
NotifyUAWidgetSetupOrChange();
|
||||
|
||||
// The preload action depends on the value of the autoplay attribute.
|
||||
// It's value may have changed, so update it.
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsPIDOMWindow.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "nsVariant.h"
|
||||
|
@ -85,7 +84,7 @@ nsresult nsXMLPrettyPrinter::PrettyPrint(Document* aDocument,
|
|||
}
|
||||
|
||||
// Attach an UA Widget Shadow Root on it.
|
||||
rootElement->AttachAndSetUAShadowRoot(Element::NotifyUAWidgetSetup::No);
|
||||
rootElement->AttachAndSetUAShadowRoot();
|
||||
RefPtr<ShadowRoot> shadowRoot = rootElement->GetShadowRoot();
|
||||
MOZ_RELEASE_ASSERT(shadowRoot && shadowRoot->IsUAWidget(),
|
||||
"There should be a UA Shadow Root here.");
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<style>
|
||||
* {
|
||||
float: left !important;
|
||||
all: initial;
|
||||
block-size: 247ch;
|
||||
columns: 251ch auto;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.addEventListener('load', () => {
|
||||
var x = document.createElementNS('http://www.w3.org/1999/xhtml', 'audio')
|
||||
try { x.innerHTML = '<marquee>' } catch (e) {}
|
||||
try { document.documentElement.appendChild(x) } catch (e) {}
|
||||
})
|
||||
</script>
|
|
@ -780,5 +780,4 @@ load 1640275.html
|
|||
pref(layout.accessiblecaret.enabled,true) load 1644819.html
|
||||
load 1645549-1.html
|
||||
load 1648577.html
|
||||
load 1652618.html
|
||||
load 1652897.html
|
||||
|
|
|
@ -50,13 +50,6 @@ class UAWidgetsChild extends JSWindowActorChild {
|
|||
let { widget } = this.widgets.get(aElement);
|
||||
|
||||
if (typeof widget.onchange == "function") {
|
||||
if (aElement.openOrClosedShadowRoot != widget.shadowRoot) {
|
||||
Cu.reportError(
|
||||
"Getting a UAWidgetSetupOrChange event without the ShadowRoot. " +
|
||||
"Torn down already?"
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
widget.onchange();
|
||||
} catch (ex) {
|
||||
|
@ -114,8 +107,7 @@ class UAWidgetsChild extends JSWindowActorChild {
|
|||
let shadowRoot = aElement.openOrClosedShadowRoot;
|
||||
if (!shadowRoot) {
|
||||
Cu.reportError(
|
||||
"Getting a UAWidgetSetupOrChange event without the Shadow Root. " +
|
||||
"Torn down already?"
|
||||
"Getting a UAWidgetSetupOrChange event without the Shadow Root."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -138,9 +130,6 @@ class UAWidgetsChild extends JSWindowActorChild {
|
|||
if (!isSystemPrincipal) {
|
||||
widget = widget.wrappedJSObject;
|
||||
}
|
||||
if (widget.shadowRoot != shadowRoot) {
|
||||
Cu.reportError("Widgets should expose their shadow root.");
|
||||
}
|
||||
this.widgets.set(aElement, { widget, widgetName });
|
||||
try {
|
||||
widget.onsetup();
|
||||
|
|
Загрузка…
Ссылка в новой задаче