From e8b6cc2769c7cc399b4ba6139451b256ed249d81 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Fri, 13 Nov 1998 04:22:23 +0000 Subject: [PATCH] Added a scroll frame for print preview git-svn-id: svn://10.0.0.236/trunk@14582 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/style/src/nsHTMLStyleSheet.cpp | 54 ++++++++++--------- .../layout/html/base/src/nsScrollFrame.cpp | 4 +- .../html/style/src/nsHTMLStyleSheet.cpp | 54 ++++++++++--------- mozilla/layout/style/nsHTMLStyleSheet.cpp | 54 ++++++++++--------- 4 files changed, 89 insertions(+), 77 deletions(-) diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp index e12af883a6a..11c6ae76485 100644 --- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp @@ -1162,37 +1162,41 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext, // See if we're paginated if (aPresContext->IsPaginated()) { - // nsScrollFrame* scrollFrame; - nsIFrame* pageSequenceFrame; + nsIFrame* scrollFrame; + nsIFrame* pageSequenceFrame; + + // XXX This isn't the correct style context pseudo element to use... + nsIStyleContext* pseudoStyle; + pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent, + nsHTMLAtoms::columnPseudo, aStyleContext); -#if 0 // Wrap the simple page sequence frame in a scroll frame - // XXX Only do this if it's print oreview - if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aParentFrame, scrollFrame)) { -#endif + // XXX Only do this if it's print preview + if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aNewFrame, scrollFrame)) { + // Set the scroll frame's style context + scrollFrame->SetStyleContext(aPresContext, pseudoStyle); - // Create a simple page sequence frame - rv = NS_NewSimplePageSequenceFrame(aContent, aNewFrame, pageSequenceFrame); - if (NS_SUCCEEDED(rv)) { - nsIFrame* childList; - - // Set the page sequence frame's style context - // XXX This isn't the correct style context to use... - nsIStyleContext* pseudoStyle; - pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent, - nsHTMLAtoms::columnPseudo, - aStyleContext); - pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); - NS_RELEASE(pseudoStyle); - - // Process the child content, and set the page sequence frame's initial - // child list - rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); + // Create a simple page sequence frame + rv = NS_NewSimplePageSequenceFrame(aContent, scrollFrame, pageSequenceFrame); if (NS_SUCCEEDED(rv)) { - pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); + nsIFrame* childList; + // Set the page sequence frame's style context + pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); + NS_RELEASE(pseudoStyle); + + // Process the child content, and set the page sequence frame's initial + // child list + rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); + if (NS_SUCCEEDED(rv)) { + pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); + + // Set the scroll frame's initial child list + scrollFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); + } + // Set the root frame's initial child list - aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame); } } } else { diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index 7340c4b6a22..e7a3284399f 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -165,10 +165,10 @@ nsScrollFrame::CreateScrollingView() nsIScrollableView* scrollingView; view->QueryInterface(kScrollViewIID, (void**)&scrollingView); - //create widgets for scrolling + // Create widgets for scrolling scrollingView->CreateScrollControls(); - // Set the scroll prefrence + // Set the scroll preference nsScrollPreference scrollPref = (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) ? nsScrollPreference_kAlwaysScroll : nsScrollPreference_kAuto; diff --git a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp index e12af883a6a..11c6ae76485 100644 --- a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -1162,37 +1162,41 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext, // See if we're paginated if (aPresContext->IsPaginated()) { - // nsScrollFrame* scrollFrame; - nsIFrame* pageSequenceFrame; + nsIFrame* scrollFrame; + nsIFrame* pageSequenceFrame; + + // XXX This isn't the correct style context pseudo element to use... + nsIStyleContext* pseudoStyle; + pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent, + nsHTMLAtoms::columnPseudo, aStyleContext); -#if 0 // Wrap the simple page sequence frame in a scroll frame - // XXX Only do this if it's print oreview - if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aParentFrame, scrollFrame)) { -#endif + // XXX Only do this if it's print preview + if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aNewFrame, scrollFrame)) { + // Set the scroll frame's style context + scrollFrame->SetStyleContext(aPresContext, pseudoStyle); - // Create a simple page sequence frame - rv = NS_NewSimplePageSequenceFrame(aContent, aNewFrame, pageSequenceFrame); - if (NS_SUCCEEDED(rv)) { - nsIFrame* childList; - - // Set the page sequence frame's style context - // XXX This isn't the correct style context to use... - nsIStyleContext* pseudoStyle; - pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent, - nsHTMLAtoms::columnPseudo, - aStyleContext); - pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); - NS_RELEASE(pseudoStyle); - - // Process the child content, and set the page sequence frame's initial - // child list - rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); + // Create a simple page sequence frame + rv = NS_NewSimplePageSequenceFrame(aContent, scrollFrame, pageSequenceFrame); if (NS_SUCCEEDED(rv)) { - pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); + nsIFrame* childList; + // Set the page sequence frame's style context + pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); + NS_RELEASE(pseudoStyle); + + // Process the child content, and set the page sequence frame's initial + // child list + rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); + if (NS_SUCCEEDED(rv)) { + pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); + + // Set the scroll frame's initial child list + scrollFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); + } + // Set the root frame's initial child list - aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame); } } } else { diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index e12af883a6a..11c6ae76485 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -1162,37 +1162,41 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext, // See if we're paginated if (aPresContext->IsPaginated()) { - // nsScrollFrame* scrollFrame; - nsIFrame* pageSequenceFrame; + nsIFrame* scrollFrame; + nsIFrame* pageSequenceFrame; + + // XXX This isn't the correct style context pseudo element to use... + nsIStyleContext* pseudoStyle; + pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent, + nsHTMLAtoms::columnPseudo, aStyleContext); -#if 0 // Wrap the simple page sequence frame in a scroll frame - // XXX Only do this if it's print oreview - if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aParentFrame, scrollFrame)) { -#endif + // XXX Only do this if it's print preview + if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aNewFrame, scrollFrame)) { + // Set the scroll frame's style context + scrollFrame->SetStyleContext(aPresContext, pseudoStyle); - // Create a simple page sequence frame - rv = NS_NewSimplePageSequenceFrame(aContent, aNewFrame, pageSequenceFrame); - if (NS_SUCCEEDED(rv)) { - nsIFrame* childList; - - // Set the page sequence frame's style context - // XXX This isn't the correct style context to use... - nsIStyleContext* pseudoStyle; - pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent, - nsHTMLAtoms::columnPseudo, - aStyleContext); - pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); - NS_RELEASE(pseudoStyle); - - // Process the child content, and set the page sequence frame's initial - // child list - rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); + // Create a simple page sequence frame + rv = NS_NewSimplePageSequenceFrame(aContent, scrollFrame, pageSequenceFrame); if (NS_SUCCEEDED(rv)) { - pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); + nsIFrame* childList; + // Set the page sequence frame's style context + pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); + NS_RELEASE(pseudoStyle); + + // Process the child content, and set the page sequence frame's initial + // child list + rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); + if (NS_SUCCEEDED(rv)) { + pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); + + // Set the scroll frame's initial child list + scrollFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); + } + // Set the root frame's initial child list - aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, scrollFrame); } } } else {