Bug 473390 part 14. Eliminate the mRootBox member of the frame constructor state, and move its only consumer into the relevant frame Init method. r+sr=roc

This commit is contained in:
Boris Zbarsky 2009-01-19 13:31:33 -05:00
parent 18399c778f
commit b868afeb9d
2 changed files with 24 additions and 16 deletions

View File

@ -1085,8 +1085,6 @@ public:
nsFrameManager *mFrameManager;
#ifdef MOZ_XUL
// The root box, if any.
nsIRootBox* mRootBox;
// Frames destined for the nsGkAtoms::popupList.
nsAbsoluteItems mPopupItems;
#endif
@ -1215,8 +1213,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShe
mPresShell(aPresShell),
mFrameManager(aPresShell->FrameManager()),
#ifdef MOZ_XUL
mRootBox(nsIRootBox::GetRootBox(aPresShell)),
mPopupItems(mRootBox ? mRootBox->GetPopupSetFrame() : nsnull),
mPopupItems(nsnull),
#endif
mFixedItems(aFixedContainingBlock),
mAbsoluteItems(aAbsoluteContainingBlock),
@ -1229,6 +1226,12 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShe
mPseudoFrames(),
mAdditionalStateBits(0)
{
#ifdef MOZ_XUL
nsIRootBox* rootBox = nsIRootBox::GetRootBox(aPresShell);
if (rootBox) {
mPopupItems.containingBlock = rootBox->GetPopupSetFrame();
}
#endif
MOZ_COUNT_CTOR(nsFrameConstructorState);
}
@ -1240,8 +1243,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
mPresShell(aPresShell),
mFrameManager(aPresShell->FrameManager()),
#ifdef MOZ_XUL
mRootBox(nsIRootBox::GetRootBox(aPresShell)),
mPopupItems(mRootBox ? mRootBox->GetPopupSetFrame() : nsnull),
mPopupItems(nsnull),
#endif
mFixedItems(aFixedContainingBlock),
mAbsoluteItems(aAbsoluteContainingBlock),
@ -1253,6 +1255,12 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
mPseudoFrames(),
mAdditionalStateBits(0)
{
#ifdef MOZ_XUL
nsIRootBox* rootBox = nsIRootBox::GetRootBox(aPresShell);
if (rootBox) {
mPopupItems.containingBlock = rootBox->GetPopupSetFrame();
}
#endif
MOZ_COUNT_CTOR(nsFrameConstructorState);
mFrameState = aPresShell->GetDocument()->GetLayoutHistoryState();
}
@ -5707,7 +5715,6 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState,
// Just don't create a frame for this popup; we can't do
// anything with it, since there is no root popup set.
*aHaltProcessing = PR_TRUE;
NS_ASSERTION(!aState.mRootBox, "Popup containing block is missing");
return NS_OK;
}
@ -5721,15 +5728,6 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState,
// This is its own frame that derives from box.
newFrame = NS_NewMenuPopupFrame(mPresShell, aStyleContext);
if (aTag == nsGkAtoms::tooltip) {
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_default,
nsGkAtoms::_true, eIgnoreCase)) {
// Tell the root box about the tooltip.
if (aState.mRootBox)
aState.mRootBox->SetDefaultTooltip(aContent);
}
}
}
else {

View File

@ -179,6 +179,16 @@ nsMenuPopupFrame::Init(nsIContent* aContent,
CreateWidgetForView(ourView);
}
if (aContent->NodeInfo()->Equals(nsGkAtoms::tooltip, kNameSpaceID_XUL) &&
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_default,
nsGkAtoms::_true, eIgnoreCase)) {
nsIRootBox* rootBox =
nsIRootBox::GetRootBox(PresContext()->GetPresShell());
if (rootBox) {
rootBox->SetDefaultTooltip(aContent);
}
}
return rv;
}