Bug 1881011 - Refactor UnbindFromTree to take a context argument. r=smaug

Much like BindToTree.

This will be useful because I need to pass more information through
UnbindFromTree() to speed up dir=auto for bug 1874040.

Differential Revision: https://phabricator.services.mozilla.com/D202215
This commit is contained in:
Emilio Cobos Álvarez 2024-02-20 15:05:40 +00:00
Родитель 95ba0fd6ee
Коммит 8925ee2d3d
106 изменённых файлов: 237 добавлений и 231 удалений

Просмотреть файл

@ -11,32 +11,22 @@
#include "mozilla/dom/CharacterData.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/BindContext.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/MutationObservers.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/UnbindContext.h"
#include "nsReadableUtils.h"
#include "mozilla/InternalMutationEvent.h"
#include "nsCOMPtr.h"
#include "nsDOMString.h"
#include "nsChangeHint.h"
#include "nsCOMArray.h"
#include "mozilla/dom/DirectionalityUtils.h"
#include "nsCCUncollectableMarker.h"
#include "mozAutoDocUpdate.h"
#include "nsIContentInlines.h"
#include "nsTextNode.h"
#include "nsBidiUtils.h"
#include "PLDHashTable.h"
#include "mozilla/Sprintf.h"
#include "nsWindowSizes.h"
#include "nsWrapperCacheInlines.h"
#if defined(ACCESSIBILITY) && defined(DEBUG)
# include "nsAccessibilityService.h"
@ -478,13 +468,14 @@ nsresult CharacterData::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void CharacterData::UnbindFromTree(bool aNullParent) {
void CharacterData::UnbindFromTree(UnbindContext& aContext) {
// Unset frame flags; if we need them again later, they'll get set again.
UnsetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE | NS_REFRAME_IF_WHITESPACE);
HandleShadowDOMRelatedRemovalSteps(aNullParent);
const bool nullParent = aContext.IsUnbindRoot(this);
HandleShadowDOMRelatedRemovalSteps(nullParent);
if (aNullParent) {
if (nullParent) {
if (GetParent()) {
NS_RELEASE(mParent);
} else {
@ -495,15 +486,13 @@ void CharacterData::UnbindFromTree(bool aNullParent) {
ClearInDocument();
SetIsConnected(false);
if (aNullParent || !mParent->IsInShadowTree()) {
if (nullParent || !mParent->IsInShadowTree()) {
UnsetFlags(NODE_IS_IN_SHADOW_TREE);
// Begin keeping track of our subtree root.
SetSubtreeRootPointer(aNullParent ? this : mParent->SubtreeRoot());
}
SetSubtreeRootPointer(nullParent ? this : mParent->SubtreeRoot());
if (nsExtendedContentSlots* slots = GetExistingExtendedContentSlots()) {
if (aNullParent || !mParent->IsInShadowTree()) {
if (nsExtendedContentSlots* slots = GetExistingExtendedContentSlots()) {
slots->mContainingShadow = nullptr;
}
}

Просмотреть файл

@ -106,7 +106,7 @@ class CharacterData : public nsIContent {
// Implementation for nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
const nsTextFragment* GetText() override { return &mText; }
uint32_t TextLength() const final { return TextDataLength(); }

Просмотреть файл

@ -66,7 +66,7 @@ class DocumentFragment : public FragmentOrElement {
return NS_ERROR_NOT_IMPLEMENTED;
}
virtual void UnbindFromTree(bool aNullParent) override {
virtual void UnbindFromTree(UnbindContext&) override {
NS_ASSERTION(false, "Trying to unbind a fragment from a tree");
}

Просмотреть файл

@ -106,6 +106,7 @@
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/Text.h"
#include "mozilla/dom/UnbindContext.h"
#include "mozilla/dom/WindowBinding.h"
#include "mozilla/dom/XULCommandEvent.h"
#include "mozilla/dom/nsCSPContext.h"
@ -1958,7 +1959,8 @@ nsresult Element::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
bool WillDetachFromShadowOnUnbind(const Element& aElement, bool aNullParent) {
static bool WillDetachFromShadowOnUnbind(const Element& aElement,
bool aNullParent) {
// If our parent still is in a shadow tree by now, and we're not removing
// ourselves from it, then we're still going to be in a shadow tree after
// this.
@ -1966,12 +1968,14 @@ bool WillDetachFromShadowOnUnbind(const Element& aElement, bool aNullParent) {
(aNullParent || !aElement.GetParent()->IsInShadowTree());
}
void Element::UnbindFromTree(bool aNullParent) {
HandleShadowDOMRelatedRemovalSteps(aNullParent);
void Element::UnbindFromTree(UnbindContext& aContext) {
const bool nullParent = aContext.IsUnbindRoot(this);
HandleShadowDOMRelatedRemovalSteps(nullParent);
if (HasFlag(ELEMENT_IS_DATALIST_OR_HAS_DATALIST_ANCESTOR) &&
!IsHTMLElement(nsGkAtoms::datalist)) {
if (aNullParent) {
if (nullParent) {
UnsetFlags(ELEMENT_IS_DATALIST_OR_HAS_DATALIST_ANCESTOR);
} else {
nsIContent* parent = GetParent();
@ -1983,7 +1987,7 @@ void Element::UnbindFromTree(bool aNullParent) {
}
const bool detachingFromShadow =
WillDetachFromShadowOnUnbind(*this, aNullParent);
WillDetachFromShadowOnUnbind(*this, nullParent);
// Make sure to only remove from the ID table if our subtree root is actually
// changing.
if (IsInUncomposedDoc() || detachingFromShadow) {
@ -2033,7 +2037,7 @@ void Element::UnbindFromTree(bool aNullParent) {
data->ClearAllAnimationCollections();
}
if (aNullParent) {
if (nullParent) {
if (GetParent()) {
RefPtr<nsINode> p;
p.swap(mParent);
@ -2071,15 +2075,13 @@ void Element::UnbindFromTree(bool aNullParent) {
ClearElementCreatedFromPrototypeAndHasUnmodifiedL10n();
}
if (aNullParent || !mParent->IsInShadowTree()) {
if (nullParent || !mParent->IsInShadowTree()) {
UnsetFlags(NODE_IS_IN_SHADOW_TREE);
// Begin keeping track of our subtree root.
SetSubtreeRootPointer(aNullParent ? this : mParent->SubtreeRoot());
}
SetSubtreeRootPointer(nullParent ? this : mParent->SubtreeRoot());
if (nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots()) {
if (aNullParent || !mParent->IsInShadowTree()) {
if (nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots()) {
slots->mContainingShadow = nullptr;
}
}
@ -2121,9 +2123,7 @@ void Element::UnbindFromTree(bool aNullParent) {
for (nsIContent* child = GetFirstChild(); child;
child = child->GetNextSibling()) {
// Note that we pass false for aNullParent here, since we don't want
// the kids to forget us.
child->UnbindFromTree(false);
child->UnbindFromTree(aContext);
}
MutationObservers::NotifyParentChainChanged(this);

Просмотреть файл

@ -474,7 +474,8 @@ class Element : public FragmentOrElement {
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
using nsIContent::UnbindFromTree;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
static void MapNoAttributesInto(mozilla::MappedDeclarationsBuilder&);

Просмотреть файл

@ -16,11 +16,11 @@
#include "mozilla/dom/FragmentOrElement.h"
#include "DOMIntersectionObserver.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/DeclarationBlock.h"
#include "mozilla/EffectSet.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/ElementAnimationData.h"
#include "mozilla/DeclarationBlock.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/mozInlineSpellChecker.h"
#include "mozilla/PresShell.h"
@ -30,39 +30,31 @@
#include "mozilla/URLExtraData.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/RadioGroupContainer.h"
#include "mozilla/dom/UnbindContext.h"
#include "nsDOMAttributeMap.h"
#include "nsAtom.h"
#include "mozilla/dom/NodeInfo.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentInlines.h"
#include "nsIControllers.h"
#include "nsIDocumentEncoder.h"
#include "nsFocusManager.h"
#include "nsIScriptGlobalObject.h"
#include "nsNetUtil.h"
#include "nsIFrame.h"
#include "nsIAnonymousContentCreator.h"
#include "nsPresContext.h"
#include "nsStyleConsts.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "nsDOMCID.h"
#include "nsDOMCSSAttrDeclaration.h"
#include "nsNameSpaceManager.h"
#include "nsContentList.h"
#include "nsDOMTokenList.h"
#include "nsError.h"
#include "nsDOMString.h"
#include "nsXULElement.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/MouseEvents.h"
#include "nsAttrValueOrString.h"
#include "nsQueryObject.h"
#include "nsFrameSelection.h"
#ifdef DEBUG
# include "nsRange.h"
#endif
@ -73,7 +65,6 @@
#include "nsGkAtoms.h"
#include "nsContentUtils.h"
#include "nsTextFragment.h"
#include "nsContentCID.h"
#include "nsWindowSizes.h"
#include "nsIWidget.h"
@ -82,10 +73,8 @@
#include "nsGenericHTMLElement.h"
#include "nsContentCreatorFunctions.h"
#include "nsView.h"
#include "nsViewManager.h"
#include "nsIScrollableFrame.h"
#include "ChildIterator.h"
#include "nsTextNode.h"
#include "mozilla/dom/NodeListBinding.h"
#include "nsCCUncollectableMarker.h"
@ -97,16 +86,12 @@
#include "nsWrapperCacheInlines.h"
#include "nsCycleCollector.h"
#include "xpcpublic.h"
#include "mozilla/Telemetry.h"
#include "mozilla/CORSMode.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/SVGUseElement.h"
#include "nsStyledElement.h"
#include "nsIContentInlines.h"
#include "nsChildContentList.h"
#include "mozilla/BloomFilter.h"
@ -169,6 +154,11 @@ nsIContent* nsIContent::FindFirstNonChromeOnlyAccessContent() const {
return nullptr;
}
void nsIContent::UnbindFromTree() {
UnbindContext context(*this);
UnbindFromTree(context);
}
// https://dom.spec.whatwg.org/#dom-slotable-assignedslot
HTMLSlotElement* nsIContent::GetAssignedSlotByMode() const {
/**

Просмотреть файл

@ -4,7 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Preferences.h"
#include "mozilla/dom/BindContext.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/DocumentFragment.h"
@ -19,6 +18,7 @@
#include "mozilla/dom/HTMLSummaryElement.h"
#include "mozilla/dom/Text.h"
#include "mozilla/dom/TreeOrderedArrayInlines.h"
#include "mozilla/dom/UnbindContext.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/IdentifierMapEntry.h"
#include "mozilla/PresShell.h"
@ -26,7 +26,6 @@
#include "mozilla/ScopeExit.h"
#include "mozilla/ServoStyleRuleMap.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/StyleSheetList.h"
using namespace mozilla;
@ -184,9 +183,10 @@ void ShadowRoot::Unbind() {
OwnerDoc()->RemoveComposedDocShadowRoot(*this);
}
UnbindContext context(*this);
for (nsIContent* child = GetFirstChild(); child;
child = child->GetNextSibling()) {
child->UnbindFromTree(false);
child->UnbindFromTree(context);
}
}

31
dom/base/UnbindContext.h Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* State that is passed down to UnbindToTree. */
#ifndef mozilla_dom_UnbindContext_h__
#define mozilla_dom_UnbindContext_h__
#include "mozilla/Attributes.h"
#include "nsINode.h"
namespace mozilla::dom {
struct MOZ_STACK_CLASS UnbindContext final {
// The root of the subtree being unbound.
nsINode& Root() const { return mRoot; }
// Whether we're the root of the subtree being unbound.
bool IsUnbindRoot(const nsINode* aNode) const { return &mRoot == aNode; }
explicit UnbindContext(nsINode& aRoot) : mRoot(aRoot) {}
private:
nsINode& mRoot;
};
} // namespace mozilla::dom
#endif

Просмотреть файл

@ -281,6 +281,7 @@ EXPORTS.mozilla.dom += [
"TreeOrderedArrayInlines.h",
"TreeWalker.h",
"UIDirectionManager.h",
"UnbindContext.h",
"UseCounterMetrics.h",
"UserActivation.h",
"ViewportMetaData.h",

Просмотреть файл

@ -21,6 +21,7 @@ class HTMLEditor;
struct URLExtraData;
namespace dom {
struct BindContext;
struct UnbindContext;
class ShadowRoot;
class HTMLSlotElement;
} // namespace dom
@ -58,6 +59,7 @@ class nsIContent : public nsINode {
using IMEEnabled = mozilla::widget::IMEEnabled;
using IMEState = mozilla::widget::IMEState;
using BindContext = mozilla::dom::BindContext;
using UnbindContext = mozilla::dom::UnbindContext;
void ConstructUbiNode(void* storage) override;
@ -111,15 +113,10 @@ class nsIContent : public nsINode {
* from a parent, this will be called after it has been removed from the
* parent's child list and after the nsIDocumentObserver notifications for
* the removal have been dispatched.
* @param aDeep Whether to recursively unbind the entire subtree rooted at
* this node. The only time false should be passed is when the
* parent node of the content is being destroyed.
* @param aNullParent Whether to null out the parent pointer as well. This
* is usually desirable. This argument should only be false while
* recursively calling UnbindFromTree when a subtree is detached.
* @note This method is safe to call on nodes that are not bound to a tree.
*/
virtual void UnbindFromTree(bool aNullParent = true) = 0;
virtual void UnbindFromTree(UnbindContext&) = 0;
void UnbindFromTree();
enum {
/**

Просмотреть файл

@ -1639,10 +1639,12 @@ void nsImageLoadingContent::BindToTree(BindContext& aContext,
}
}
void nsImageLoadingContent::UnbindFromTree(bool aNullParent) {
void nsImageLoadingContent::UnbindFromTree() {
// We may be leaving the document, so if our image is tracked, untrack it.
nsCOMPtr<Document> doc = GetOurCurrentDoc();
if (!doc) return;
if (!doc) {
return;
}
UntrackImage(mCurrentRequest);
UntrackImage(mPendingRequest);

Просмотреть файл

@ -221,7 +221,7 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
// Subclasses are *required* to call BindToTree/UnbindFromTree.
void BindToTree(mozilla::dom::BindContext&, nsINode& aParent);
void UnbindFromTree(bool aNullParent);
void UnbindFromTree();
void OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
void OnUnlockedDraw();

Просмотреть файл

@ -223,7 +223,7 @@ already_AddRefed<nsIDocShell> nsObjectLoadingContent::SetupDocShell(
return docShell.forget();
}
void nsObjectLoadingContent::UnbindFromTree(bool aNullParent) {
void nsObjectLoadingContent::UnbindFromTree() {
// Reset state and clear pending events
/// XXX(johns): The implementation for GenericFrame notes that ideally we
/// would keep the docshell around, but trash the frameloader

Просмотреть файл

@ -183,7 +183,7 @@ class nsObjectLoadingContent : public nsIStreamListener,
void CreateStaticClone(nsObjectLoadingContent* aDest) const;
void UnbindFromTree(bool aNullParent = true);
void UnbindFromTree();
/**
* Return the content policy type used for loading the element.

Просмотреть файл

@ -44,7 +44,7 @@ class nsAttributeTextNode final : public nsTextNode,
}
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
@ -123,10 +123,9 @@ nsresult nsTextNode::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void nsTextNode::UnbindFromTree(bool aNullParent) {
void nsTextNode::UnbindFromTree(UnbindContext& aContext) {
ResetDirectionSetByTextNode(this);
CharacterData::UnbindFromTree(aNullParent);
CharacterData::UnbindFromTree(aContext);
}
#ifdef MOZ_DOM_LIST
@ -209,16 +208,16 @@ nsresult nsAttributeTextNode::BindToTree(BindContext& aContext,
return NS_OK;
}
void nsAttributeTextNode::UnbindFromTree(bool aNullParent) {
void nsAttributeTextNode::UnbindFromTree(UnbindContext& aContext) {
// UnbindFromTree can be called anytime so we have to be safe.
if (mGrandparent) {
// aNullParent might not be true here, but we want to remove the
// aContext might not be true here, but we want to remove the
// mutation observer anyway since we only need it while we're
// in the document.
mGrandparent->RemoveMutationObserver(this);
mGrandparent = nullptr;
}
nsTextNode::UnbindFromTree(aNullParent);
nsTextNode::UnbindFromTree(aContext);
}
void nsAttributeTextNode::AttributeChanged(Element* aElement,

Просмотреть файл

@ -45,7 +45,7 @@ class nsTextNode : public mozilla::dom::Text {
mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
nsresult AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
bool aNotify, nsIContent* aNextSibling);

Просмотреть файл

@ -75,14 +75,14 @@ nsresult HTMLAnchorElement::BindToTree(BindContext& aContext,
return rv;
}
void HTMLAnchorElement::UnbindFromTree(bool aNullParent) {
void HTMLAnchorElement::UnbindFromTree(UnbindContext& aContext) {
// Cancel any DNS prefetches
// Note: Must come before ResetLinkState. If called after, it will recreate
// mCachedURI based on data that is invalid - due to a call to Link::GetURI()
// via GetURIForDNSPrefetch().
CancelDNSPrefetch(*this);
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
// Without removing the link state we risk a dangling pointer in the
// mStyledLinks hashtable

Просмотреть файл

@ -47,7 +47,7 @@ class HTMLAnchorElement final : public nsGenericHTMLElement,
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
int32_t* aTabIndex) override;

Просмотреть файл

@ -72,8 +72,8 @@ nsresult HTMLAreaElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void HTMLAreaElement::UnbindFromTree(bool aNullParent) {
nsGenericHTMLElement::UnbindFromTree(aNullParent);
void HTMLAreaElement::UnbindFromTree(UnbindContext& aContext) {
nsGenericHTMLElement::UnbindFromTree(aContext);
// Without removing the link state we risk a dangling pointer in the
// mStyledLinks hashtable
Link::UnbindFromTree();

Просмотреть файл

@ -43,7 +43,7 @@ class HTMLAreaElement final : public nsGenericHTMLElement, public Link {
already_AddRefed<nsIURI> GetHrefURI() const override;
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;

Просмотреть файл

@ -308,8 +308,8 @@ nsresult HTMLButtonElement::BindToTree(BindContext& aContext,
return NS_OK;
}
void HTMLButtonElement::UnbindFromTree(bool aNullParent) {
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
void HTMLButtonElement::UnbindFromTree(UnbindContext& aContext) {
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aContext);
UpdateBarredFromConstraintValidation();
UpdateValidityElementStates(false);

Просмотреть файл

@ -65,7 +65,7 @@ class HTMLButtonElement final : public nsGenericHTMLFormControlElementWithState,
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
void DoneCreatingElement() override;
void UpdateBarredFromConstraintValidation();

Просмотреть файл

@ -106,9 +106,9 @@ void HTMLDialogElement::StorePreviouslyFocusedElement() {
}
}
void HTMLDialogElement::UnbindFromTree(bool aNullParent) {
void HTMLDialogElement::UnbindFromTree(UnbindContext& aContext) {
RemoveFromTopLayerIfNeeded();
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLDialogElement::ShowModal(ErrorResult& aError) {

Просмотреть файл

@ -35,7 +35,7 @@ class HTMLDialogElement final : public nsGenericHTMLElement {
mReturnValue = aReturnValue;
}
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
void Close(const mozilla::dom::Optional<nsAString>& aReturnValue);
MOZ_CAN_RUN_SCRIPT void Show(ErrorResult& aError);

Просмотреть файл

@ -77,8 +77,8 @@ nsresult HTMLElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void HTMLElement::UnbindFromTree(bool aNullParent) {
nsGenericHTMLFormElement::UnbindFromTree(aNullParent);
void HTMLElement::UnbindFromTree(UnbindContext& aContext) {
nsGenericHTMLFormElement::UnbindFromTree(aContext);
UpdateBarredFromConstraintValidation();
UpdateValidityElementStates(false);

Просмотреть файл

@ -30,7 +30,7 @@ class HTMLElement final : public nsGenericHTMLFormElement {
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
void DoneCreatingElement() override;
// Element

Просмотреть файл

@ -65,9 +65,9 @@ nsresult HTMLEmbedElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void HTMLEmbedElement::UnbindFromTree(bool aNullParent) {
nsObjectLoadingContent::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aNullParent);
void HTMLEmbedElement::UnbindFromTree(UnbindContext& aContext) {
nsObjectLoadingContent::UnbindFromTree();
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLEmbedElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,

Просмотреть файл

@ -36,7 +36,7 @@ class HTMLEmbedElement final : public nsGenericHTMLElement,
const Element* AsElement() const final { return this; }
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
int32_t* aTabIndex) override;

Просмотреть файл

@ -494,7 +494,7 @@ static void CollectOrphans(nsINode* aRemovalRoot,
}
}
void HTMLFormElement::UnbindFromTree(bool aNullParent) {
void HTMLFormElement::UnbindFromTree(UnbindContext& aContext) {
MaybeFireFormRemoved();
// Note, this is explicitly using uncomposed doc, since we count
@ -506,7 +506,7 @@ void HTMLFormElement::UnbindFromTree(bool aNullParent) {
MarkOrphans(mControls->mNotInElements.AsList());
MarkOrphans(mImageElements.AsList());
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
nsINode* ancestor = this;
nsINode* cur;

Просмотреть файл

@ -70,7 +70,7 @@ class HTMLFormElement final : public nsGenericHTMLElement {
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
const nsAttrValue* aValue, bool aNotify) override;

Просмотреть файл

@ -10,19 +10,17 @@
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/HTMLImageElementBinding.h"
#include "mozilla/dom/NameSpaceConstants.h"
#include "mozilla/dom/UnbindContext.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsSize.h"
#include "mozilla/dom/Document.h"
#include "nsImageFrame.h"
#include "nsIScriptContext.h"
#include "nsContentUtils.h"
#include "nsContainerFrame.h"
#include "nsNodeInfoManager.h"
#include "mozilla/MouseEvents.h"
#include "nsContentPolicyUtils.h"
#include "nsFocusManager.h"
#include "mozilla/dom/DOMIntersectionObserver.h"
#include "mozilla/dom/HTMLFormElement.h"
@ -30,7 +28,6 @@
#include "mozilla/dom/UserActivation.h"
#include "nsAttrValueOrString.h"
#include "imgLoader.h"
#include "Image.h"
// Responsive images!
#include "mozilla/dom/HTMLSourceElement.h"
@ -564,9 +561,9 @@ nsresult HTMLImageElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void HTMLImageElement::UnbindFromTree(bool aNullParent) {
void HTMLImageElement::UnbindFromTree(UnbindContext& aContext) {
if (mForm) {
if (aNullParent || !FindAncestorForm(mForm)) {
if (aContext.IsUnbindRoot(this) || !FindAncestorForm(mForm)) {
ClearForm(true);
} else {
UnsetFlags(MAYBE_ORPHAN_FORM_ELEMENT);
@ -578,8 +575,8 @@ void HTMLImageElement::UnbindFromTree(bool aNullParent) {
mInDocResponsiveContent = false;
}
nsImageLoadingContent::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsImageLoadingContent::UnbindFromTree();
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLImageElement::UpdateFormOwner() {

Просмотреть файл

@ -74,7 +74,7 @@ class HTMLImageElement final : public nsGenericHTMLElement,
int32_t* aTabIndex) override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;

Просмотреть файл

@ -4447,7 +4447,7 @@ void HTMLInputElement::MaybeDispatchLoginManagerEvents(HTMLFormElement* aForm) {
dispatcher->PostDOMEvent();
}
void HTMLInputElement::UnbindFromTree(bool aNullParent) {
void HTMLInputElement::UnbindFromTree(UnbindContext& aContext) {
if (mType == FormControlType::InputPassword) {
MaybeFireInputPasswordRemoved();
}
@ -4465,8 +4465,8 @@ void HTMLInputElement::UnbindFromTree(bool aNullParent) {
NotifyUAWidgetTeardown();
}
nsImageLoadingContent::UnbindFromTree(aNullParent);
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
nsImageLoadingContent::UnbindFromTree();
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aContext);
// If we are contained within a disconnected subtree, attempt to add
// ourselves to the subtree root's radio group.

Просмотреть файл

@ -213,7 +213,7 @@ class HTMLInputElement final : public TextControlElement,
SnapToTickMarks = SnapToTickMarks::No);
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
void DoneCreatingElement() override;

Просмотреть файл

@ -62,8 +62,8 @@ nsresult HTMLLegendElement::BindToTree(BindContext& aContext,
return nsGenericHTMLElement::BindToTree(aContext, aParent);
}
void HTMLLegendElement::UnbindFromTree(bool aNullParent) {
nsGenericHTMLElement::UnbindFromTree(aNullParent);
void HTMLLegendElement::UnbindFromTree(UnbindContext& aContext) {
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLLegendElement::Focus(const FocusOptions& aOptions,

Просмотреть файл

@ -31,7 +31,7 @@ class HTMLLegendElement final : public nsGenericHTMLElement {
// nsIContent
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,

Просмотреть файл

@ -110,7 +110,7 @@ void HTMLLinkElement::LinkAdded() {
CreateAndDispatchEvent(u"DOMLinkAdded"_ns);
}
void HTMLLinkElement::UnbindFromTree(bool aNullParent) {
void HTMLLinkElement::UnbindFromTree(UnbindContext& aContext) {
CancelDNSPrefetch(*this);
CancelPrefetchOrPreload();
@ -130,7 +130,7 @@ void HTMLLinkElement::UnbindFromTree(bool aNullParent) {
}
}
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
Unused << UpdateStyleSheetInternal(oldDoc, oldShadowRoot);
}

Просмотреть файл

@ -48,7 +48,7 @@ class HTMLLinkElement final : public nsGenericHTMLElement,
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue, bool aNotify) override;
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,

Просмотреть файл

@ -56,14 +56,14 @@ nsresult HTMLMarqueeElement::BindToTree(BindContext& aContext,
return rv;
}
void HTMLMarqueeElement::UnbindFromTree(bool aNullParent) {
void HTMLMarqueeElement::UnbindFromTree(UnbindContext& aContext) {
if (IsInComposedDoc()) {
// We don't want to unattach the shadow root because it used to
// contain a <slot>.
NotifyUAWidgetTeardown(UnattachShadowRoot::No);
}
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLMarqueeElement::GetBehavior(nsAString& aValue) {

Просмотреть файл

@ -19,7 +19,7 @@ class HTMLMarqueeElement final : public nsGenericHTMLElement {
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLMarqueeElement, marquee);
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
static const int kDefaultLoop = -1;
static const int kDefaultScrollAmount = 6;

Просмотреть файл

@ -4891,14 +4891,14 @@ nsresult HTMLMediaElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void HTMLMediaElement::UnbindFromTree(bool aNullParent) {
void HTMLMediaElement::UnbindFromTree(UnbindContext& aContext) {
mVisibilityState = Visibility::Untracked;
if (IsInComposedDoc()) {
NotifyUAWidgetTeardown();
}
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
MOZ_ASSERT(IsActuallyInvisible());
NotifyDecoderActivityChanges();

Просмотреть файл

@ -202,7 +202,7 @@ class HTMLMediaElement : public nsGenericHTMLElement,
nsAttrValue& aResult) override;
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
virtual void DoneCreatingElement() override;
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,

Просмотреть файл

@ -119,14 +119,14 @@ nsresult HTMLMetaElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void HTMLMetaElement::UnbindFromTree(bool aNullParent) {
void HTMLMetaElement::UnbindFromTree(UnbindContext& aContext) {
if (Document* oldDoc = GetUncomposedDoc()) {
if (const nsAttrValue* name = GetParsedAttr(nsGkAtoms::name)) {
MetaRemoved(*oldDoc, *name, ChangeKind::TreeChange);
}
CreateAndDispatchEvent(*oldDoc, u"DOMMetaRemoved"_ns);
}
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLMetaElement::CreateAndDispatchEvent(Document&,

Просмотреть файл

@ -21,7 +21,7 @@ class HTMLMetaElement final : public nsGenericHTMLElement {
NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMetaElement, nsGenericHTMLElement)
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue, const nsAttrValue* aOldValue,

Просмотреть файл

@ -89,9 +89,9 @@ nsresult HTMLObjectElement::BindToTree(BindContext& aContext,
return NS_OK;
}
void HTMLObjectElement::UnbindFromTree(bool aNullParent) {
nsObjectLoadingContent::UnbindFromTree(aNullParent);
nsGenericHTMLFormControlElement::UnbindFromTree(aNullParent);
void HTMLObjectElement::UnbindFromTree(UnbindContext& aContext) {
nsObjectLoadingContent::UnbindFromTree();
nsGenericHTMLFormControlElement::UnbindFromTree(aContext);
}
void HTMLObjectElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,

Просмотреть файл

@ -40,7 +40,7 @@ class HTMLObjectElement final : public nsGenericHTMLFormControlElement,
bool IsInteractiveHTMLContent() const override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
int32_t* aTabIndex) override;

Просмотреть файл

@ -247,8 +247,8 @@ nsresult HTMLOptionElement::BindToTree(BindContext& aContext,
return NS_OK;
}
void HTMLOptionElement::UnbindFromTree(bool aNullParent) {
nsGenericHTMLElement::UnbindFromTree(aNullParent);
void HTMLOptionElement::UnbindFromTree(UnbindContext& aContext) {
nsGenericHTMLElement::UnbindFromTree(aContext);
// Our previous parent could have been involved in :disabled/:enabled state.
UpdateDisabledState(false);

Просмотреть файл

@ -62,7 +62,7 @@ class HTMLOptionElement final : public nsGenericHTMLElement {
void UpdateDisabledState(bool aNotify);
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;

Просмотреть файл

@ -1089,8 +1089,8 @@ nsresult HTMLSelectElement::BindToTree(BindContext& aContext,
return rv;
}
void HTMLSelectElement::UnbindFromTree(bool aNullParent) {
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
void HTMLSelectElement::UnbindFromTree(UnbindContext& aContext) {
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aContext);
// We might be no longer disabled because our parent chain changed.
// XXXbz is this still needed now that fieldset changes always call

Просмотреть файл

@ -270,7 +270,7 @@ class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
* Called when an attribute is about to be changed
*/
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue, bool aNotify) override;
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,

Просмотреть файл

@ -181,10 +181,10 @@ nsresult HTMLSharedElement::BindToTree(BindContext& aContext,
return NS_OK;
}
void HTMLSharedElement::UnbindFromTree(bool aNullParent) {
void HTMLSharedElement::UnbindFromTree(UnbindContext& aContext) {
Document* doc = GetUncomposedDoc();
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
// If we're removing a <base> from a document, we may need to update the
// document's base URI and base target

Просмотреть файл

@ -32,7 +32,7 @@ class HTMLSharedElement final : public nsGenericHTMLElement {
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;

Просмотреть файл

@ -64,10 +64,10 @@ nsresult HTMLSlotElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void HTMLSlotElement::UnbindFromTree(bool aNullParent) {
void HTMLSlotElement::UnbindFromTree(UnbindContext& aContext) {
RefPtr<ShadowRoot> oldContainingShadow = GetContainingShadow();
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
if (oldContainingShadow && !GetContainingShadow()) {
oldContainingShadow->RemoveSlot(this);

Просмотреть файл

@ -26,7 +26,7 @@ class HTMLSlotElement final : public nsGenericHTMLElement {
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue, bool aNotify) override;

Просмотреть файл

@ -166,9 +166,9 @@ nsresult HTMLSourceElement::BindToTree(BindContext& aContext,
return NS_OK;
}
void HTMLSourceElement::UnbindFromTree(bool aNullParent) {
void HTMLSourceElement::UnbindFromTree(UnbindContext& aContext) {
mMappedAttributesForImage = nullptr;
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
JSObject* HTMLSourceElement::WrapNode(JSContext* aCx,

Просмотреть файл

@ -35,7 +35,7 @@ class HTMLSourceElement final : public nsGenericHTMLElement {
// child source element.
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
// If this element's media attr matches for its owner document. Returns true
// if no media attr was set.

Просмотреть файл

@ -91,11 +91,11 @@ nsresult HTMLStyleElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void HTMLStyleElement::UnbindFromTree(bool aNullParent) {
void HTMLStyleElement::UnbindFromTree(UnbindContext& aContext) {
RefPtr<Document> oldDoc = GetUncomposedDoc();
ShadowRoot* oldShadow = GetContainingShadow();
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
Unused << UpdateStyleSheetInternal(oldDoc, oldShadow);
}

Просмотреть файл

@ -47,7 +47,7 @@ class HTMLStyleElement final : public nsGenericHTMLElement,
void SetDevtoolsAsTriggeringPrincipal();
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,

Просмотреть файл

@ -961,9 +961,9 @@ nsresult HTMLTableElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void HTMLTableElement::UnbindFromTree(bool aNullParent) {
void HTMLTableElement::UnbindFromTree(UnbindContext& aContext) {
ReleaseInheritedAttributes();
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLTableElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,

Просмотреть файл

@ -156,7 +156,7 @@ class HTMLTableElement final : public nsGenericHTMLElement {
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
/**
* Called when an attribute is about to be changed
*/

Просмотреть файл

@ -770,8 +770,8 @@ nsresult HTMLTextAreaElement::BindToTree(BindContext& aContext,
return rv;
}
void HTMLTextAreaElement::UnbindFromTree(bool aNullParent) {
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
void HTMLTextAreaElement::UnbindFromTree(UnbindContext& aContext) {
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aContext);
// We might be no longer disabled because of parent chain changed.
UpdateValueMissingValidityState();

Просмотреть файл

@ -108,7 +108,7 @@ class HTMLTextAreaElement final : public TextControlElement,
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,

Просмотреть файл

@ -72,11 +72,11 @@ nsresult HTMLTitleElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void HTMLTitleElement::UnbindFromTree(bool aNullParent) {
void HTMLTitleElement::UnbindFromTree(UnbindContext& aContext) {
SendTitleChangeEvent(false);
// Let this fall through.
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
void HTMLTitleElement::DoneAddingChildren(bool aHaveNotified) {

Просмотреть файл

@ -41,7 +41,7 @@ class HTMLTitleElement final : public nsGenericHTMLElement,
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
virtual void DoneAddingChildren(bool aHaveNotified) override;

Просмотреть файл

@ -11,10 +11,9 @@
#include "mozilla/LoadInfo.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/dom/HTMLTrackElementBinding.h"
#include "mozilla/dom/HTMLUnknownElement.h"
#include "mozilla/dom/UnbindContext.h"
#include "nsAttrValueInlines.h"
#include "nsCOMPtr.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
#include "nsCycleCollectionParticipant.h"
#include "nsGenericHTMLElement.h"
@ -30,7 +29,6 @@
#include "nsNetUtil.h"
#include "nsStyleConsts.h"
#include "nsThreadUtils.h"
#include "nsVideoFrame.h"
extern mozilla::LazyLogModule gTextTrackLog;
#define LOG(msg, ...) \
@ -408,8 +406,8 @@ nsresult HTMLTrackElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void HTMLTrackElement::UnbindFromTree(bool aNullParent) {
if (mMediaParent && aNullParent) {
void HTMLTrackElement::UnbindFromTree(UnbindContext& aContext) {
if (mMediaParent && aContext.IsUnbindRoot(this)) {
// mTrack can be null if HTMLTrackElement::LoadResource has never been
// called.
if (mTrack) {
@ -419,7 +417,7 @@ void HTMLTrackElement::UnbindFromTree(bool aNullParent) {
mMediaParent = nullptr;
}
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
TextTrackReadyState HTMLTrackElement::ReadyState() const {

Просмотреть файл

@ -86,7 +86,7 @@ class HTMLTrackElement final : public nsGenericHTMLElement {
// Override BindToTree() so that we can trigger a load when we become
// the child of a media element.
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent) override;
virtual void UnbindFromTree(UnbindContext&) override;
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue,

Просмотреть файл

@ -188,7 +188,7 @@ nsMapRuleToAttributesFunc HTMLVideoElement::GetAttributeMappingFunction()
return &MapAttributesIntoRule;
}
void HTMLVideoElement::UnbindFromTree(bool aNullParent) {
void HTMLVideoElement::UnbindFromTree(UnbindContext& aContext) {
if (mVisualCloneSource) {
mVisualCloneSource->EndCloningVisually();
} else if (mVisualCloneTarget) {
@ -198,7 +198,7 @@ void HTMLVideoElement::UnbindFromTree(bool aNullParent) {
EndCloningVisually();
}
HTMLMediaElement::UnbindFromTree(aNullParent);
HTMLMediaElement::UnbindFromTree(aContext);
}
nsresult HTMLVideoElement::SetAcceptHeader(nsIHttpChannel* aChannel) {

Просмотреть файл

@ -53,7 +53,7 @@ class HTMLVideoElement final : public HTMLMediaElement {
nsresult Clone(NodeInfo*, nsINode** aResult) const override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
mozilla::Maybe<mozilla::CSSIntSize> GetVideoSize() const;

Просмотреть файл

@ -18,7 +18,6 @@
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TextEvents.h"
#include "mozilla/StaticPrefs_html5.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "mozilla/dom/FetchPriority.h"
#include "mozilla/dom/FormData.h"
@ -29,6 +28,7 @@
#include "nsQueryObject.h"
#include "mozilla/dom/BindContext.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/UnbindContext.h"
#include "nsPIDOMWindow.h"
#include "nsIFrameInlines.h"
#include "nsIScrollableFrame.h"
@ -524,7 +524,7 @@ nsresult nsGenericHTMLElement::BindToTree(BindContext& aContext,
return rv;
}
void nsGenericHTMLElement::UnbindFromTree(bool aNullParent) {
void nsGenericHTMLElement::UnbindFromTree(UnbindContext& aContext) {
if (IsInComposedDoc()) {
// https://html.spec.whatwg.org/#dom-trees:hide-popover-algorithm
// If removedNode's popover attribute is not in the no popover state, then
@ -544,7 +544,7 @@ void nsGenericHTMLElement::UnbindFromTree(bool aNullParent) {
}
}
nsStyledElement::UnbindFromTree(aNullParent);
nsStyledElement::UnbindFromTree(aContext);
// Invalidate .labels list. It will be repopulated when used the next time.
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
@ -1811,14 +1811,14 @@ nsresult nsGenericHTMLFormElement::BindToTree(BindContext& aContext,
return NS_OK;
}
void nsGenericHTMLFormElement::UnbindFromTree(bool aNullParent) {
void nsGenericHTMLFormElement::UnbindFromTree(UnbindContext& aContext) {
// Save state before doing anything else.
SaveState();
if (IsFormAssociatedElement()) {
if (HTMLFormElement* form = GetFormInternal()) {
// Might need to unset form
if (aNullParent) {
if (aContext.IsUnbindRoot(this)) {
// No more parent means no more form
ClearForm(true, true);
} else {
@ -1839,7 +1839,7 @@ void nsGenericHTMLFormElement::UnbindFromTree(bool aNullParent) {
}
}
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
// The element might not have a fieldset anymore.
UpdateFieldSet(false);

Просмотреть файл

@ -332,7 +332,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase {
public:
// Implementation for nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
Focusable IsFocusableWithoutStyle(bool aWithMouse) override {
Focusable result;
@ -1004,7 +1004,7 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement {
// nsIContent
void SaveSubtreeState() override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
/**
* This callback is called by a fieldest on all its elements whenever its

Просмотреть файл

@ -202,7 +202,7 @@ nsresult nsGenericHTMLFrameElement::BindToTree(BindContext& aContext,
return rv;
}
void nsGenericHTMLFrameElement::UnbindFromTree(bool aNullParent) {
void nsGenericHTMLFrameElement::UnbindFromTree(UnbindContext& aContext) {
if (mFrameLoader) {
// This iframe is being taken out of the document, destroy the
// iframe's frame loader (doing that will tear down the window in
@ -214,7 +214,7 @@ void nsGenericHTMLFrameElement::UnbindFromTree(bool aNullParent) {
mFrameLoader = nullptr;
}
nsGenericHTMLElement::UnbindFromTree(aNullParent);
nsGenericHTMLElement::UnbindFromTree(aContext);
}
/* static */

Просмотреть файл

@ -62,7 +62,7 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
int32_t* aTabIndex) override;
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
virtual void DestroyContent() override;
nsresult CopyInnerTo(mozilla::dom::Element* aDest);

Просмотреть файл

@ -77,8 +77,8 @@ nsresult MathMLElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void MathMLElement::UnbindFromTree(bool aNullParent) {
MathMLElementBase::UnbindFromTree(aNullParent);
void MathMLElement::UnbindFromTree(UnbindContext& aContext) {
MathMLElementBase::UnbindFromTree(aContext);
// Without removing the link state we risk a dangling pointer in the
// mStyledLinks hashtable
Link::UnbindFromTree();

Просмотреть файл

@ -34,7 +34,7 @@ class MathMLElement final : public MathMLElementBase, public Link {
NS_IMPL_FROMNODE(MathMLElement, kNameSpaceID_MathML)
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue,

Просмотреть файл

@ -149,8 +149,8 @@ nsresult SVGAElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void SVGAElement::UnbindFromTree(bool aNullParent) {
SVGAElementBase::UnbindFromTree(aNullParent);
void SVGAElement::UnbindFromTree(UnbindContext& aContext) {
SVGAElementBase::UnbindFromTree(aContext);
// Without removing the link state we risk a dangling pointer
// in the mStyledLinks hashtable
Link::UnbindFromTree();

Просмотреть файл

@ -48,7 +48,7 @@ class SVGAElement final : public SVGAElementBase,
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
int32_t TabIndexDefault() override;
Focusable IsFocusableWithoutStyle(bool aWithMouse) override;

Просмотреть файл

@ -157,7 +157,7 @@ nsresult SVGAnimationElement::BindToTree(BindContext& aContext,
return NS_OK;
}
void SVGAnimationElement::UnbindFromTree(bool aNullParent) {
void SVGAnimationElement::UnbindFromTree(UnbindContext& aContext) {
SMILAnimationController* controller = OwnerDoc()->GetAnimationController();
if (controller) {
controller->UnregisterAnimationElement(this);
@ -168,7 +168,7 @@ void SVGAnimationElement::UnbindFromTree(bool aNullParent) {
AnimationNeedsResample();
SVGAnimationElementBase::UnbindFromTree(aNullParent);
SVGAnimationElementBase::UnbindFromTree(aContext);
}
bool SVGAnimationElement::ParseAttribute(int32_t aNamespaceID,

Просмотреть файл

@ -41,7 +41,7 @@ class SVGAnimationElement : public SVGAnimationElementBase, public SVGTests {
// nsIContent specializations
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
// Element specializations
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,

Просмотреть файл

@ -170,9 +170,9 @@ nsresult SVGFEImageElement::BindToTree(BindContext& aContext,
return rv;
}
void SVGFEImageElement::UnbindFromTree(bool aNullParent) {
nsImageLoadingContent::UnbindFromTree(aNullParent);
SVGFEImageElementBase::UnbindFromTree(aNullParent);
void SVGFEImageElement::UnbindFromTree(UnbindContext& aContext) {
nsImageLoadingContent::UnbindFromTree();
SVGFEImageElementBase::UnbindFromTree(aContext);
}
void SVGFEImageElement::DestroyContent() {

Просмотреть файл

@ -70,7 +70,7 @@ class SVGFEImageElement final : public SVGFEImageElementBase,
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
void DestroyContent() override;
NS_DECL_IMGINOTIFICATIONOBSERVER

Просмотреть файл

@ -260,9 +260,9 @@ nsresult SVGImageElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void SVGImageElement::UnbindFromTree(bool aNullParent) {
nsImageLoadingContent::UnbindFromTree(aNullParent);
SVGImageElementBase::UnbindFromTree(aNullParent);
void SVGImageElement::UnbindFromTree(UnbindContext& aContext) {
nsImageLoadingContent::UnbindFromTree();
SVGImageElementBase::UnbindFromTree(aContext);
}
void SVGImageElement::DestroyContent() {

Просмотреть файл

@ -60,7 +60,7 @@ class SVGImageElement final : public SVGImageElementBase,
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
void DestroyContent() override;

Просмотреть файл

@ -68,10 +68,10 @@ already_AddRefed<DOMSVGAnimatedString> SVGMPathElement::Href() {
//----------------------------------------------------------------------
// nsIContent methods
void SVGMPathElement::UnbindFromTree(bool aNullParent) {
void SVGMPathElement::UnbindFromTree(UnbindContext& aContext) {
mMPathObserver = nullptr;
NotifyParentOfMpathChange();
SVGMPathElementBase::UnbindFromTree(aNullParent);
SVGMPathElementBase::UnbindFromTree(aContext);
}
void SVGMPathElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,

Просмотреть файл

@ -38,7 +38,7 @@ class SVGMPathElement final : public SVGMPathElementBase {
// nsIContent interface
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,

Просмотреть файл

@ -337,12 +337,12 @@ nsresult SVGSVGElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void SVGSVGElement::UnbindFromTree(bool aNullParent) {
void SVGSVGElement::UnbindFromTree(UnbindContext& aContext) {
if (mTimedDocumentRoot) {
mTimedDocumentRoot->SetParent(nullptr);
}
SVGGraphicsElement::UnbindFromTree(aNullParent);
SVGGraphicsElement::UnbindFromTree(aContext);
}
SVGAnimatedTransformList* SVGSVGElement::GetAnimatedTransformList(

Просмотреть файл

@ -128,7 +128,7 @@ class SVGSVGElement final : public SVGSVGElementBase {
// SVGElement overrides
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
SVGAnimatedTransformList* GetAnimatedTransformList(
uint32_t aFlags = 0) override;

Просмотреть файл

@ -69,10 +69,10 @@ nsresult SVGStyleElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
void SVGStyleElement::UnbindFromTree(bool aNullParent) {
void SVGStyleElement::UnbindFromTree(UnbindContext& aContext) {
nsCOMPtr<Document> oldDoc = GetUncomposedDoc();
ShadowRoot* oldShadow = GetContainingShadow();
SVGStyleElementBase::UnbindFromTree(aNullParent);
SVGStyleElementBase::UnbindFromTree(aContext);
Unused << UpdateStyleSheetInternal(oldDoc, oldShadow);
}

Просмотреть файл

@ -40,7 +40,7 @@ class SVGStyleElement final : public SVGStyleElementBase,
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,

Просмотреть файл

@ -63,11 +63,11 @@ nsresult SVGTitleElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void SVGTitleElement::UnbindFromTree(bool aNullParent) {
void SVGTitleElement::UnbindFromTree(UnbindContext& aContext) {
SendTitleChangeEvent(false);
// Let this fall through.
SVGTitleElementBase::UnbindFromTree(aNullParent);
SVGTitleElementBase::UnbindFromTree(aContext);
}
void SVGTitleElement::DoneAddingChildren(bool aHaveNotified) {

Просмотреть файл

@ -45,7 +45,7 @@ class SVGTitleElement final : public SVGTitleElementBase,
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
void DoneAddingChildren(bool aHaveNotified) override;

Просмотреть файл

@ -167,8 +167,8 @@ nsresult SVGUseElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void SVGUseElement::UnbindFromTree(bool aNullParent) {
SVGUseElementBase::UnbindFromTree(aNullParent);
void SVGUseElement::UnbindFromTree(UnbindContext& aContext) {
SVGUseElementBase::UnbindFromTree(aContext);
OwnerDoc()->UnscheduleSVGUseElementShadowTreeUpdate(*this);
}

Просмотреть файл

@ -50,7 +50,7 @@ class SVGUseElement final : public SVGUseElementBase,
NS_IMPL_FROMNODE_WITH_TAG(SVGUseElement, kNameSpaceID_SVG, use)
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent = true) override;
void UnbindFromTree(UnbindContext&) override;
// interfaces:
NS_DECL_ISUPPORTS_INHERITED

Просмотреть файл

@ -49,10 +49,11 @@ nsresult XMLStylesheetProcessingInstruction::BindToTree(BindContext& aContext,
return rv;
}
void XMLStylesheetProcessingInstruction::UnbindFromTree(bool aNullParent) {
void XMLStylesheetProcessingInstruction::UnbindFromTree(
UnbindContext& aContext) {
nsCOMPtr<Document> oldDoc = GetUncomposedDoc();
ProcessingInstruction::UnbindFromTree(aNullParent);
ProcessingInstruction::UnbindFromTree(aContext);
Unused << UpdateStyleSheetInternal(oldDoc, nullptr);
}

Просмотреть файл

@ -43,7 +43,7 @@ class XMLStylesheetProcessingInstruction final : public ProcessingInstruction,
// nsIContent
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
/**
* Tells this processing instruction to use a different base URI. This is used

Просмотреть файл

@ -28,7 +28,7 @@ JSObject* nsXMLElement::WrapNode(JSContext* aCx,
return Element_Binding::Wrap(aCx, this, aGivenProto);
}
void nsXMLElement::UnbindFromTree(bool aNullParent) {
void nsXMLElement::UnbindFromTree(UnbindContext& aContext) {
nsAtom* property;
switch (GetPseudoElementType()) {
case PseudoStyleType::marker:
@ -48,7 +48,7 @@ void nsXMLElement::UnbindFromTree(bool aNullParent) {
MOZ_ASSERT(GetParent()->IsElement());
GetParent()->RemoveProperty(property);
}
Element::UnbindFromTree(aNullParent);
Element::UnbindFromTree(aContext);
}
NS_IMPL_ELEMENT_CLONE(nsXMLElement)

Просмотреть файл

@ -23,7 +23,7 @@ class nsXMLElement : public mozilla::dom::Element {
virtual nsresult Clone(mozilla::dom::NodeInfo*,
nsINode** aResult) const override;
virtual void UnbindFromTree(bool aNullParent = true) override;
virtual void UnbindFromTree(UnbindContext&) override;
protected:
virtual ~nsXMLElement() = default;

Просмотреть файл

@ -317,9 +317,9 @@ void XULButtonElement::StartBlinking() {
"XULButtonElement::StartBlinking", GetMainThreadSerialEventTarget());
}
void XULButtonElement::UnbindFromTree(bool aNullParent) {
void XULButtonElement::UnbindFromTree(UnbindContext& aContext) {
StopBlinking();
nsXULElement::UnbindFromTree(aNullParent);
nsXULElement::UnbindFromTree(aContext);
}
void XULButtonElement::ExecuteMenu(WidgetEvent& aEvent) {

Просмотреть файл

@ -55,7 +55,7 @@ class XULButtonElement : public nsXULElement {
XULMenuParentElement* GetMenuParent() const;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
MOZ_CAN_RUN_SCRIPT bool HandleKeyPress(KeyboardEvent& keyEvent);
bool OpenedWithKey() const;

Просмотреть файл

@ -159,13 +159,13 @@ nsresult XULFrameElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
void XULFrameElement::UnbindFromTree(bool aNullParent) {
void XULFrameElement::UnbindFromTree(UnbindContext& aContext) {
if (RefPtr<nsFrameLoader> frameLoader = GetFrameLoader()) {
frameLoader->Destroy();
}
mFrameLoader = nullptr;
nsXULElement::UnbindFromTree(aNullParent);
nsXULElement::UnbindFromTree(aContext);
}
void XULFrameElement::DestroyContent() {

Просмотреть файл

@ -54,7 +54,7 @@ class XULFrameElement final : public nsXULElement, public nsFrameLoaderOwner {
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
void UnbindFromTree(bool aNullParent) override;
void UnbindFromTree(UnbindContext&) override;
void DestroyContent() override;
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше