Bug 1441136: Some other minor cleanup. r?smaug
Now that XBL and Shadow DOM are not entangled we don't really need to do this.
MozReview-Commit-ID: GdgnE5QT2NR
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1698,20 +1698,19 @@ Element::BindToTree(nsIDocument* aDocume
if (IsHTMLElement()) {
SetDirOnBind(this, aParent);
}
uint32_t editableDescendantCount = 0;
UpdateEditableState(false);
- // If we had a pre-existing XBL binding,
- // we might have anonymous children that also need to be told that they are
- // moving.
- if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) && !GetShadowRoot()) {
+ // If we had a pre-existing XBL binding, we might have anonymous children that
+ // also need to be told that they are moving.
+ if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
nsXBLBinding* binding =
OwnerDoc()->BindingManager()->GetBindingWithContent(this);
if (binding) {
binding->BindAnonymousContent(
binding->GetAnonymousContent(),
this,
binding->PrototypeBinding()->ChromeOnlyContent());
@@ -1763,18 +1762,17 @@ Element::BindToTree(nsIDocument* aDocume
if (MayHaveStyle() && !IsXULElement()) {
// XXXbz if we already have a style attr parsed, this won't do
// anything... need to fix that.
// If MayHaveStyle() is true, we must be an nsStyledElement
static_cast<nsStyledElement*>(this)->ReparseStyleAttribute(false, false);
}
// Call BindToTree on shadow root children.
- ShadowRoot* shadowRoot = GetShadowRoot();
- if (shadowRoot) {
+ if (ShadowRoot* shadowRoot = GetShadowRoot()) {
shadowRoot->SetIsComposedDocParticipant(IsInComposedDoc());
for (nsIContent* child = shadowRoot->GetFirstChild(); child;
child = child->GetNextSibling()) {
rv = child->BindToTree(nullptr, shadowRoot,
shadowRoot->GetBindingParent(),
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -1984,21 +1982,19 @@ Element::UnbindFromTree(bool aDeep, bool
slots->mBindingParent = nullptr;
}
if (aNullParent || !mParent->IsInShadowTree()) {
slots->mContainingShadow = nullptr;
}
}
if (document) {
- // Notify XBL- & nsIAnonymousContentCreator-generated
- // anonymous content that the document is changing.
- // Unlike XBL, bindings for web components shadow DOM
- // do not get uninstalled.
- if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) && !GetShadowRoot()) {
+ if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
+ // Notify XBL- & nsIAnonymousContentCreator-generated anonymous content
+ // that the document is changing.
nsContentUtils::AddScriptRunner(
new RemoveFromBindingManagerRunnable(
document->BindingManager(), this, document));
nsXBLBinding* binding =
document->BindingManager()->GetBindingWithContent(this);
if (binding) {
nsXBLBinding::UnbindAnonymousContent(
document,