Bug 1593119 - unifdef MOZ_XBL r=bzbarsky

This was generated with:

```
rg -l -g '*.{cpp,h}' MOZ_XBL . | while read FILE ; do
   echo $FILE
   unifdef -m -UMOZ_XBL $FILE
done
```

After this, I manually removed the directive in nsContentUtils.cpp due to:

  unifdef: ./dom/base/nsContentUtils.cpp: 4630: Unterminated string literal
  unifdef: Output may be truncated

Differential Revision: https://phabricator.services.mozilla.com/D51337

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Grinstead 2019-11-07 00:35:13 +00:00
Родитель 8786a2504a
Коммит f19f38776b
40 изменённых файлов: 0 добавлений и 938 удалений

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

@ -9,9 +9,6 @@
#ifndef mozilla_dom_BindContext_h__
#define mozilla_dom_BindContext_h__
#ifdef MOZ_XBL
# include "nsXBLBinding.h"
#endif
#include "mozilla/Attributes.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/dom/Document.h"
@ -99,18 +96,6 @@ struct MOZ_STACK_CLASS BindContext final {
MOZ_ASSERT(mInComposedDoc, "Binding NAC in a disconnected subtree?");
}
#ifdef MOZ_XBL
// This is meant to be used to bind XBL anonymous content.
BindContext(nsXBLBinding& aBinding, Element& aParentElement)
: mDoc(*aParentElement.OwnerDoc()),
mBindingParent(aBinding.GetBoundElement()),
mInComposedDoc(aParentElement.IsInComposedDoc()),
mInUncomposedDoc(aParentElement.IsInUncomposedDoc()),
mSubtreeRootChanges(true),
mCollectingDisplayedNodeDataDuringLoad(
ShouldCollectDisplayedNodeDataDuringLoad(mInComposedDoc, mDoc,
aParentElement)) {}
#endif
bool CollectingDisplayedNodeDataDuringLoad() const {
return mCollectingDisplayedNodeDataDuringLoad;

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

@ -29,9 +29,6 @@
#include "nsChangeHint.h"
#include "nsCOMArray.h"
#include "mozilla/dom/DirectionalityUtils.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsCCUncollectableMarker.h"
#include "mozAutoDocUpdate.h"
#include "nsTextNode.h"
@ -515,9 +512,6 @@ void CharacterData::UnbindFromTree(bool aNullParent) {
HandleShadowDOMRelatedRemovalSteps(aNullParent);
#ifdef MOZ_XBL
Document* document = GetComposedDoc();
#endif
if (aNullParent) {
if (IsRootOfNativeAnonymousSubtree()) {
@ -540,18 +534,6 @@ void CharacterData::UnbindFromTree(bool aNullParent) {
SetSubtreeRootPointer(aNullParent ? this : mParent->SubtreeRoot());
}
#ifdef MOZ_XBL
if (document && !GetContainingShadow()) {
// 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)) {
nsContentUtils::AddScriptRunner(new RemoveFromBindingManagerRunnable(
document->BindingManager(), this, document));
}
}
#endif
nsExtendedContentSlots* slots = GetExistingExtendedContentSlots();
if (slots) {

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

@ -169,9 +169,6 @@ class CharacterData : public nsIContent {
void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override {}
#endif
#ifdef MOZ_XBL
nsXBLBinding* DoGetXBLBinding() const final { return nullptr; }
#endif
bool IsNodeOfType(uint32_t aFlags) const override { return false; }

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

@ -8,9 +8,6 @@
#include "nsContentUtils.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/HTMLSlotElement.h"
#ifdef MOZ_XBL
# include "mozilla/dom/XBLChildrenElement.h"
#endif
#include "mozilla/dom/ShadowRoot.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIFrame.h"
@ -48,17 +45,7 @@ nsIContent* ExplicitChildIterator::GetNextChild() {
return mChild;
}
#ifdef MOZ_XBL
MOZ_ASSERT(mChild->IsActiveChildrenElement());
auto* childrenElement = static_cast<XBLChildrenElement*>(mChild);
if (mIndexInInserted < childrenElement->InsertedChildrenLength()) {
return childrenElement->InsertedChild(mIndexInInserted++);
}
mIndexInInserted = 0;
mChild = mChild->GetNextSibling();
#else
MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
#endif
} else if (mDefaultChild) {
// If we're already in default content, check if there are more nodes there
MOZ_ASSERT(mChild);
@ -94,30 +81,7 @@ nsIContent* ExplicitChildIterator::GetNextChild() {
// content.
while (mChild) {
if (mChild->IsActiveChildrenElement()) {
#ifdef MOZ_XBL
// If the current child being iterated is a content insertion point
// then the iterator needs to return the nodes distributed into
// the content insertion point.
auto* childrenElement = static_cast<XBLChildrenElement*>(mChild);
if (childrenElement->HasInsertedChildren()) {
// Iterate through elements projected on insertion point.
mIndexInInserted = 1;
return childrenElement->InsertedChild(0);
}
// Insertion points inside fallback/default content
// are considered inactive and do not get assigned nodes.
mDefaultChild = mChild->GetFirstChild();
if (mDefaultChild) {
return mDefaultChild;
}
// If we have an insertion point with no assigned nodes and
// no default content, move on to the next node.
mChild = mChild->GetNextSibling();
#else
MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
#endif
} else {
// mChild is not an insertion point, thus it is the next node to
// return from this iterator.
@ -144,16 +108,6 @@ void FlattenedChildIterator::Init(bool aIgnoreXBL) {
}
}
#ifdef MOZ_XBL
nsXBLBinding* binding =
mParent->OwnerDoc()->BindingManager()->GetBindingWithContent(mParent);
if (binding) {
MOZ_ASSERT(binding->GetAnonymousContent());
mParent = binding->GetAnonymousContent();
mXBLInvolved = Some(true);
}
#endif
}
bool FlattenedChildIterator::ComputeWhetherXBLIsInvolved() const {
@ -211,13 +165,7 @@ nsIContent* ExplicitChildIterator::Get() const {
}
if (mIndexInInserted) {
#ifdef MOZ_XBL
MOZ_ASSERT(mChild->IsActiveChildrenElement());
auto* childrenElement = static_cast<XBLChildrenElement*>(mChild);
return childrenElement->InsertedChild(mIndexInInserted - 1);
#else
MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
#endif
}
return mDefaultChild ? mDefaultChild : mChild;
@ -240,18 +188,7 @@ nsIContent* ExplicitChildIterator::GetPreviousChild() {
return mChild;
}
#ifdef MOZ_XBL
// NB: mIndexInInserted points one past the last returned child so we need
// to look *two* indices back in order to return the previous child.
MOZ_ASSERT(mChild->IsActiveChildrenElement());
auto* childrenElement = static_cast<XBLChildrenElement*>(mChild);
if (--mIndexInInserted) {
return childrenElement->InsertedChild(mIndexInInserted - 1);
}
mChild = mChild->GetPreviousSibling();
#else
MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
#endif
} else if (mDefaultChild) {
// If we're already in default content, check if there are more nodes there
mDefaultChild = mDefaultChild->GetPreviousSibling();
@ -284,25 +221,7 @@ nsIContent* ExplicitChildIterator::GetPreviousChild() {
// content.
while (mChild) {
if (mChild->IsActiveChildrenElement()) {
#ifdef MOZ_XBL
// If the current child being iterated is a content insertion point
// then the iterator needs to return the nodes distributed into
// the content insertion point.
auto* childrenElement = static_cast<XBLChildrenElement*>(mChild);
if (childrenElement->HasInsertedChildren()) {
mIndexInInserted = childrenElement->InsertedChildrenLength();
return childrenElement->InsertedChild(mIndexInInserted - 1);
}
mDefaultChild = mChild->GetLastChild();
if (mDefaultChild) {
return mDefaultChild;
}
mChild = mChild->GetPreviousSibling();
#else
MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
#endif
} else {
// mChild is not an insertion point, thus it is the next node to
// return from this iterator.

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

@ -179,9 +179,6 @@
#include "nsContentCreatorFunctions.h"
#include "nsIScriptContext.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsHTMLDocument.h"
#include "nsIRequest.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
@ -1948,14 +1945,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(Document)
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
#ifdef MOZ_XBL
if (tmp->mMaybeEndOutermostXBLUpdateRunner) {
// The cached runnable keeps a reference to the document object..
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(
cb, "mMaybeEndOutermostXBLUpdateRunner.mObj");
cb.NoteXPCOMChild(ToSupports(tmp));
}
#endif
tmp->mExternalResourceMap.Traverse(&cb);
@ -2085,9 +2074,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Document)
tmp->mCachedRootElement = nullptr; // Avoid a dangling pointer
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDisplayDocument)
#ifdef MOZ_XBL
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMaybeEndOutermostXBLUpdateRunner)
#endif
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDOMImplementation)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mImageMaps)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCachedEncoder)
@ -5913,22 +5899,6 @@ static inline void AssertNoStaleServoDataIn(nsINode& aSubtreeRoot) {
continue;
}
MOZ_ASSERT(!element->HasServoData());
# ifdef MOZ_XBL
if (nsXBLBinding* binding = element->GetXBLBinding()) {
if (nsXBLBinding* bindingWithContent = binding->GetBindingWithContent()) {
nsIContent* content = bindingWithContent->GetAnonymousContent();
// Need to do this instead of just AssertNoStaleServoDataIn(*content),
// because the parent of the children of the <content> element isn't the
// <content> element, but the bound element, and that confuses
// GetNextNode a lot.
MOZ_ASSERT(!content->AsElement()->HasServoData());
for (nsINode* child = content->GetFirstChild(); child;
child = child->GetNextSibling()) {
AssertNoStaleServoDataIn(*child);
}
}
}
# endif
}
#endif
}
@ -6924,25 +6894,6 @@ bool Document::RemoveObserver(nsIDocumentObserver* aObserver) {
return mObservers.Contains(aObserver);
}
#ifdef MOZ_XBL
void Document::MaybeEndOutermostXBLUpdate() {
// Only call BindingManager()->EndOutermostUpdate() when
// we're not in an update and it is safe to run scripts.
if (mUpdateNestLevel == 0 && mInXBLUpdate) {
if (nsContentUtils::IsSafeToRunScript()) {
mInXBLUpdate = false;
BindingManager()->EndOutermostUpdate();
} else if (!mInDestructor) {
if (!mMaybeEndOutermostXBLUpdateRunner) {
mMaybeEndOutermostXBLUpdateRunner =
NewRunnableMethod("Document::MaybeEndOutermostXBLUpdate", this,
&Document::MaybeEndOutermostXBLUpdate);
}
nsContentUtils::AddScriptRunner(mMaybeEndOutermostXBLUpdateRunner);
}
}
}
#endif
void Document::BeginUpdate() {
// If the document is going away, then it's probably okay to do things to it
@ -6956,12 +6907,6 @@ void Document::BeginUpdate() {
mDocGroup->ValidateAccess();
}
#ifdef MOZ_XBL
if (mUpdateNestLevel == 0 && !mInXBLUpdate) {
mInXBLUpdate = true;
BindingManager()->BeginOutermostUpdate();
}
#endif
++mUpdateNestLevel;
nsContentUtils::AddScriptBlocker();
@ -6978,11 +6923,6 @@ void Document::EndUpdate() {
--mUpdateNestLevel;
#ifdef MOZ_XBL
// This set of updates may have created XBL bindings. Let the
// binding manager know we're done.
MaybeEndOutermostXBLUpdate();
#endif
MaybeInitializeFinalizeFrameLoaders();
if (mXULBroadcastManager) {
@ -7874,77 +7814,21 @@ Element* Document::GetBindingParent(nsINode& aNode) {
return bindingParent ? bindingParent->AsElement() : nullptr;
}
#ifdef MOZ_XBL
static Element* GetElementByAttribute(Element* aElement, nsAtom* aAttrName,
const nsAString& aAttrValue,
bool aUniversalMatch) {
if (aUniversalMatch ? aElement->HasAttr(kNameSpaceID_None, aAttrName)
: aElement->AttrValueIs(kNameSpaceID_None, aAttrName,
aAttrValue, eCaseMatters)) {
return aElement;
}
for (nsIContent* child = aElement->GetFirstChild(); child;
child = child->GetNextSibling()) {
if (!child->IsElement()) {
continue;
}
Element* matchedElement = GetElementByAttribute(
child->AsElement(), aAttrName, aAttrValue, aUniversalMatch);
if (matchedElement) return matchedElement;
}
return nullptr;
}
#endif
Element* Document::GetAnonymousElementByAttribute(
nsIContent* aElement, nsAtom* aAttrName,
const nsAString& aAttrValue) const {
#ifdef MOZ_XBL
nsINodeList* nodeList = BindingManager()->GetAnonymousNodesFor(aElement);
if (!nodeList) return nullptr;
uint32_t length = nodeList->Length();
bool universalMatch = aAttrValue.EqualsLiteral("*");
for (uint32_t i = 0; i < length; ++i) {
Element* current = Element::FromNode(nodeList->Item(i));
if (!current) {
continue;
}
Element* matchedElm =
GetElementByAttribute(current, aAttrName, aAttrValue, universalMatch);
if (matchedElm) return matchedElm;
}
return nullptr;
#else
return nullptr;
#endif
}
Element* Document::GetAnonymousElementByAttribute(Element& aElement,
const nsAString& aAttrName,
const nsAString& aAttrValue) {
#ifdef MOZ_XBL
RefPtr<nsAtom> attribute = NS_Atomize(aAttrName);
return GetAnonymousElementByAttribute(&aElement, attribute, aAttrValue);
#else
return nullptr;
#endif
}
nsINodeList* Document::GetAnonymousNodes(Element& aElement) {
#ifdef MOZ_XBL
return BindingManager()->GetAnonymousNodesFor(&aElement);
#else
return nullptr;
#endif
}
already_AddRefed<nsRange> Document::CreateRange(ErrorResult& rv) {
@ -9303,15 +9187,6 @@ nsINode* Document::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv) {
} else {
MOZ_ASSERT(!adoptedNode->IsInUncomposedDoc());
#ifdef MOZ_XBL
// If we're adopting a node that's not in a document, it might still
// have a binding applied. Remove the binding from the element now
// that it's getting adopted into a new document.
// TODO Fully tear down the binding.
if (Element* element = Element::FromNode(adoptedNode)) {
element->SetXBLBinding(nullptr);
}
#endif
}
break;
@ -14199,14 +14074,6 @@ void Document::AddSizeOfNodeTree(nsINode& aNode, nsWindowSizes& aWindowSizes) {
AddSizeOfNodeTree(*shadow, aWindowSizes);
}
#ifdef MOZ_XBL
for (nsXBLBinding* binding = element->GetXBLBinding(); binding;
binding = binding->GetBaseBinding()) {
if (nsIContent* anonContent = binding->GetAnonymousContent()) {
AddSizeOfNodeTree(*anonContent, aWindowSizes);
}
}
#endif
}
}

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

@ -85,9 +85,6 @@ class ElementCreationOptionsOrString;
class gfxUserFontSet;
class imgIRequest;
#ifdef MOZ_XBL
class nsBindingManager;
#endif
class nsCachableElementsByNameNodeList;
class nsCommandManager;
class nsContentList;
@ -1813,9 +1810,6 @@ class Document : public nsINode,
void DoUnblockOnload();
#ifdef MOZ_XBL
void MaybeEndOutermostXBLUpdate();
#endif
void RetrieveRelevantHeaders(nsIChannel* aChannel);
@ -2394,11 +2388,6 @@ class Document : public nsINode,
DoUpdateSVGUseElementShadowTrees();
}
#ifdef MOZ_XBL
nsBindingManager* BindingManager() const {
return mNodeInfoManager->GetBindingManager();
}
#endif
/**
* Only to be used inside Gecko, you can't really do anything with the
@ -5294,9 +5283,6 @@ class Document : public nsINode,
RefPtr<EventListenerManager> mListenerManager;
#ifdef MOZ_XBL
nsCOMPtr<nsIRunnable> mMaybeEndOutermostXBLUpdateRunner;
#endif
nsCOMPtr<nsIRequest> mOnloadBlocker;
nsTArray<RefPtr<StyleSheet>> mAdditionalSheets[AdditionalSheetTypeCount];

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

@ -95,12 +95,6 @@
# include "nsRange.h"
#endif
#ifdef MOZ_XBL
# include "nsXBLPrototypeBinding.h"
# include "nsBindingManager.h"
# include "nsXBLBinding.h"
# include "nsXBLService.h"
#endif
#include "nsPIDOMWindow.h"
#include "mozilla/dom/DOMRect.h"
#include "nsSVGUtils.h"
@ -268,13 +262,7 @@ Element::QueryInterface(REFNSIID aIID, void** aInstancePtr) {
return NS_OK;
}
#if MOZ_XBL
// Give the binding manager a chance to get an interface for this element.
return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID,
aInstancePtr);
#else
return NS_NOINTERFACE;
#endif
}
EventStates Element::IntrinsicState() const {
@ -383,47 +371,6 @@ void Element::SetTabIndex(int32_t aTabIndex, mozilla::ErrorResult& aError) {
SetAttr(nsGkAtoms::tabindex, value, aError);
}
#ifdef MOZ_XBL
void Element::SetXBLBinding(nsXBLBinding* aBinding,
nsBindingManager* aOldBindingManager) {
nsBindingManager* bindingManager;
if (aOldBindingManager) {
MOZ_ASSERT(!aBinding,
"aOldBindingManager should only be provided "
"when removing a binding.");
bindingManager = aOldBindingManager;
} else {
bindingManager = OwnerDoc()->BindingManager();
}
// After this point, aBinding will be the most-derived binding for aContent.
// If we already have a binding for aContent, make sure to
// remove it from the attached stack. Otherwise we might end up firing its
// constructor twice (if aBinding inherits from it) or firing its constructor
// after aContent has been deleted (if aBinding is null and the content node
// dies before we process mAttachedStack).
RefPtr<nsXBLBinding> oldBinding = GetXBLBinding();
if (oldBinding) {
bindingManager->RemoveFromAttachedQueue(oldBinding);
}
if (aBinding) {
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
slots->mXBLBinding = aBinding;
bindingManager->AddBoundContent(this);
} else {
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
slots->mXBLBinding = nullptr;
}
bindingManager->RemoveBoundContent(this);
if (oldBinding) {
oldBinding->SetBoundElement(nullptr);
}
}
}
#endif
void Element::SetShadowRoot(ShadowRoot* aShadowRoot) {
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
@ -1067,9 +1014,6 @@ already_AddRefed<ShadowRoot> Element::AttachShadow(const ShadowRootInit& aInit,
* an "InvalidStateError" DOMException.
*/
if (GetShadowRoot()
#ifdef MOZ_XBL
|| GetXBLBinding()
#endif
) {
aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
@ -1597,18 +1541,6 @@ nsresult Element::BindToTree(BindContext& aContext, nsINode& aParent) {
UpdateEditableState(false);
#ifdef MOZ_XBL
// 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 =
aContext.OwnerDoc().BindingManager()->GetBindingWithContent(this);
if (binding) {
binding->BindAnonymousContent(binding->GetAnonymousContent(), this);
}
}
#endif
// Call BindToTree on shadow root children.
nsresult rv;
@ -1690,33 +1622,6 @@ nsresult Element::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
#ifdef MOZ_XBL
RemoveFromBindingManagerRunnable::RemoveFromBindingManagerRunnable(
nsBindingManager* aManager, nsIContent* aContent, Document* aDoc)
: mozilla::Runnable("dom::RemoveFromBindingManagerRunnable"),
mManager(aManager),
mContent(aContent),
mDoc(aDoc) {}
RemoveFromBindingManagerRunnable::~RemoveFromBindingManagerRunnable() {}
NS_IMETHODIMP
RemoveFromBindingManagerRunnable::Run() {
// It may be the case that the element was removed from the
// DOM, causing this runnable to be created, then inserted back
// into the document before the this runnable had a chance to
// tear down the binding. Only tear down the binding if the element
// is still no longer in the DOM. nsXBLService::LoadBinding tears
// down the old binding if the element is inserted back into the
// DOM and loads a different binding.
if (!mContent->IsInComposedDoc()) {
mManager->RemovedFromDocumentInternal(mContent, mDoc,
nsBindingManager::eRunDtor);
}
return NS_OK;
}
#endif
bool WillDetachFromShadowOnUnbind(const Element& aElement, bool aNullParent) {
// If our parent still is in a shadow tree by now, and we're not removing
@ -1865,21 +1770,6 @@ void Element::UnbindFromTree(bool aNullParent) {
}
if (document) {
#ifdef MOZ_XBL
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,
binding->GetAnonymousContent(),
/* aNullParent */ false);
}
}
#endif
// Disconnected must be enqueued whenever a connected custom element becomes
// disconnected.
@ -2409,14 +2299,6 @@ nsresult Element::SetAttrAndNotify(
oldValue = aOldValue;
}
#ifdef MOZ_XBL
if (aComposedDocument) {
RefPtr<nsXBLBinding> binding = GetXBLBinding();
if (binding) {
binding->AttributeChanged(aName, aNamespaceID, false, aNotify);
}
}
#endif
if (HasElementCreatedFromPrototypeAndHasUnmodifiedL10n() &&
aNamespaceID == kNameSpaceID_None &&
@ -2727,14 +2609,6 @@ nsresult Element::UnsetAttr(int32_t aNameSpaceID, nsAtom* aName, bool aNotify) {
PostIdMaybeChange(aNameSpaceID, aName, nullptr);
#ifdef MOZ_XBL
if (document) {
RefPtr<nsXBLBinding> binding = GetXBLBinding();
if (binding) {
binding->AttributeChanged(aName, aNameSpaceID, true, aNotify);
}
}
#endif
CustomElementDefinition* definition = GetCustomElementDefinition();
// Only custom element which is in `custom` state could get the
@ -2856,52 +2730,6 @@ void Element::List(FILE* out, int32_t aIndent, const nsCString& aPrefix) const {
fputs(">\n", out);
# ifdef MOZ_XBL
Element* nonConstThis = const_cast<Element*>(this);
// XXX sXBL/XBL2 issue! Owner or current document?
Document* document = OwnerDoc();
// Note: not listing nsIAnonymousContentCreator-created content...
nsBindingManager* bindingManager = document->BindingManager();
nsINodeList* anonymousChildren =
bindingManager->GetAnonymousNodesFor(nonConstThis);
if (anonymousChildren) {
uint32_t length = anonymousChildren->Length();
for (indent = aIndent; --indent >= 0;) fputs(" ", out);
fputs("anonymous-children<\n", out);
for (uint32_t i = 0; i < length; ++i) {
nsIContent* child = anonymousChildren->Item(i);
child->List(out, aIndent + 1);
}
for (indent = aIndent; --indent >= 0;) fputs(" ", out);
fputs(">\n", out);
bool outHeader = false;
ExplicitChildIterator iter(nonConstThis);
for (nsIContent* child = iter.GetNextChild(); child;
child = iter.GetNextChild()) {
if (!outHeader) {
outHeader = true;
for (indent = aIndent; --indent >= 0;) fputs(" ", out);
fputs("content-list<\n", out);
}
child->List(out, aIndent + 1);
}
if (outHeader) {
for (indent = aIndent; --indent >= 0;) fputs(" ", out);
fputs(">\n", out);
}
}
# endif
}
void Element::DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const {
@ -3922,12 +3750,6 @@ void Element::GetCustomInterface(nsGetterAddRefs<T> aResult) {
}
}
#ifdef MOZ_XBL
// Otherwise, check the binding manager to see if it implements the interface
// for this element.
OwnerDoc()->BindingManager()->GetBindingImplementation(
this, NS_GET_TEMPLATE_IID(T), aResult);
#endif
}
void Element::ClearServoData(Document* aDoc) {

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

@ -224,23 +224,6 @@ class Element : public FragmentOrElement {
*/
void SetTabIndex(int32_t aTabIndex, mozilla::ErrorResult& aError);
#ifdef MOZ_XBL
/**
* Sets or unsets an XBL binding for this element. Setting a
* binding on an element that already has a binding will remove the
* old binding.
*
* @param aBinding The binding to bind to this content. If nullptr is
* provided as the argument, then existing binding will be
* removed.
*
* @param aOldBindingManager The old binding manager that contains
* this content if this content was adopted
* to another document.
*/
void SetXBLBinding(nsXBLBinding* aBinding,
nsBindingManager* aOldBindingManager = nullptr);
#endif
/**
* Sets the ShadowRoot binding for this element. The contents of the
@ -1975,21 +1958,6 @@ class Element : public FragmentOrElement {
AttrArray mAttrs;
};
#ifdef MOZ_XBL
class RemoveFromBindingManagerRunnable : public mozilla::Runnable {
public:
RemoveFromBindingManagerRunnable(nsBindingManager* aManager,
nsIContent* aContent, Document* aDoc);
NS_IMETHOD Run() override;
private:
virtual ~RemoveFromBindingManagerRunnable();
RefPtr<nsBindingManager> mManager;
RefPtr<nsIContent> mContent;
RefPtr<Document> mDoc;
};
#endif
NS_DEFINE_STATIC_IID_ACCESSOR(Element, NS_ELEMENT_IID)

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

@ -69,11 +69,6 @@
#endif
#include "nsFrameLoader.h"
#ifdef MOZ_XBL
# include "nsXBLPrototypeBinding.h"
# include "nsBindingManager.h"
# include "nsXBLBinding.h"
#endif
#include "nsPIDOMWindow.h"
#include "nsSVGUtils.h"
#include "nsLayoutUtils.h"
@ -684,11 +679,6 @@ void FragmentOrElement::nsExtendedDOMSlots::TraverseExtendedSlots(
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mExtendedSlots->mShadowRoot");
aCb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mShadowRoot));
#ifdef MOZ_XBL
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mExtendedSlots->mXBLBinding");
aCb.NoteNativeChild(mXBLBinding,
NS_CYCLE_COLLECTION_PARTICIPANT(nsXBLBinding));
#endif
if (mCustomElementData) {
mCustomElementData->Traverse(aCb);
@ -723,13 +713,6 @@ size_t FragmentOrElement::nsExtendedDOMSlots::SizeOfExcludingThis(
// mShadowRoot should be handled during normal DOM tree memory reporting, just
// like kids, siblings, etc.
#ifdef MOZ_XBL
// We don't seem to have memory reporting for nsXBLBinding. At least
// report the memory it's using directly.
if (mXBLBinding) {
n += aMallocSizeOf(mXBLBinding);
}
#endif
if (mCustomElementData) {
n += mCustomElementData->SizeOfIncludingThis(aMallocSizeOf);
@ -1091,13 +1074,6 @@ bool FragmentOrElement::IsLink(nsIURI** aURI) const {
return false;
}
#ifdef MOZ_XBL
nsXBLBinding* FragmentOrElement::DoGetXBLBinding() const {
MOZ_ASSERT(HasFlag(NODE_MAY_BE_IN_BINDING_MNGR));
const nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
return slots ? slots->mXBLBinding.get() : nullptr;
}
#endif
nsIContent* nsIContent::GetContainingShadowHost() const {
if (mozilla::dom::ShadowRoot* shadow = GetContainingShadow()) {
@ -1169,11 +1145,6 @@ void FragmentOrElement::DestroyContent() {
AsElement()->ClearServoData();
}
#ifdef MOZ_XBL
Document* document = OwnerDoc();
document->BindingManager()->RemovedFromDocument(this, document,
nsBindingManager::eRunDtor);
#endif
#ifdef DEBUG
uint32_t oldChildCount = GetChildCount();
@ -1380,11 +1351,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
tmp->ExtendedDOMSlots()->mShadowRoot = nullptr;
}
#ifdef MOZ_XBL
Document* doc = tmp->OwnerDoc();
doc->BindingManager()->RemovedFromDocument(tmp, doc,
nsBindingManager::eDoNotRunDtor);
#endif
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -1610,11 +1576,6 @@ bool NodeHasActiveFrame(Document* aCurrentDoc, nsINode* aNode) {
aNode->AsElement()->GetPrimaryFrame();
}
#ifdef MOZ_XBL
bool OwnedByBindingManager(Document* aCurrentDoc, nsINode* aNode) {
return aNode->IsElement() && aNode->AsElement()->GetXBLBinding();
}
#endif
// CanSkip checks if aNode is known-live, and if it is, returns true. If aNode
// is in a known-live DOM tree, CanSkip may also remove other objects from
@ -1632,9 +1593,6 @@ bool FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed) {
Document* currentDoc = aNode->GetComposedDoc();
if (currentDoc && IsCertainlyAliveNode(aNode, currentDoc) &&
(!unoptimizable || NodeHasActiveFrame(currentDoc, aNode)
#ifdef MOZ_XBL
|| OwnedByBindingManager(currentDoc, aNode)
#endif
)) {
MarkNodeChildren(aNode);
return true;
@ -1838,9 +1796,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
#ifdef MOZ_XBL
tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
#endif
// Check that whenever we have effect properties, MayHaveAnimations is set.
#ifdef DEBUG

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

@ -20,9 +20,6 @@
#include "nsIContent.h" // base class
#include "nsIHTMLCollection.h"
#include "nsDataHashtable.h"
#ifdef MOZ_XBL
# include "nsXBLBinding.h"
#endif
class ContentUnbinder;
class nsContentList;
@ -101,9 +98,6 @@ class FragmentOrElement : public nsIContent {
virtual uint32_t TextLength() const override;
virtual bool TextIsOnlyWhitespace() override;
virtual bool ThreadSafeTextIsOnlyWhitespace() const override;
#ifdef MOZ_XBL
virtual nsXBLBinding* DoGetXBLBinding() const override;
#endif
virtual bool IsLink(nsIURI** aURI) const override;
virtual void DestroyContent() override;
@ -196,12 +190,6 @@ class FragmentOrElement : public nsIContent {
*/
RefPtr<ShadowRoot> mShadowRoot;
#ifdef MOZ_XBL
/**
* XBL binding installed on the element.
*/
RefPtr<nsXBLBinding> mXBLBinding;
#endif
/**
* Web components custom element data.

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

@ -10,10 +10,6 @@
#include "nsContentUtils.h"
#include "nsIURI.h"
#include "nsIReferrerInfo.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
# include "nsXBLPrototypeBinding.h"
#endif
#include "nsEscape.h"
#include "nsCycleCollectionParticipant.h"
@ -65,10 +61,6 @@ void IDTracker::ResetToURIFragmentID(nsIContent* aFromContent, nsIURI* aURI,
nsIContent* bindingParent = aFromContent->GetBindingParent();
if (bindingParent && !aFromContent->IsInShadowTree()) {
#ifdef MOZ_XBL
nsXBLBinding* binding = bindingParent->GetXBLBinding();
if (!binding) {
#endif
// This happens, for example, if aFromContent is part of the content
// inserted by a call to Document::InsertAnonymousContent, which we
// also want to handle. (It also happens for <use>'s anonymous
@ -81,37 +73,6 @@ void IDTracker::ResetToURIFragmentID(nsIContent* aFromContent, nsIURI* aURI,
// here.
return;
}
#ifdef MOZ_XBL
} else {
bool isEqualExceptRef;
rv = aURI->EqualsExceptRef(binding->PrototypeBinding()->DocURI(),
&isEqualExceptRef);
if (NS_SUCCEEDED(rv) && isEqualExceptRef) {
// XXX sXBL/XBL2 issue
// Our content is an anonymous XBL element from a binding inside the
// same document that the referenced URI points to. In order to avoid
// the risk of ID collisions we restrict ourselves to anonymous
// elements from this binding; specifically, URIs that are relative to
// the binding document should resolve to the copy of the target
// element that has been inserted into the bound document.
// If the URI points to a different document we don't need this
// restriction.
nsINodeList* anonymousChildren =
doc->BindingManager()->GetAnonymousNodesFor(bindingParent);
if (anonymousChildren) {
uint32_t length = anonymousChildren->Length();
for (uint32_t i = 0; i < length && !mElement; ++i) {
mElement =
nsContentUtils::MatchElementId(anonymousChildren->Item(i), ref);
}
}
// We don't have watching working yet for XBL, so bail out here.
return;
}
}
#endif
}
bool isEqualExceptRef;

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

@ -23,9 +23,6 @@
#ifdef MOZ_XUL
# include "nsXULElement.h"
#endif
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsGenericHTMLElement.h"
#include "mozilla/AnimationTarget.h"
#include "mozilla/Assertions.h"
@ -56,14 +53,9 @@ enum class IsRemoveNotification {
# define COMPOSED_DOC_DECL
#endif
#ifdef MOZ_XBL
# define CALL_BINDING_MANAGER(func_, params_) \
doc->BindingManager()->func_ params_
#else
# define CALL_BINDING_MANAGER(func_, params_) \
do { \
} while (0)
#endif
// This macro expects the ownerDocument of content_ to be in scope as
// |Document* doc|

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

@ -12,9 +12,6 @@
#include "nsContentUtils.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsWindowSizes.h"
#ifdef MOZ_XBL
# include "nsXBLPrototypeBinding.h"
#endif
#include "mozilla/dom/DirectionalityUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLSlotElement.h"

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

@ -116,9 +116,6 @@
#include "nsAttrName.h"
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsCanvasFrame.h"
#include "nsCaret.h"
#include "nsCCUncollectableMarker.h"
@ -2151,13 +2148,7 @@ bool nsContentUtils::ThreadsafeIsSystemCaller(JSContext* aCx) {
bool nsContentUtils::LookupBindingMember(
JSContext* aCx, nsIContent* aContent, JS::Handle<jsid> aId,
JS::MutableHandle<JS::PropertyDescriptor> aDesc) {
#ifdef MOZ_XBL
nsXBLBinding* binding = aContent->GetXBLBinding();
if (!binding) return true;
return binding->LookupMember(aCx, aId, aDesc);
#else
return true;
#endif
}
// static

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

@ -35,9 +35,6 @@
#include "nsIPrincipal.h"
#include "nsIObserverService.h"
#include "nsIObjectFrame.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "BrowserChild.h"
#include "nsFrameLoader.h"
#include "nsHTMLDocument.h"

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

@ -184,10 +184,6 @@
#include "nsNetCID.h"
#include "nsIArray.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
# include "nsXBLService.h"
#endif
#include "nsIDragService.h"
#include "mozilla/dom/Element.h"
@ -2008,13 +2004,6 @@ nsresult nsGlobalWindowInner::PostHandleEvent(EventChainPostVisitor& aVisitor) {
break;
}
}
#ifdef MOZ_XBL
// Execute bindingdetached handlers before we tear ourselves
// down.
if (mDoc) {
mDoc->BindingManager()->ExecuteDetachedHandlers();
}
#endif
mIsDocumentLoaded = false;
} else if (aVisitor.mEvent->mMessage == eLoad &&
aVisitor.mEvent->IsTrusted()) {

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

@ -178,10 +178,6 @@
#include "nsIDOMXULCommandDispatcher.h"
#include "mozilla/GlobalKeyListener.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
# include "nsXBLService.h"
#endif
#include "nsIDragService.h"
#include "mozilla/dom/Element.h"

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

@ -21,9 +21,6 @@ class nsAttrValue;
class nsAttrName;
class nsTextFragment;
class nsIFrame;
#ifdef MOZ_XBL
class nsXBLBinding;
#endif
class nsITextControlElement;
namespace mozilla {
@ -397,22 +394,6 @@ class nsIContent : public nsINode {
return slots ? slots->mBindingParent.get() : nullptr;
}
#ifdef MOZ_XBL
/**
* Gets the current XBL binding that is bound to this element.
*
* @return the current binding.
*/
nsXBLBinding* GetXBLBinding() const {
if (!HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
return nullptr;
}
return DoGetXBLBinding();
}
virtual nsXBLBinding* DoGetXBLBinding() const = 0;
#endif
/**
* Gets the ShadowRoot binding for this element.

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

@ -9,9 +9,6 @@
#include "nsIContent.h"
#include "mozilla/dom/Document.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsContentUtils.h"
#include "nsAtom.h"
#include "nsIFrame.h"
@ -120,21 +117,6 @@ static inline nsINode* GetFlattenedTreeParentNode(const nsINode* aNode) {
}
}
#ifdef MOZ_XBL
if (content->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) ||
parent->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
if (nsIContent* xblInsertionPoint = content->GetXBLInsertionPoint()) {
return xblInsertionPoint->GetParent();
}
if (parent->OwnerDoc()->BindingManager()->GetBindingWithContent(
parentAsContent)) {
// This is an unassigned node child of the bound element, so it isn't part
// of the flat tree.
return nullptr;
}
}
#endif
MOZ_ASSERT(!parentAsContent->IsActiveChildrenElement(),
"<xbl:children> isn't in the flattened tree");

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

@ -94,11 +94,6 @@
#include "nsSVGUtils.h"
#include "nsTextNode.h"
#include "nsUnicharUtils.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
# include "nsXBLBinding.h"
# include "nsXBLPrototypeBinding.h"
#endif
#include "nsWindowSizes.h"
#include "mozilla/Preferences.h"
#include "xpcpublic.h"
@ -536,11 +531,6 @@ void nsINode::LastRelease() {
UnsetFlags(NODE_HAS_LISTENERMANAGER);
}
#ifdef MOZ_XBL
NS_ASSERTION(
!Element::FromNode(this) || !Element::FromNode(this)->GetXBLBinding(),
"Node has binding on destruction");
#endif
ReleaseWrapper(this);

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

@ -30,9 +30,6 @@
#include "xpcpublic.h"
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"
#ifdef MOZ_XBL
# include "nsXBLPrototypeBinding.h"
#endif
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/dom/BindingUtils.h"
@ -620,30 +617,6 @@ bool nsJSUtils::GetScopeChainForElement(
return true;
}
#ifdef MOZ_XBL
/* static */
bool nsJSUtils::GetScopeChainForXBL(
JSContext* aCx, Element* aElement,
const nsXBLPrototypeBinding& aProtoBinding,
JS::MutableHandleVector<JSObject*> aScopeChain) {
if (!aElement) {
return true;
}
if (!aProtoBinding.SimpleScopeChain()) {
return GetScopeChainForElement(aCx, aElement, aScopeChain);
}
if (!AddScopeChainItem(aCx, aElement, aScopeChain)) {
return false;
}
if (!AddScopeChainItem(aCx, aElement->OwnerDoc(), aScopeChain)) {
return false;
}
return true;
}
#endif
/* static */
void nsJSUtils::ResetTimeZone() { JS::ResetTimeZone(); }

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

@ -241,18 +241,6 @@ class nsJSUtils {
JSContext* aCx, mozilla::dom::Element* aElement,
JS::MutableHandleVector<JSObject*> aScopeChain);
#ifdef MOZ_XBL
// Returns a scope chain suitable for XBL execution.
//
// This is by default GetScopeChainForElemenet, but will be different if the
// <binding> element had the simpleScopeChain attribute.
//
// This is to prevent footguns like bug 1446342.
static bool GetScopeChainForXBL(
JSContext* aCx, mozilla::dom::Element* aBoundElement,
const nsXBLPrototypeBinding& aProtoBinding,
JS::MutableHandleVector<JSObject*> aScopeChain);
#endif
static void ResetTimeZone();

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

@ -21,9 +21,6 @@
#include "nsString.h"
#include "mozilla/dom/NodeInfo.h"
#include "mozilla/ClearOnShutdown.h"
#ifdef MOZ_XBL
# include "mozilla/dom/XBLChildrenElement.h"
#endif
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
@ -205,12 +202,6 @@ nsresult NS_NewElement(Element** aResult,
ni->NodeType(), ni->GetExtraName());
return NS_NewXMLElement(aResult, genericXMLNI.forget());
}
#ifdef MOZ_XBL
if (ns == kNameSpaceID_XBL && ni->Equals(nsGkAtoms::children)) {
NS_ADDREF(*aResult = new XBLChildrenElement(ni.forget()));
return NS_OK;
}
#endif
return NS_NewXMLElement(aResult, ni.forget());
}

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

@ -25,9 +25,6 @@
#include "nsGkAtoms.h"
#include "nsComponentManagerUtils.h"
#include "nsLayoutStatics.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsHashKeys.h"
#include "nsCCUncollectableMarker.h"
#include "nsNameSpaceManager.h"
@ -60,9 +57,6 @@ nsNodeInfoManager::~nsNodeInfoManager() {
// Note: mPrincipal may be null here if we never got inited correctly
mPrincipal = nullptr;
#ifdef MOZ_XBL
mBindingManager = nullptr;
#endif
if (gNodeInfoManagerLeakPRLog)
MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug,
@ -78,9 +72,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsNodeInfoManager)
if (tmp->mNonDocumentNodeInfos) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mDocument)
}
#ifdef MOZ_XBL
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBindingManager)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsNodeInfoManager, AddRef)
@ -112,11 +103,6 @@ nsresult nsNodeInfoManager::Init(mozilla::dom::Document* aDocument) {
mPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
#ifdef MOZ_XBL
if (aDocument) {
mBindingManager = new nsBindingManager(aDocument);
}
#endif
mDefaultPrincipal = mPrincipal;
@ -130,11 +116,6 @@ nsresult nsNodeInfoManager::Init(mozilla::dom::Document* aDocument) {
}
void nsNodeInfoManager::DropDocumentReference() {
#ifdef MOZ_XBL
if (mBindingManager) {
mBindingManager->DropDocumentReference();
}
#endif
// This is probably not needed anymore.
for (auto iter = mNodeInfoHash.Iter(); !iter.Done(); iter.Next()) {
@ -377,12 +358,6 @@ bool nsNodeInfoManager::InternalMathMLEnabled() {
void nsNodeInfoManager::AddSizeOfIncludingThis(nsWindowSizes& aSizes) const {
aSizes.mDOMOtherSize += aSizes.mState.mMallocSizeOf(this);
#ifdef MOZ_XBL
if (mBindingManager) {
aSizes.mBindingsSize +=
mBindingManager->SizeOfIncludingThis(aSizes.mState.mMallocSizeOf);
}
#endif
// Measurement of the following members may be added later if DMD finds it
// is worthwhile:

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

@ -19,9 +19,6 @@
#include "nsDataHashtable.h"
#include "nsStringFwd.h"
#ifdef MOZ_XBL
class nsBindingManager;
#endif
class nsAtom;
class nsIPrincipal;
class nsWindowSizes;
@ -100,9 +97,6 @@ class nsNodeInfoManager final {
void RemoveNodeInfo(mozilla::dom::NodeInfo* aNodeInfo);
#ifdef MOZ_XBL
nsBindingManager* GetBindingManager() const { return mBindingManager; }
#endif
/**
* Returns true if SVG nodes in this document have real SVG semantics.
@ -165,9 +159,6 @@ class nsNodeInfoManager final {
mCommentNodeInfo; // WEAK to avoid circular ownership
mozilla::dom::NodeInfo* MOZ_NON_OWNING_REF
mDocumentNodeInfo; // WEAK to avoid circular ownership
#ifdef MOZ_XBL
RefPtr<nsBindingManager> mBindingManager;
#endif
NodeInfoCache mRecentlyUsedNodeInfos;
mozilla::Maybe<bool> mSVGEnabled; // Lazily initialized.
mozilla::Maybe<bool> mMathMLEnabled; // Lazily initialized.

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

@ -64,9 +64,6 @@
#include "nsReadableUtils.h"
#include "nsIFrame.h"
#include "nsNodeInfoManager.h"
#ifdef MOZ_XBL
# include "nsXBLBinding.h"
#endif
#include "nsXULTooltipListener.h"
#include "mozilla/EventDispatcher.h"
#include "mozAutoDocUpdate.h"

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

@ -198,21 +198,6 @@ nsresult nsXULPrototypeCache::PutScript(nsIURI* aURI,
return NS_OK;
}
#ifdef MOZ_XBL
nsXBLDocumentInfo* nsXULPrototypeCache::GetXBLDocumentInfo(nsIURI* aURL) {
return mXBLDocTable.GetWeak(aURL);
}
nsresult nsXULPrototypeCache::PutXBLDocumentInfo(
nsXBLDocumentInfo* aDocumentInfo) {
nsIURI* uri = aDocumentInfo->DocumentURI();
nsXBLDocumentInfo* info = mXBLDocTable.GetWeak(uri);
if (!info) {
mXBLDocTable.Put(uri, aDocumentInfo);
}
return NS_OK;
}
#endif
void nsXULPrototypeCache::FlushScripts() { mScriptTable.Clear(); }
@ -220,9 +205,6 @@ void nsXULPrototypeCache::Flush() {
mPrototypeTable.Clear();
mScriptTable.Clear();
mStyleSheetTable.Clear();
#ifdef MOZ_XBL
mXBLDocTable.Clear();
#endif
}
bool nsXULPrototypeCache::IsEnabled() { return !gDisableXULCache; }
@ -485,11 +467,6 @@ nsresult nsXULPrototypeCache::BeginCaching(nsIURI* aURI) {
}
void nsXULPrototypeCache::MarkInCCGeneration(uint32_t aGeneration) {
#ifdef MOZ_XBL
for (auto iter = mXBLDocTable.Iter(); !iter.Done(); iter.Next()) {
iter.Data()->MarkInCCGeneration(aGeneration);
}
#endif
for (auto iter = mPrototypeTable.Iter(); !iter.Done(); iter.Next()) {
iter.Data()->MarkInCCGeneration(aGeneration);
}
@ -515,16 +492,6 @@ static void ReportSize(const nsCString& aPath, size_t aAmount,
aData);
}
#ifdef MOZ_XBL
static void AppendURIForMemoryReport(nsIURI* aUri, nsACString& aOutput) {
nsCString spec = aUri->GetSpecOrDefault();
// A hack: replace forward slashes with '\\' so they aren't
// treated as path separators. Users of the reporters
// (such as about:memory) have to undo this change.
spec.ReplaceChar('/', '\\');
aOutput += spec;
}
#endif
/* static */
void nsXULPrototypeCache::CollectMemoryReports(
@ -548,18 +515,6 @@ void nsXULPrototypeCache::CollectMemoryReports(
other += sInstance->mScriptTable.ShallowSizeOfExcludingThis(mallocSizeOf);
// TODO Report content inside mScriptTable?
#ifdef MOZ_XBL
other += sInstance->mXBLDocTable.ShallowSizeOfExcludingThis(mallocSizeOf);
for (auto iter = sInstance->mXBLDocTable.ConstIter(); !iter.Done();
iter.Next()) {
nsAutoCString path;
path += "xbl-docs/(";
AppendURIForMemoryReport(iter.Key(), path);
path += ")";
size_t size = iter.UserData()->SizeOfIncludingThis(mallocSizeOf);
REPORT_SIZE(path, size, "Memory used by this XBL document.");
}
#endif
other +=
sInstance->mStartupCacheURITable.ShallowSizeOfExcludingThis(mallocSizeOf);

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

@ -8,9 +8,6 @@
#include "nsCOMPtr.h"
#include "nsIObserver.h"
#ifdef MOZ_XBL
# include "nsXBLDocumentInfo.h"
#endif
#include "nsJSThingHashtable.h"
#include "nsInterfaceHashtable.h"
#include "nsRefPtrHashtable.h"
@ -63,11 +60,6 @@ class nsXULPrototypeCache : public nsIObserver {
JSScript* GetScript(nsIURI* aURI);
nsresult PutScript(nsIURI* aURI, JS::Handle<JSScript*> aScriptObject);
#ifdef MOZ_XBL
nsXBLDocumentInfo* GetXBLDocumentInfo(nsIURI* aURL);
nsresult PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo);
#endif
/**
* Get a style sheet by URI. If the style sheet is not in the cache,
@ -119,17 +111,11 @@ class nsXULPrototypeCache : public nsIObserver {
static nsXULPrototypeCache* sInstance;
using StyleSheetTable = nsRefPtrHashtable<nsURIHashKey, mozilla::StyleSheet>;
#ifdef MOZ_XBL
using XBLDocTable = nsRefPtrHashtable<nsURIHashKey, nsXBLDocumentInfo>;
#endif
nsRefPtrHashtable<nsURIHashKey, nsXULPrototypeDocument>
mPrototypeTable; // owns the prototypes
StyleSheetTable mStyleSheetTable;
nsJSThingHashtable<nsURIHashKey, JSScript*> mScriptTable;
#ifdef MOZ_XBL
XBLDocTable mXBLDocTable;
#endif
// URIs already written to the startup cache, to prevent double-caching.
nsTHashtable<nsURIHashKey> mStartupCacheURITable;

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

@ -194,9 +194,6 @@
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/ImageTracker.h"
#include "nsIDocShellTreeOwner.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsClassHashtable.h"
#include "nsHashKeys.h"
#include "VisualViewport.h"
@ -1670,21 +1667,6 @@ void PresShell::EndObservingDocument() {
char* nsPresShell_ReflowStackPointerTop;
#endif
#ifdef MOZ_XBL
class XBLConstructorRunner : public Runnable {
public:
explicit XBLConstructorRunner(Document* aDocument)
: Runnable("XBLConstructorRunner"), mDocument(aDocument) {}
NS_IMETHOD Run() override {
mDocument->BindingManager()->ProcessAttachedQueue();
return NS_OK;
}
private:
RefPtr<Document> mDocument;
};
#endif
nsresult PresShell::Initialize() {
if (mIsDestroying) {
@ -1763,12 +1745,6 @@ nsresult PresShell::Initialize() {
// scope may have killed us too
NS_ENSURE_STATE(!mHaveShutDown);
#ifdef MOZ_XBL
// Run the XBL binding constructors for any new frames we've constructed.
// (Do this in a script runner, since our caller might have a script
// blocker on the stack.)
nsContentUtils::AddScriptRunner(new XBLConstructorRunner(mDocument));
#endif
// XBLConstructorRunner might destroy us.
NS_ENSURE_STATE(!mHaveShutDown);
@ -2882,23 +2858,6 @@ static void AssertNoFramesInSubtree(nsIContent* aContent) {
for (nsINode* node : ShadowIncludingTreeIterator(*aContent)) {
nsIContent* c = nsIContent::FromNode(node);
MOZ_ASSERT(!c->GetPrimaryFrame());
# ifdef MOZ_XBL
if (auto* binding = c->GetXBLBinding()) {
if (auto* bindingWithContent = binding->GetBindingWithContent()) {
nsIContent* anonContent = bindingWithContent->GetAnonymousContent();
MOZ_ASSERT(!anonContent->GetPrimaryFrame());
// Need to do this instead of just AssertNoFramesInSubtree(anonContent),
// because the parent of the children of the <content> element isn't the
// <content> element, but the bound element, and that confuses
// GetNextNode a lot.
for (nsIContent* child = anonContent->GetFirstChild(); child;
child = child->GetNextSibling()) {
AssertNoFramesInSubtree(child);
}
}
}
# endif
}
}
#endif
@ -4117,14 +4076,6 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) {
mPresContext->RestyleManager()->ProcessPendingRestyles();
}
#ifdef MOZ_XBL
// Process whatever XBL constructors those restyles queued up. This
// ensures that onload doesn't fire too early and that we won't do extra
// reflows after those constructors run.
if (MOZ_LIKELY(!mIsDestroying)) {
mDocument->BindingManager()->ProcessAttachedQueue();
}
#endif
// Now those constructors or events might have posted restyle
// events. At the same time, we still need up-to-date style data.
@ -9898,9 +9849,6 @@ bool PresShell::VerifyIncrementalReflow() {
nsAutoCauseReflowNotifier crNotifier(this);
presShell->Initialize();
}
# ifdef MOZ_XBL
mDocument->BindingManager()->ProcessAttachedQueue();
# endif
presShell->FlushPendingNotifications(FlushType::Layout);
presShell->SetVerifyReflowEnable(
true); // turn on verify reflow again now that

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

@ -70,13 +70,6 @@ inline int32_t PseudoCompareType(nsIFrame* aFrame, nsIContent** aContent) {
return 0;
}
#if defined(DEBUG) && defined(MOZ_XBL)
static bool IsXBLInvolved(nsIContent* aContent1, nsIContent* aContent2) {
auto* ancestor = nsContentUtils::GetCommonAncestor(aContent1, aContent2);
return ancestor && ancestor->IsElement() &&
ancestor->AsElement()->GetXBLBinding();
}
#endif
/* static */
bool nsGenConList::NodeAfter(const nsGenConNode* aNode1,
@ -108,9 +101,6 @@ bool nsGenConList::NodeAfter(const nsGenConNode* aNode1,
// DoCompareTreePosition doesn't know about XBL anonymous content, and we
// probably shouldn't bother teaching it about it.
MOZ_ASSERT(cmp != 0
#ifdef MOZ_XBL
|| IsXBLInvolved(content1, content2)
#endif
,
"same content, different frames");
return cmp > 0;

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

@ -39,9 +39,6 @@
#include "nsSprocketLayout.h"
#include "nsStackLayout.h"
#include "nsTextControlFrame.h"
#ifdef MOZ_XBL
# include "nsXBLService.h"
#endif
#include "txMozillaXSLTProcessor.h"
#include "nsTreeSanitizer.h"
#include "nsCellMap.h"
@ -169,9 +166,6 @@ nsresult nsLayoutStatics::Initialize() {
nsGlobalWindowInner::Init();
nsGlobalWindowOuter::Init();
Navigator::Init();
#ifdef MOZ_XBL
nsXBLService::Init();
#endif
rv = nsContentUtils::Init();
if (NS_FAILED(rv)) {
@ -389,9 +383,6 @@ void nsLayoutStatics::Shutdown() {
nsGlobalWindowInner::ShutDown();
nsGlobalWindowOuter::ShutDown();
nsListControlFrame::Shutdown();
#ifdef MOZ_XBL
nsXBLService::Shutdown();
#endif
FrameLayerBuilder::Shutdown();
CubebUtils::ShutdownLibrary();

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

@ -17,11 +17,6 @@
#include "nsIStyleSheetLinkingElement.h"
#include "nsIContentInlines.h"
#include "mozilla/dom/Document.h"
#ifdef MOZ_XBL
# include "nsXBLBinding.h"
# include "nsBindingManager.h"
# include "nsXBLPrototypeBinding.h"
#endif
#include "nsIMutableArray.h"
#include "ChildIterator.h"
#include "nsComputedDOMStyle.h"
@ -524,18 +519,6 @@ bool InspectorUtils::IsValidCSSColor(GlobalObject& aGlobalObject,
void InspectorUtils::GetBindingURLs(GlobalObject& aGlobalObject,
Element& aElement,
nsTArray<nsString>& aResult) {
#ifdef MOZ_XBL
nsXBLBinding* binding = aElement.GetXBLBinding();
while (binding) {
nsCString spec;
nsCOMPtr<nsIURI> bindingURI = binding->PrototypeBinding()->BindingURI();
bindingURI->GetSpec(spec);
nsString* resultURI = aResult.AppendElement();
CopyASCIItoUTF16(spec, *resultURI);
binding = binding->GetBaseBinding();
}
#endif
}
/* static */

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

@ -117,9 +117,6 @@ class nsCSSPropertyIDSet;
class nsCSSValue;
class nsINode;
class nsPresContext;
#ifdef MOZ_XBL
class nsXBLBinding;
#endif
struct nsFontFaceRuleContainer;
struct nsTimingFunction;

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

@ -1692,18 +1692,9 @@ already_AddRefed<nsIURI> SVGObserverUtils::GetBaseURLForLocalRef(
nsIContent* bindingParent = content->GetBindingParent();
if (bindingParent) {
#ifdef MOZ_XBL
nsXBLBinding* binding = bindingParent->GetXBLBinding();
if (binding) {
originalURI = binding->GetSourceDocURI();
} else {
#endif
MOZ_ASSERT(content->IsInNativeAnonymousSubtree(),
"a non-native anonymous tree which is not from "
"an XBL binding?");
#ifdef MOZ_XBL
}
#endif
}
}

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

@ -20,9 +20,6 @@
#include "nsIComponentManager.h"
#include "nsBoxLayoutState.h"
#include "nsIScrollableFrame.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsIServiceManager.h"
#include "nsCSSFrameConstructor.h"
#include "nsString.h"

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

@ -33,9 +33,6 @@
#include "nsCSSFrameConstructor.h"
#include "nsPIWindowRoot.h"
#include "nsIReflowCallback.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsIDocShellTreeOwner.h"
#include "nsIBaseWindow.h"
#include "nsISound.h"

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

@ -36,9 +36,6 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/UniquePtr.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
using namespace mozilla;

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

@ -14,9 +14,6 @@
#include "nsXULElement.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULCommandDispatcher.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
#endif
#include "nsCSSFrameConstructor.h"
#include "nsGlobalWindow.h"
#include "nsIContentInlines.h"
@ -2242,13 +2239,7 @@ static nsIContent* FindDefaultInsertionPoint(nsIContent* aParent) {
return slot;
}
}
#ifdef MOZ_XBL
bool multiple = false; // Unused
return aParent->OwnerDoc()->BindingManager()->FindNestedSingleInsertionPoint(
aParent, &multiple);
#else
return aParent;
#endif
}
nsContainerFrame* nsXULPopupManager::ImmediateParentFrame(

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

@ -38,10 +38,6 @@
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsTextNode.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
# include "nsXBLBinding.h"
#endif
using namespace mozilla;
using mozilla::dom::Document;

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

@ -54,9 +54,6 @@
#include "mozilla/dom/RangeBinding.h"
#include "mozilla/dom/Selection.h"
#include "nsRange.h"
#ifdef MOZ_XBL
# include "nsXBLBinding.h"
#endif
#include "nsTypeAheadFind.h"
@ -785,20 +782,6 @@ nsresult nsTypeAheadFind::GetSearchContainers(
}
nsCOMPtr<nsINode> searchRootNode(rootContent);
#ifdef MOZ_XBL
// Hack for XMLPrettyPrinter. nsFind can't handle complex anonymous content.
// If the root node has an XBL binding then there's not much we can do in
// in general, but we can try searching the binding's first child, which
// in the case of XMLPrettyPrinter contains the visible pretty-printed
// content.
nsXBLBinding* binding = rootContent->GetXBLBinding();
if (binding) {
nsIContent* anonContent = binding->GetAnonymousContent();
if (anonContent) {
searchRootNode = anonContent->GetFirstChild();
}
}
#endif
mSearchRange->SelectNodeContents(*searchRootNode, IgnoreErrors());
if (!mStartPointRange) {