mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 794582 - Rename nsINode::GetSlots() to nsINode::Slots() and remove null-checks; r=mounir
This commit is contained in:
parent
b8bde31475
commit
5d0ed87cc3
@ -410,7 +410,7 @@ protected:
|
||||
|
||||
nsDOMSlots *DOMSlots()
|
||||
{
|
||||
return static_cast<nsDOMSlots*>(GetSlots());
|
||||
return static_cast<nsDOMSlots*>(Slots());
|
||||
}
|
||||
|
||||
nsDOMSlots *GetExistingDOMSlots() const
|
||||
|
@ -789,13 +789,11 @@ public:
|
||||
*/
|
||||
void AddMutationObserver(nsIMutationObserver* aMutationObserver)
|
||||
{
|
||||
nsSlots* s = GetSlots();
|
||||
if (s) {
|
||||
NS_ASSERTION(s->mMutationObservers.IndexOf(aMutationObserver) ==
|
||||
nsTArray<int>::NoIndex,
|
||||
"Observer already in the list");
|
||||
s->mMutationObservers.AppendElement(aMutationObserver);
|
||||
}
|
||||
nsSlots* s = Slots();
|
||||
NS_ASSERTION(s->mMutationObservers.IndexOf(aMutationObserver) ==
|
||||
nsTArray<int>::NoIndex,
|
||||
"Observer already in the list");
|
||||
s->mMutationObservers.AppendElement(aMutationObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -804,10 +802,8 @@ public:
|
||||
*/
|
||||
void AddMutationObserverUnlessExists(nsIMutationObserver* aMutationObserver)
|
||||
{
|
||||
nsSlots* s = GetSlots();
|
||||
if (s) {
|
||||
s->mMutationObservers.AppendElementUnlessExists(aMutationObserver);
|
||||
}
|
||||
nsSlots* s = Slots();
|
||||
s->mMutationObservers.AppendElementUnlessExists(aMutationObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -893,7 +889,7 @@ public:
|
||||
#ifdef DEBUG
|
||||
nsSlots* DebugGetSlots()
|
||||
{
|
||||
return GetSlots();
|
||||
return Slots();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1419,6 +1415,7 @@ public:
|
||||
protected:
|
||||
|
||||
// Override this function to create a custom slots class.
|
||||
// Must not return null.
|
||||
virtual nsINode::nsSlots* CreateSlots();
|
||||
|
||||
bool HasSlots() const
|
||||
@ -1431,10 +1428,11 @@ protected:
|
||||
return mSlots;
|
||||
}
|
||||
|
||||
nsSlots* GetSlots()
|
||||
nsSlots* Slots()
|
||||
{
|
||||
if (!HasSlots()) {
|
||||
mSlots = CreateSlots();
|
||||
MOZ_ASSERT(mSlots);
|
||||
}
|
||||
return GetExistingSlots();
|
||||
}
|
||||
|
@ -482,10 +482,9 @@ NS_IMPL_ISUPPORTS1(nsNodeWeakReference,
|
||||
nsNodeWeakReference::~nsNodeWeakReference()
|
||||
{
|
||||
if (mNode) {
|
||||
NS_ASSERTION(mNode->GetSlots() &&
|
||||
mNode->GetSlots()->mWeakReference == this,
|
||||
NS_ASSERTION(mNode->Slots()->mWeakReference == this,
|
||||
"Weak reference has wrong value");
|
||||
mNode->GetSlots()->mWeakReference = nullptr;
|
||||
mNode->Slots()->mWeakReference = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,9 +508,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeSupportsWeakRefTearoff)
|
||||
NS_IMETHODIMP
|
||||
nsNodeSupportsWeakRefTearoff::GetWeakReference(nsIWeakReference** aInstancePtr)
|
||||
{
|
||||
nsINode::nsSlots* slots = mNode->GetSlots();
|
||||
NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsINode::nsSlots* slots = mNode->Slots();
|
||||
if (!slots->mWeakReference) {
|
||||
slots->mWeakReference = new nsNodeWeakReference(mNode);
|
||||
NS_ENSURE_TRUE(slots->mWeakReference, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -1986,7 +1986,7 @@ nsDocument::Init()
|
||||
mRadioGroups.Init();
|
||||
|
||||
// Force initialization.
|
||||
nsINode::nsSlots* slots = GetSlots();
|
||||
nsINode::nsSlots* slots = Slots();
|
||||
|
||||
// Prepend self as mutation-observer whether we need it or not (some
|
||||
// subclasses currently do, other don't). This is because the code in
|
||||
|
@ -458,15 +458,12 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
|
||||
// First set the binding parent
|
||||
if (aBindingParent) {
|
||||
nsDataSlots *slots = GetDataSlots();
|
||||
NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ASSERTION(IsRootOfNativeAnonymousSubtree() ||
|
||||
!HasFlag(NODE_IS_IN_ANONYMOUS_SUBTREE) ||
|
||||
(aParent && aParent->IsInNativeAnonymousSubtree()),
|
||||
"Trying to re-bind content from native anonymous subtree to "
|
||||
"non-native anonymous parent!");
|
||||
slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
|
||||
DataSlots()->mBindingParent = aBindingParent; // Weak, so no addref happens.
|
||||
if (aParent->IsInNativeAnonymousSubtree()) {
|
||||
SetFlags(NODE_IS_IN_ANONYMOUS_SUBTREE);
|
||||
}
|
||||
|
@ -269,9 +269,9 @@ protected:
|
||||
// Override from nsINode
|
||||
virtual nsINode::nsSlots* CreateSlots();
|
||||
|
||||
nsDataSlots *GetDataSlots()
|
||||
nsDataSlots* DataSlots()
|
||||
{
|
||||
return static_cast<nsDataSlots*>(GetSlots());
|
||||
return static_cast<nsDataSlots*>(Slots());
|
||||
}
|
||||
|
||||
nsDataSlots *GetExistingDataSlots() const
|
||||
|
@ -311,11 +311,7 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
|
||||
nsINodeList*
|
||||
nsINode::GetChildNodesList()
|
||||
{
|
||||
nsSlots *slots = GetSlots();
|
||||
if (!slots) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsSlots* slots = Slots();
|
||||
if (!slots->mChildNodes) {
|
||||
slots->mChildNodes = new nsChildContentList(this);
|
||||
if (slots->mChildNodes) {
|
||||
|
@ -1376,8 +1376,7 @@ nsXULElement::LoadSrc()
|
||||
NodeInfo()->Equals(nsGkAtoms::overlay, kNameSpaceID_XUL)) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsXULSlots* slots = static_cast<nsXULSlots*>(GetSlots());
|
||||
NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsXULSlots* slots = static_cast<nsXULSlots*>(Slots());
|
||||
if (!slots->mFrameLoader) {
|
||||
// false as the last parameter so that xul:iframe/browser/editor
|
||||
// session history handling works like dynamic html:iframes.
|
||||
|
Loading…
Reference in New Issue
Block a user