mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 820889 - convert PendingBinding to use mozilla::LinkedList; r=dholbert
This commit is contained in:
parent
cb670b88de
commit
d7fd75357d
@ -11,6 +11,7 @@
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsCRT.h"
|
||||
@ -697,7 +698,7 @@ private:
|
||||
// Structure used to keep track of a list of bindings we need to call
|
||||
// AddToAttachedQueue on. These should be in post-order depth-first
|
||||
// flattened tree traversal order.
|
||||
struct PendingBinding : public PRCList
|
||||
struct PendingBinding : public LinkedListElement<PendingBinding>
|
||||
{
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
PendingBinding() {
|
||||
@ -861,7 +862,6 @@ public:
|
||||
mState(aState),
|
||||
mPendingBinding(aState.mCurrentPendingBindingInsertionPoint)
|
||||
{
|
||||
NS_PRECONDITION(mPendingBinding, "how did that happen?");
|
||||
if (aPendingBinding) {
|
||||
aState.mCurrentPendingBindingInsertionPoint = aPendingBinding;
|
||||
}
|
||||
@ -874,14 +874,18 @@ public:
|
||||
|
||||
private:
|
||||
nsFrameConstructorState& mState;
|
||||
PRCList* mPendingBinding;
|
||||
PendingBinding* mPendingBinding;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a new pending binding to the list
|
||||
*/
|
||||
void AddPendingBinding(PendingBinding* aPendingBinding) {
|
||||
PR_INSERT_BEFORE(aPendingBinding, mCurrentPendingBindingInsertionPoint);
|
||||
if (mCurrentPendingBindingInsertionPoint) {
|
||||
mCurrentPendingBindingInsertionPoint->setPrevious(aPendingBinding);
|
||||
} else {
|
||||
mPendingBindings.insertBack(aPendingBinding);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -896,9 +900,9 @@ protected:
|
||||
|
||||
// Our list of all pending bindings. When we're done, we need to call
|
||||
// AddToAttachedQueue on all of them, in order.
|
||||
PRCList mPendingBindings;
|
||||
LinkedList<PendingBinding> mPendingBindings;
|
||||
|
||||
PRCList* mCurrentPendingBindingInsertionPoint;
|
||||
PendingBinding* mCurrentPendingBindingInsertionPoint;
|
||||
};
|
||||
|
||||
nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
|
||||
@ -925,7 +929,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShe
|
||||
mCreatingExtraFrames(false),
|
||||
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
aPresShell->GetDocument()),
|
||||
mCurrentPendingBindingInsertionPoint(&mPendingBindings)
|
||||
mCurrentPendingBindingInsertionPoint(nullptr)
|
||||
{
|
||||
#ifdef MOZ_XUL
|
||||
nsIRootBox* rootBox = nsIRootBox::GetRootBox(aPresShell);
|
||||
@ -934,7 +938,6 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShe
|
||||
}
|
||||
#endif
|
||||
MOZ_COUNT_CTOR(nsFrameConstructorState);
|
||||
PR_INIT_CLIST(&mPendingBindings);
|
||||
}
|
||||
|
||||
nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
|
||||
@ -959,7 +962,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
|
||||
mCreatingExtraFrames(false),
|
||||
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
aPresShell->GetDocument()),
|
||||
mCurrentPendingBindingInsertionPoint(&mPendingBindings)
|
||||
mCurrentPendingBindingInsertionPoint(nullptr)
|
||||
{
|
||||
#ifdef MOZ_XUL
|
||||
nsIRootBox* rootBox = nsIRootBox::GetRootBox(aPresShell);
|
||||
@ -969,7 +972,6 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
|
||||
#endif
|
||||
MOZ_COUNT_CTOR(nsFrameConstructorState);
|
||||
mFrameState = aPresShell->GetDocument()->GetLayoutHistoryState();
|
||||
PR_INIT_CLIST(&mPendingBindings);
|
||||
}
|
||||
|
||||
nsFrameConstructorState::~nsFrameConstructorState()
|
||||
@ -993,15 +995,14 @@ nsFrameConstructorState::~nsFrameConstructorState()
|
||||
mGeneratedTextNodesWithInitializer[i]->
|
||||
DeleteProperty(nsGkAtoms::genConInitializerProperty);
|
||||
}
|
||||
if (!PR_CLIST_IS_EMPTY(&mPendingBindings)) {
|
||||
if (!mPendingBindings.isEmpty()) {
|
||||
nsBindingManager* bindingManager = mPresShell->GetDocument()->BindingManager();
|
||||
do {
|
||||
PendingBinding* pendingBinding =
|
||||
static_cast<PendingBinding*>(PR_NEXT_LINK(&mPendingBindings));
|
||||
PR_REMOVE_LINK(pendingBinding);
|
||||
nsAutoPtr<PendingBinding> pendingBinding;
|
||||
pendingBinding = mPendingBindings.popFirst();
|
||||
bindingManager->AddToAttachedQueue(pendingBinding->mBinding);
|
||||
delete pendingBinding;
|
||||
} while (!PR_CLIST_IS_EMPTY(&mPendingBindings));
|
||||
} while (!mPendingBindings.isEmpty());
|
||||
mCurrentPendingBindingInsertionPoint = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user