Bug 289090. Get the pagesequenceframe from the frame constructor, don't poke around the frame hierarchy trying to find it. r+sr=bzbarsky
This commit is contained in:
@@ -1883,6 +1883,7 @@ nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument *aDocument,
|
|||||||
, mFixedContainingBlock(nsnull)
|
, mFixedContainingBlock(nsnull)
|
||||||
, mDocElementContainingBlock(nsnull)
|
, mDocElementContainingBlock(nsnull)
|
||||||
, mGfxScrollFrame(nsnull)
|
, mGfxScrollFrame(nsnull)
|
||||||
|
, mPageSequenceFrame(nsnull)
|
||||||
, mUpdateCount(0)
|
, mUpdateCount(0)
|
||||||
, mQuotesDirty(PR_FALSE)
|
, mQuotesDirty(PR_FALSE)
|
||||||
, mCountersDirty(PR_FALSE)
|
, mCountersDirty(PR_FALSE)
|
||||||
@@ -4420,9 +4421,6 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIContent* aDocElement,
|
|||||||
|
|
||||||
// how the root frame hierarchy should look
|
// how the root frame hierarchy should look
|
||||||
|
|
||||||
// XXXbz if you change this method, change
|
|
||||||
// PresShell::GetPageSequenceFrame accordingly!
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
---------------No Scrollbars------
|
---------------No Scrollbars------
|
||||||
@@ -4525,6 +4523,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIContent* aDocElement,
|
|||||||
} else {
|
} else {
|
||||||
// Create a page sequence frame
|
// Create a page sequence frame
|
||||||
NS_NewSimplePageSequenceFrame(mPresShell, &rootFrame);
|
NS_NewSimplePageSequenceFrame(mPresShell, &rootFrame);
|
||||||
|
mPageSequenceFrame = rootFrame;
|
||||||
rootPseudo = nsCSSAnonBoxes::pageSequence;
|
rootPseudo = nsCSSAnonBoxes::pageSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ public:
|
|||||||
nsILayoutHistoryState* aFrameState);
|
nsILayoutHistoryState* aFrameState);
|
||||||
|
|
||||||
nsIFrame* GetInitialContainingBlock() { return mInitialContainingBlock; }
|
nsIFrame* GetInitialContainingBlock() { return mInitialContainingBlock; }
|
||||||
|
nsIFrame* GetPageSequenceFrame() { return mPageSequenceFrame; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -984,6 +985,7 @@ private:
|
|||||||
nsIFrame* mFixedContainingBlock;
|
nsIFrame* mFixedContainingBlock;
|
||||||
nsIFrame* mDocElementContainingBlock;
|
nsIFrame* mDocElementContainingBlock;
|
||||||
nsIFrame* mGfxScrollFrame;
|
nsIFrame* mGfxScrollFrame;
|
||||||
|
nsIFrame* mPageSequenceFrame;
|
||||||
nsQuoteList mQuoteList;
|
nsQuoteList mQuoteList;
|
||||||
nsCounterManager mCounterManager;
|
nsCounterManager mCounterManager;
|
||||||
PRUint16 mUpdateCount;
|
PRUint16 mUpdateCount;
|
||||||
|
|||||||
@@ -3478,39 +3478,12 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const
|
|||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPageSequenceFrame* pageSequence = nsnull;
|
|
||||||
|
|
||||||
// The page sequence frame is the child of the rootFrame
|
|
||||||
nsIFrame *rootFrame = FrameManager()->GetRootFrame();
|
|
||||||
nsIFrame* child = rootFrame->GetFirstChild(nsnull);
|
|
||||||
|
|
||||||
if (nsnull != child) {
|
|
||||||
|
|
||||||
// but the child could be wrapped in a scrollframe so lets check
|
|
||||||
nsIScrollableFrame* scrollable = nsnull;
|
|
||||||
nsresult rv = child->QueryInterface(NS_GET_IID(nsIScrollableFrame),
|
|
||||||
(void **)&scrollable);
|
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != scrollable)) {
|
|
||||||
// if it is then get the scrolled frame
|
|
||||||
child = scrollable->GetScrolledFrame();
|
|
||||||
} else {
|
|
||||||
if (mPresContext->Type() == nsPresContext::eContext_PrintPreview) {
|
|
||||||
child = child->GetFirstChild(nsnull);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure the child is a pageSequence
|
|
||||||
rv = child->QueryInterface(NS_GET_IID(nsIPageSequenceFrame),
|
|
||||||
(void**)&pageSequence);
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv),"Error: Could not find pageSequence!");
|
|
||||||
|
|
||||||
*aResult = pageSequence;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aResult = nsnull;
|
*aResult = nsnull;
|
||||||
|
nsIFrame* frame = mFrameConstructor->GetPageSequenceFrame();
|
||||||
return NS_ERROR_FAILURE;
|
if (frame) {
|
||||||
|
CallQueryInterface(frame, aResult);
|
||||||
|
}
|
||||||
|
return *aResult ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user