зеркало из https://github.com/mozilla/gecko-dev.git
Hooked printing back up. It was a casuality of the viewport changes
This commit is contained in:
Родитель
8f69509b5c
Коммит
b63b2eb881
|
@ -429,8 +429,8 @@ protected:
|
||||||
|
|
||||||
nsresult ConstructDocElementFrame(nsIPresContext* aPresContext,
|
nsresult ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
nsIContent* aDocElement,
|
nsIContent* aDocElement,
|
||||||
nsIFrame* aRootFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIStyleContext* aRootStyleContext,
|
nsIStyleContext* aParentStyleContext,
|
||||||
nsIFrame*& aNewFrame);
|
nsIFrame*& aNewFrame);
|
||||||
|
|
||||||
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
|
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
|
||||||
|
@ -1498,39 +1498,21 @@ HTMLStyleSheetImpl::ConstructTableCellFrame(nsIPresContext* aPresContext,
|
||||||
nsresult
|
nsresult
|
||||||
HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
nsIContent* aDocElement,
|
nsIContent* aDocElement,
|
||||||
nsIFrame* aRootFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIStyleContext* aRootStyleContext,
|
nsIStyleContext* aParentStyleContext,
|
||||||
nsIFrame*& aNewFrame)
|
nsIFrame*& aNewFrame)
|
||||||
{
|
{
|
||||||
|
// Resolve the style context for the document element
|
||||||
|
nsIStyleContext* styleContext;
|
||||||
|
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aParentStyleContext);
|
||||||
|
|
||||||
// See if we're paginated
|
// See if we're paginated
|
||||||
if (aPresContext->IsPaginated()) {
|
if (aPresContext->IsPaginated()) {
|
||||||
nsIFrame* pageSequenceFrame;
|
|
||||||
|
|
||||||
// Create a page sequence frame
|
|
||||||
NS_NewSimplePageSequenceFrame(pageSequenceFrame);
|
|
||||||
pageSequenceFrame->Init(*aPresContext, nsnull, aRootFrame, aRootStyleContext);
|
|
||||||
|
|
||||||
// Create the first page
|
|
||||||
nsIFrame* pageFrame;
|
|
||||||
NS_NewPageFrame(pageFrame);
|
|
||||||
|
|
||||||
// Initialize the page and force it to have a view. This makes printing of
|
|
||||||
// the pages easier and faster.
|
|
||||||
// XXX Use a PAGE style context...
|
|
||||||
pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, aRootStyleContext);
|
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame,
|
|
||||||
aRootStyleContext, PR_TRUE);
|
|
||||||
|
|
||||||
// Resolve the style context for the document element
|
|
||||||
nsIStyleContext* styleContext;
|
|
||||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aRootStyleContext);
|
|
||||||
|
|
||||||
// Create an area frame for the document element
|
// Create an area frame for the document element
|
||||||
nsIFrame* areaFrame;
|
nsIFrame* areaFrame;
|
||||||
|
|
||||||
NS_NewAreaFrame(areaFrame, 0);
|
NS_NewAreaFrame(areaFrame, 0);
|
||||||
areaFrame->Init(*aPresContext, aDocElement, pageFrame, styleContext);
|
areaFrame->Init(*aPresContext, aDocElement, aParentFrame, styleContext);
|
||||||
NS_RELEASE(styleContext);
|
|
||||||
|
|
||||||
// The area frame is the "initial containing block"
|
// The area frame is the "initial containing block"
|
||||||
mInitialContainingBlock = areaFrame;
|
mInitialContainingBlock = areaFrame;
|
||||||
|
@ -1547,17 +1529,11 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
areaFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
|
areaFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
|
||||||
absoluteItems.childList);
|
absoluteItems.childList);
|
||||||
}
|
}
|
||||||
pageFrame->SetInitialChildList(*aPresContext, nsnull, areaFrame);
|
|
||||||
pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, pageFrame);
|
|
||||||
|
|
||||||
// Return the page sequence frame as the frame sub-tree
|
// Return the area frame
|
||||||
aNewFrame = pageSequenceFrame;
|
aNewFrame = areaFrame;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Resolve the style context for the document element
|
|
||||||
nsIStyleContext* styleContext;
|
|
||||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aRootStyleContext);
|
|
||||||
|
|
||||||
// Unless the 'overflow' policy forbids scrolling, wrap the frame in a
|
// Unless the 'overflow' policy forbids scrolling, wrap the frame in a
|
||||||
// scroll frame.
|
// scroll frame.
|
||||||
nsIFrame* scrollFrame = nsnull;
|
nsIFrame* scrollFrame = nsnull;
|
||||||
|
@ -1567,7 +1543,7 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
if (IsScrollable(aPresContext, display)) {
|
if (IsScrollable(aPresContext, display)) {
|
||||||
NS_NewScrollFrame(scrollFrame);
|
NS_NewScrollFrame(scrollFrame);
|
||||||
scrollFrame->Init(*aPresContext, aDocElement, aRootFrame, styleContext);
|
scrollFrame->Init(*aPresContext, aDocElement, aParentFrame, styleContext);
|
||||||
|
|
||||||
// The scrolled frame gets a pseudo element style context
|
// The scrolled frame gets a pseudo element style context
|
||||||
nsIStyleContext* scrolledPseudoStyle =
|
nsIStyleContext* scrolledPseudoStyle =
|
||||||
|
@ -1585,11 +1561,10 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
// XXX Until we clean up how painting damage is handled, we need to use the
|
// XXX Until we clean up how painting damage is handled, we need to use the
|
||||||
// flag that says that this is the body...
|
// flag that says that this is the body...
|
||||||
NS_NewAreaFrame(areaFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
NS_NewAreaFrame(areaFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
||||||
nsIFrame* parentFrame = scrollFrame ? scrollFrame : aRootFrame;
|
areaFrame->Init(*aPresContext, aDocElement, scrollFrame ? scrollFrame :
|
||||||
areaFrame->Init(*aPresContext, aDocElement, parentFrame, styleContext);
|
aParentFrame, styleContext);
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, areaFrame,
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, areaFrame,
|
||||||
styleContext, PR_FALSE);
|
styleContext, PR_FALSE);
|
||||||
NS_RELEASE(styleContext);
|
|
||||||
|
|
||||||
// The area frame is the "initial containing block"
|
// The area frame is the "initial containing block"
|
||||||
mInitialContainingBlock = areaFrame;
|
mInitialContainingBlock = areaFrame;
|
||||||
|
@ -1613,6 +1588,7 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
aNewFrame = scrollFrame ? scrollFrame : areaFrame;
|
aNewFrame = scrollFrame ? scrollFrame : areaFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_RELEASE(styleContext);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1688,36 +1664,77 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
||||||
scrollFrame->Init(*aPresContext, nsnull, viewportFrame, rootPseudoStyle);
|
scrollFrame->Init(*aPresContext, nsnull, viewportFrame, rootPseudoStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the root frame. The document element's frame is a child of the
|
if (aPresContext->IsPaginated()) {
|
||||||
// root frame.
|
nsIFrame* pageSequenceFrame;
|
||||||
//
|
|
||||||
// Note: the major reason we need the root frame is to implement margins for
|
|
||||||
// the document element's frame. If we didn't need to support margins on the
|
|
||||||
// document element's frame, then we could eliminate the root frame and make
|
|
||||||
// the document element frame a child of the viewport (or its scroll frame)
|
|
||||||
nsIFrame* rootFrame;
|
|
||||||
NS_NewRootFrame(rootFrame);
|
|
||||||
|
|
||||||
rootFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
// Create a page sequence frame
|
||||||
viewportFrame, rootPseudoStyle);
|
NS_NewSimplePageSequenceFrame(pageSequenceFrame);
|
||||||
if (isScrollable) {
|
pageSequenceFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, rootFrame,
|
viewportFrame, rootPseudoStyle);
|
||||||
|
if (isScrollable) {
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageSequenceFrame,
|
||||||
|
rootPseudoStyle, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the first page
|
||||||
|
nsIFrame* pageFrame;
|
||||||
|
NS_NewPageFrame(pageFrame);
|
||||||
|
|
||||||
|
// Initialize the page and force it to have a view. This makes printing of
|
||||||
|
// the pages easier and faster.
|
||||||
|
// XXX Use a PAGE style context...
|
||||||
|
pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, rootPseudoStyle);
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame,
|
||||||
rootPseudoStyle, PR_TRUE);
|
rootPseudoStyle, PR_TRUE);
|
||||||
}
|
|
||||||
|
|
||||||
// Create frames for the document element and its child elements
|
// Create frames for the document element and its child elements
|
||||||
nsIFrame* docElementFrame;
|
nsIFrame* docElementFrame;
|
||||||
ConstructDocElementFrame(aPresContext, aDocElement, rootFrame,
|
ConstructDocElementFrame(aPresContext, aDocElement, pageFrame,
|
||||||
rootPseudoStyle, docElementFrame);
|
rootPseudoStyle, docElementFrame);
|
||||||
NS_RELEASE(rootPseudoStyle);
|
NS_RELEASE(rootPseudoStyle);
|
||||||
|
|
||||||
// Set the initial child lists
|
// Set the initial child lists
|
||||||
rootFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
pageFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
||||||
if (isScrollable) {
|
pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, pageFrame);
|
||||||
scrollFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
if (isScrollable) {
|
||||||
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
scrollFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
||||||
|
} else {
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
viewportFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
// Create the root frame. The document element's frame is a child of the
|
||||||
|
// root frame.
|
||||||
|
//
|
||||||
|
// Note: the major reason we need the root frame is to implement margins for
|
||||||
|
// the document element's frame. If we didn't need to support margins on the
|
||||||
|
// document element's frame, then we could eliminate the root frame and make
|
||||||
|
// the document element frame a child of the viewport (or its scroll frame)
|
||||||
|
nsIFrame* rootFrame;
|
||||||
|
NS_NewRootFrame(rootFrame);
|
||||||
|
|
||||||
|
rootFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
||||||
|
viewportFrame, rootPseudoStyle);
|
||||||
|
if (isScrollable) {
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, rootFrame,
|
||||||
|
rootPseudoStyle, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create frames for the document element and its child elements
|
||||||
|
nsIFrame* docElementFrame;
|
||||||
|
ConstructDocElementFrame(aPresContext, aDocElement, rootFrame,
|
||||||
|
rootPseudoStyle, docElementFrame);
|
||||||
|
NS_RELEASE(rootPseudoStyle);
|
||||||
|
|
||||||
|
// Set the initial child lists
|
||||||
|
rootFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
||||||
|
if (isScrollable) {
|
||||||
|
scrollFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
||||||
|
} else {
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aNewFrame = viewportFrame;
|
aNewFrame = viewportFrame;
|
||||||
|
|
|
@ -429,8 +429,8 @@ protected:
|
||||||
|
|
||||||
nsresult ConstructDocElementFrame(nsIPresContext* aPresContext,
|
nsresult ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
nsIContent* aDocElement,
|
nsIContent* aDocElement,
|
||||||
nsIFrame* aRootFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIStyleContext* aRootStyleContext,
|
nsIStyleContext* aParentStyleContext,
|
||||||
nsIFrame*& aNewFrame);
|
nsIFrame*& aNewFrame);
|
||||||
|
|
||||||
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
|
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
|
||||||
|
@ -1498,39 +1498,21 @@ HTMLStyleSheetImpl::ConstructTableCellFrame(nsIPresContext* aPresContext,
|
||||||
nsresult
|
nsresult
|
||||||
HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
nsIContent* aDocElement,
|
nsIContent* aDocElement,
|
||||||
nsIFrame* aRootFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIStyleContext* aRootStyleContext,
|
nsIStyleContext* aParentStyleContext,
|
||||||
nsIFrame*& aNewFrame)
|
nsIFrame*& aNewFrame)
|
||||||
{
|
{
|
||||||
|
// Resolve the style context for the document element
|
||||||
|
nsIStyleContext* styleContext;
|
||||||
|
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aParentStyleContext);
|
||||||
|
|
||||||
// See if we're paginated
|
// See if we're paginated
|
||||||
if (aPresContext->IsPaginated()) {
|
if (aPresContext->IsPaginated()) {
|
||||||
nsIFrame* pageSequenceFrame;
|
|
||||||
|
|
||||||
// Create a page sequence frame
|
|
||||||
NS_NewSimplePageSequenceFrame(pageSequenceFrame);
|
|
||||||
pageSequenceFrame->Init(*aPresContext, nsnull, aRootFrame, aRootStyleContext);
|
|
||||||
|
|
||||||
// Create the first page
|
|
||||||
nsIFrame* pageFrame;
|
|
||||||
NS_NewPageFrame(pageFrame);
|
|
||||||
|
|
||||||
// Initialize the page and force it to have a view. This makes printing of
|
|
||||||
// the pages easier and faster.
|
|
||||||
// XXX Use a PAGE style context...
|
|
||||||
pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, aRootStyleContext);
|
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame,
|
|
||||||
aRootStyleContext, PR_TRUE);
|
|
||||||
|
|
||||||
// Resolve the style context for the document element
|
|
||||||
nsIStyleContext* styleContext;
|
|
||||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aRootStyleContext);
|
|
||||||
|
|
||||||
// Create an area frame for the document element
|
// Create an area frame for the document element
|
||||||
nsIFrame* areaFrame;
|
nsIFrame* areaFrame;
|
||||||
|
|
||||||
NS_NewAreaFrame(areaFrame, 0);
|
NS_NewAreaFrame(areaFrame, 0);
|
||||||
areaFrame->Init(*aPresContext, aDocElement, pageFrame, styleContext);
|
areaFrame->Init(*aPresContext, aDocElement, aParentFrame, styleContext);
|
||||||
NS_RELEASE(styleContext);
|
|
||||||
|
|
||||||
// The area frame is the "initial containing block"
|
// The area frame is the "initial containing block"
|
||||||
mInitialContainingBlock = areaFrame;
|
mInitialContainingBlock = areaFrame;
|
||||||
|
@ -1547,17 +1529,11 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
areaFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
|
areaFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
|
||||||
absoluteItems.childList);
|
absoluteItems.childList);
|
||||||
}
|
}
|
||||||
pageFrame->SetInitialChildList(*aPresContext, nsnull, areaFrame);
|
|
||||||
pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, pageFrame);
|
|
||||||
|
|
||||||
// Return the page sequence frame as the frame sub-tree
|
// Return the area frame
|
||||||
aNewFrame = pageSequenceFrame;
|
aNewFrame = areaFrame;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Resolve the style context for the document element
|
|
||||||
nsIStyleContext* styleContext;
|
|
||||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aRootStyleContext);
|
|
||||||
|
|
||||||
// Unless the 'overflow' policy forbids scrolling, wrap the frame in a
|
// Unless the 'overflow' policy forbids scrolling, wrap the frame in a
|
||||||
// scroll frame.
|
// scroll frame.
|
||||||
nsIFrame* scrollFrame = nsnull;
|
nsIFrame* scrollFrame = nsnull;
|
||||||
|
@ -1567,7 +1543,7 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
if (IsScrollable(aPresContext, display)) {
|
if (IsScrollable(aPresContext, display)) {
|
||||||
NS_NewScrollFrame(scrollFrame);
|
NS_NewScrollFrame(scrollFrame);
|
||||||
scrollFrame->Init(*aPresContext, aDocElement, aRootFrame, styleContext);
|
scrollFrame->Init(*aPresContext, aDocElement, aParentFrame, styleContext);
|
||||||
|
|
||||||
// The scrolled frame gets a pseudo element style context
|
// The scrolled frame gets a pseudo element style context
|
||||||
nsIStyleContext* scrolledPseudoStyle =
|
nsIStyleContext* scrolledPseudoStyle =
|
||||||
|
@ -1585,11 +1561,10 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
// XXX Until we clean up how painting damage is handled, we need to use the
|
// XXX Until we clean up how painting damage is handled, we need to use the
|
||||||
// flag that says that this is the body...
|
// flag that says that this is the body...
|
||||||
NS_NewAreaFrame(areaFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
NS_NewAreaFrame(areaFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
||||||
nsIFrame* parentFrame = scrollFrame ? scrollFrame : aRootFrame;
|
areaFrame->Init(*aPresContext, aDocElement, scrollFrame ? scrollFrame :
|
||||||
areaFrame->Init(*aPresContext, aDocElement, parentFrame, styleContext);
|
aParentFrame, styleContext);
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, areaFrame,
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, areaFrame,
|
||||||
styleContext, PR_FALSE);
|
styleContext, PR_FALSE);
|
||||||
NS_RELEASE(styleContext);
|
|
||||||
|
|
||||||
// The area frame is the "initial containing block"
|
// The area frame is the "initial containing block"
|
||||||
mInitialContainingBlock = areaFrame;
|
mInitialContainingBlock = areaFrame;
|
||||||
|
@ -1613,6 +1588,7 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
aNewFrame = scrollFrame ? scrollFrame : areaFrame;
|
aNewFrame = scrollFrame ? scrollFrame : areaFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_RELEASE(styleContext);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1688,36 +1664,77 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
||||||
scrollFrame->Init(*aPresContext, nsnull, viewportFrame, rootPseudoStyle);
|
scrollFrame->Init(*aPresContext, nsnull, viewportFrame, rootPseudoStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the root frame. The document element's frame is a child of the
|
if (aPresContext->IsPaginated()) {
|
||||||
// root frame.
|
nsIFrame* pageSequenceFrame;
|
||||||
//
|
|
||||||
// Note: the major reason we need the root frame is to implement margins for
|
|
||||||
// the document element's frame. If we didn't need to support margins on the
|
|
||||||
// document element's frame, then we could eliminate the root frame and make
|
|
||||||
// the document element frame a child of the viewport (or its scroll frame)
|
|
||||||
nsIFrame* rootFrame;
|
|
||||||
NS_NewRootFrame(rootFrame);
|
|
||||||
|
|
||||||
rootFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
// Create a page sequence frame
|
||||||
viewportFrame, rootPseudoStyle);
|
NS_NewSimplePageSequenceFrame(pageSequenceFrame);
|
||||||
if (isScrollable) {
|
pageSequenceFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, rootFrame,
|
viewportFrame, rootPseudoStyle);
|
||||||
|
if (isScrollable) {
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageSequenceFrame,
|
||||||
|
rootPseudoStyle, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the first page
|
||||||
|
nsIFrame* pageFrame;
|
||||||
|
NS_NewPageFrame(pageFrame);
|
||||||
|
|
||||||
|
// Initialize the page and force it to have a view. This makes printing of
|
||||||
|
// the pages easier and faster.
|
||||||
|
// XXX Use a PAGE style context...
|
||||||
|
pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, rootPseudoStyle);
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame,
|
||||||
rootPseudoStyle, PR_TRUE);
|
rootPseudoStyle, PR_TRUE);
|
||||||
}
|
|
||||||
|
|
||||||
// Create frames for the document element and its child elements
|
// Create frames for the document element and its child elements
|
||||||
nsIFrame* docElementFrame;
|
nsIFrame* docElementFrame;
|
||||||
ConstructDocElementFrame(aPresContext, aDocElement, rootFrame,
|
ConstructDocElementFrame(aPresContext, aDocElement, pageFrame,
|
||||||
rootPseudoStyle, docElementFrame);
|
rootPseudoStyle, docElementFrame);
|
||||||
NS_RELEASE(rootPseudoStyle);
|
NS_RELEASE(rootPseudoStyle);
|
||||||
|
|
||||||
// Set the initial child lists
|
// Set the initial child lists
|
||||||
rootFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
pageFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
||||||
if (isScrollable) {
|
pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, pageFrame);
|
||||||
scrollFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
if (isScrollable) {
|
||||||
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
scrollFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
||||||
|
} else {
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
viewportFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
// Create the root frame. The document element's frame is a child of the
|
||||||
|
// root frame.
|
||||||
|
//
|
||||||
|
// Note: the major reason we need the root frame is to implement margins for
|
||||||
|
// the document element's frame. If we didn't need to support margins on the
|
||||||
|
// document element's frame, then we could eliminate the root frame and make
|
||||||
|
// the document element frame a child of the viewport (or its scroll frame)
|
||||||
|
nsIFrame* rootFrame;
|
||||||
|
NS_NewRootFrame(rootFrame);
|
||||||
|
|
||||||
|
rootFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
||||||
|
viewportFrame, rootPseudoStyle);
|
||||||
|
if (isScrollable) {
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, rootFrame,
|
||||||
|
rootPseudoStyle, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create frames for the document element and its child elements
|
||||||
|
nsIFrame* docElementFrame;
|
||||||
|
ConstructDocElementFrame(aPresContext, aDocElement, rootFrame,
|
||||||
|
rootPseudoStyle, docElementFrame);
|
||||||
|
NS_RELEASE(rootPseudoStyle);
|
||||||
|
|
||||||
|
// Set the initial child lists
|
||||||
|
rootFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
||||||
|
if (isScrollable) {
|
||||||
|
scrollFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
||||||
|
} else {
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aNewFrame = viewportFrame;
|
aNewFrame = viewportFrame;
|
||||||
|
|
|
@ -429,8 +429,8 @@ protected:
|
||||||
|
|
||||||
nsresult ConstructDocElementFrame(nsIPresContext* aPresContext,
|
nsresult ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
nsIContent* aDocElement,
|
nsIContent* aDocElement,
|
||||||
nsIFrame* aRootFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIStyleContext* aRootStyleContext,
|
nsIStyleContext* aParentStyleContext,
|
||||||
nsIFrame*& aNewFrame);
|
nsIFrame*& aNewFrame);
|
||||||
|
|
||||||
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
|
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
|
||||||
|
@ -1498,39 +1498,21 @@ HTMLStyleSheetImpl::ConstructTableCellFrame(nsIPresContext* aPresContext,
|
||||||
nsresult
|
nsresult
|
||||||
HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
nsIContent* aDocElement,
|
nsIContent* aDocElement,
|
||||||
nsIFrame* aRootFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsIStyleContext* aRootStyleContext,
|
nsIStyleContext* aParentStyleContext,
|
||||||
nsIFrame*& aNewFrame)
|
nsIFrame*& aNewFrame)
|
||||||
{
|
{
|
||||||
|
// Resolve the style context for the document element
|
||||||
|
nsIStyleContext* styleContext;
|
||||||
|
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aParentStyleContext);
|
||||||
|
|
||||||
// See if we're paginated
|
// See if we're paginated
|
||||||
if (aPresContext->IsPaginated()) {
|
if (aPresContext->IsPaginated()) {
|
||||||
nsIFrame* pageSequenceFrame;
|
|
||||||
|
|
||||||
// Create a page sequence frame
|
|
||||||
NS_NewSimplePageSequenceFrame(pageSequenceFrame);
|
|
||||||
pageSequenceFrame->Init(*aPresContext, nsnull, aRootFrame, aRootStyleContext);
|
|
||||||
|
|
||||||
// Create the first page
|
|
||||||
nsIFrame* pageFrame;
|
|
||||||
NS_NewPageFrame(pageFrame);
|
|
||||||
|
|
||||||
// Initialize the page and force it to have a view. This makes printing of
|
|
||||||
// the pages easier and faster.
|
|
||||||
// XXX Use a PAGE style context...
|
|
||||||
pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, aRootStyleContext);
|
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame,
|
|
||||||
aRootStyleContext, PR_TRUE);
|
|
||||||
|
|
||||||
// Resolve the style context for the document element
|
|
||||||
nsIStyleContext* styleContext;
|
|
||||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aRootStyleContext);
|
|
||||||
|
|
||||||
// Create an area frame for the document element
|
// Create an area frame for the document element
|
||||||
nsIFrame* areaFrame;
|
nsIFrame* areaFrame;
|
||||||
|
|
||||||
NS_NewAreaFrame(areaFrame, 0);
|
NS_NewAreaFrame(areaFrame, 0);
|
||||||
areaFrame->Init(*aPresContext, aDocElement, pageFrame, styleContext);
|
areaFrame->Init(*aPresContext, aDocElement, aParentFrame, styleContext);
|
||||||
NS_RELEASE(styleContext);
|
|
||||||
|
|
||||||
// The area frame is the "initial containing block"
|
// The area frame is the "initial containing block"
|
||||||
mInitialContainingBlock = areaFrame;
|
mInitialContainingBlock = areaFrame;
|
||||||
|
@ -1547,17 +1529,11 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
areaFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
|
areaFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
|
||||||
absoluteItems.childList);
|
absoluteItems.childList);
|
||||||
}
|
}
|
||||||
pageFrame->SetInitialChildList(*aPresContext, nsnull, areaFrame);
|
|
||||||
pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, pageFrame);
|
|
||||||
|
|
||||||
// Return the page sequence frame as the frame sub-tree
|
// Return the area frame
|
||||||
aNewFrame = pageSequenceFrame;
|
aNewFrame = areaFrame;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Resolve the style context for the document element
|
|
||||||
nsIStyleContext* styleContext;
|
|
||||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, aRootStyleContext);
|
|
||||||
|
|
||||||
// Unless the 'overflow' policy forbids scrolling, wrap the frame in a
|
// Unless the 'overflow' policy forbids scrolling, wrap the frame in a
|
||||||
// scroll frame.
|
// scroll frame.
|
||||||
nsIFrame* scrollFrame = nsnull;
|
nsIFrame* scrollFrame = nsnull;
|
||||||
|
@ -1567,7 +1543,7 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
if (IsScrollable(aPresContext, display)) {
|
if (IsScrollable(aPresContext, display)) {
|
||||||
NS_NewScrollFrame(scrollFrame);
|
NS_NewScrollFrame(scrollFrame);
|
||||||
scrollFrame->Init(*aPresContext, aDocElement, aRootFrame, styleContext);
|
scrollFrame->Init(*aPresContext, aDocElement, aParentFrame, styleContext);
|
||||||
|
|
||||||
// The scrolled frame gets a pseudo element style context
|
// The scrolled frame gets a pseudo element style context
|
||||||
nsIStyleContext* scrolledPseudoStyle =
|
nsIStyleContext* scrolledPseudoStyle =
|
||||||
|
@ -1585,11 +1561,10 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
// XXX Until we clean up how painting damage is handled, we need to use the
|
// XXX Until we clean up how painting damage is handled, we need to use the
|
||||||
// flag that says that this is the body...
|
// flag that says that this is the body...
|
||||||
NS_NewAreaFrame(areaFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
NS_NewAreaFrame(areaFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
||||||
nsIFrame* parentFrame = scrollFrame ? scrollFrame : aRootFrame;
|
areaFrame->Init(*aPresContext, aDocElement, scrollFrame ? scrollFrame :
|
||||||
areaFrame->Init(*aPresContext, aDocElement, parentFrame, styleContext);
|
aParentFrame, styleContext);
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, areaFrame,
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, areaFrame,
|
||||||
styleContext, PR_FALSE);
|
styleContext, PR_FALSE);
|
||||||
NS_RELEASE(styleContext);
|
|
||||||
|
|
||||||
// The area frame is the "initial containing block"
|
// The area frame is the "initial containing block"
|
||||||
mInitialContainingBlock = areaFrame;
|
mInitialContainingBlock = areaFrame;
|
||||||
|
@ -1613,6 +1588,7 @@ HTMLStyleSheetImpl::ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||||
aNewFrame = scrollFrame ? scrollFrame : areaFrame;
|
aNewFrame = scrollFrame ? scrollFrame : areaFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_RELEASE(styleContext);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1688,36 +1664,77 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
||||||
scrollFrame->Init(*aPresContext, nsnull, viewportFrame, rootPseudoStyle);
|
scrollFrame->Init(*aPresContext, nsnull, viewportFrame, rootPseudoStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the root frame. The document element's frame is a child of the
|
if (aPresContext->IsPaginated()) {
|
||||||
// root frame.
|
nsIFrame* pageSequenceFrame;
|
||||||
//
|
|
||||||
// Note: the major reason we need the root frame is to implement margins for
|
|
||||||
// the document element's frame. If we didn't need to support margins on the
|
|
||||||
// document element's frame, then we could eliminate the root frame and make
|
|
||||||
// the document element frame a child of the viewport (or its scroll frame)
|
|
||||||
nsIFrame* rootFrame;
|
|
||||||
NS_NewRootFrame(rootFrame);
|
|
||||||
|
|
||||||
rootFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
// Create a page sequence frame
|
||||||
viewportFrame, rootPseudoStyle);
|
NS_NewSimplePageSequenceFrame(pageSequenceFrame);
|
||||||
if (isScrollable) {
|
pageSequenceFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, rootFrame,
|
viewportFrame, rootPseudoStyle);
|
||||||
|
if (isScrollable) {
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageSequenceFrame,
|
||||||
|
rootPseudoStyle, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the first page
|
||||||
|
nsIFrame* pageFrame;
|
||||||
|
NS_NewPageFrame(pageFrame);
|
||||||
|
|
||||||
|
// Initialize the page and force it to have a view. This makes printing of
|
||||||
|
// the pages easier and faster.
|
||||||
|
// XXX Use a PAGE style context...
|
||||||
|
pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, rootPseudoStyle);
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame,
|
||||||
rootPseudoStyle, PR_TRUE);
|
rootPseudoStyle, PR_TRUE);
|
||||||
}
|
|
||||||
|
|
||||||
// Create frames for the document element and its child elements
|
// Create frames for the document element and its child elements
|
||||||
nsIFrame* docElementFrame;
|
nsIFrame* docElementFrame;
|
||||||
ConstructDocElementFrame(aPresContext, aDocElement, rootFrame,
|
ConstructDocElementFrame(aPresContext, aDocElement, pageFrame,
|
||||||
rootPseudoStyle, docElementFrame);
|
rootPseudoStyle, docElementFrame);
|
||||||
NS_RELEASE(rootPseudoStyle);
|
NS_RELEASE(rootPseudoStyle);
|
||||||
|
|
||||||
// Set the initial child lists
|
// Set the initial child lists
|
||||||
rootFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
pageFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
||||||
if (isScrollable) {
|
pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, pageFrame);
|
||||||
scrollFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
if (isScrollable) {
|
||||||
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
scrollFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
||||||
|
} else {
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
viewportFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
// Create the root frame. The document element's frame is a child of the
|
||||||
|
// root frame.
|
||||||
|
//
|
||||||
|
// Note: the major reason we need the root frame is to implement margins for
|
||||||
|
// the document element's frame. If we didn't need to support margins on the
|
||||||
|
// document element's frame, then we could eliminate the root frame and make
|
||||||
|
// the document element frame a child of the viewport (or its scroll frame)
|
||||||
|
nsIFrame* rootFrame;
|
||||||
|
NS_NewRootFrame(rootFrame);
|
||||||
|
|
||||||
|
rootFrame->Init(*aPresContext, nsnull, isScrollable ? scrollFrame :
|
||||||
|
viewportFrame, rootPseudoStyle);
|
||||||
|
if (isScrollable) {
|
||||||
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, rootFrame,
|
||||||
|
rootPseudoStyle, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create frames for the document element and its child elements
|
||||||
|
nsIFrame* docElementFrame;
|
||||||
|
ConstructDocElementFrame(aPresContext, aDocElement, rootFrame,
|
||||||
|
rootPseudoStyle, docElementFrame);
|
||||||
|
NS_RELEASE(rootPseudoStyle);
|
||||||
|
|
||||||
|
// Set the initial child lists
|
||||||
|
rootFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
|
||||||
|
if (isScrollable) {
|
||||||
|
scrollFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame);
|
||||||
|
} else {
|
||||||
|
viewportFrame->SetInitialChildList(*aPresContext, nsnull, rootFrame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aNewFrame = viewportFrame;
|
aNewFrame = viewportFrame;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче