inline IsPaginated, SetPaginatedScrolling, and GetPaginatedScrolling. Bug 229371, r+sr=roc.

This commit is contained in:
bryner%brianryner.com 2004-03-03 18:24:20 +00:00
parent bc10ea8a9c
commit ab4ac54b6f
43 changed files with 91 additions and 238 deletions

View File

@ -821,9 +821,7 @@ AdjustAbsoluteContainingBlock(nsIPresContext* aPresContext,
nsIFrame* aContainingBlockIn)
{
nsIFrame* containingBlock = aContainingBlockIn;
PRBool paginated;
aPresContext->IsPaginated(&paginated);
if (!paginated) {
if (!aPresContext->IsPaginated()) {
if (nsLayoutAtoms::positionedInlineFrame == containingBlock->GetType()) {
containingBlock = ((nsPositionedInlineFrame*)containingBlock)->GetFirstInFlow();
}
@ -3059,10 +3057,8 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
case NS_STYLE_DISPLAY_TABLE:
{
PRBool pageBreakAfter = PR_FALSE;
PRBool paginated;
aPresContext->IsPaginated(&paginated);
if (paginated) {
if (aPresContext->IsPaginated()) {
// See if there is a page break before, if so construct one. Also see if there is one after
pageBreakAfter = PageBreakBefore(aPresShell, aPresContext, aState, aChildContent,
aParentFrame, childStyleContext, aChildItems);
@ -3309,14 +3305,12 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
PRBool isScrollable = IsScrollable(aPresContext, display);
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
nsCOMPtr<nsIPrintPreviewContext> printPreviewContext(do_QueryInterface(aPresContext));
nsIFrame* scrollFrame = nsnull;
// build a scrollframe
if ((!isPaginated || (isPaginated && printPreviewContext)) && isScrollable) {
if ((!aPresContext->IsPaginated() || printPreviewContext) && isScrollable) {
nsIFrame* newScrollFrame = nsnull;
nsRefPtr<nsStyleContext> newContext;
@ -3566,8 +3560,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
// - renders the document element's background. This ensures the background covers
// the entire canvas as specified by the CSS2 spec
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
nsCOMPtr<nsIPrintPreviewContext> printPreviewContext(do_QueryInterface(aPresContext));
nsIFrame* rootFrame = nsnull;
@ -3649,7 +3642,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
if (isPaginated) {
if (printPreviewContext) { // print preview
aPresContext->GetPaginatedScrolling(&isScrollable);
isScrollable = aPresContext->HasPaginatedScrolling();
} else {
isScrollable = PR_FALSE; // we are printing
}
@ -3808,7 +3801,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
rootFrame->Init(aPresContext, aDocElement, parentFrame,
rootPseudoStyle, nsnull);
if (!isPaginated || (isPaginated && printPreviewContext)) {
if (!isPaginated || printPreviewContext) {
if (isScrollable) {
FinishBuildingScrollFrame(aPresContext,
state,
@ -6943,10 +6936,8 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
aContent->GetNameSpaceID(&nameSpaceID);
PRBool pageBreakAfter = PR_FALSE;
PRBool paginated;
aPresContext->IsPaginated(&paginated);
if (paginated) {
if (aPresContext->IsPaginated()) {
// See if there is a page break before, if so construct one. Also see if there is one after
pageBreakAfter = PageBreakBefore(aPresShell, aPresContext, aState, aContent,
aParentFrame, styleContext, aFrameItems);

View File

@ -3005,9 +3005,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
aPresContext->PresShell()->GetRootFrame(&rootFrame);
NS_ASSERTION(rootFrame, "no root frame");
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
nsIFrame* page = nsLayoutUtils::GetPageFrame(aForFrame);
NS_ASSERTION(page, "no page");
rootFrame = page;

View File

@ -296,19 +296,19 @@ public:
* Return true if this presentation context is a paginated
* context.
*/
NS_IMETHOD IsPaginated(PRBool* aResult) = 0;
PRBool IsPaginated() const { return mPaginated; }
/**
* Sets whether the presentation context can scroll for a paginated
* context.
*/
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) = 0;
virtual void SetPaginatedScrolling(PRBool aResult) = 0;
/**
* Return true if this presentation context can scroll for paginated
* context.
*/
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult) = 0;
PRBool HasPaginatedScrolling() const { return mCanPaginatedScroll; }
/**
* Gets the rect for the page dimensions,
@ -555,6 +555,8 @@ protected:
unsigned mNeverAnimate : 1;
unsigned mIsRenderingOnlySelection : 1;
unsigned mNoTheme : 1;
unsigned mPaginated : 1;
unsigned mCanPaginatedScroll : 1;
#ifdef IBMBIDI
unsigned mIsVisual : 1;
unsigned mIsBidiSystem : 1;

View File

@ -2862,9 +2862,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
}
// For printing, we just immediately unsuppress.
PRBool isPaginated = PR_FALSE;
mPresContext->IsPaginated(&isPaginated);
if (!isPaginated) {
if (!mPresContext->IsPaginated()) {
// Kick off a one-shot timer based off our pref value. When this timer
// fires, if painting is still locked down, then we will go ahead and
// trigger a full invalidate and allow painting to proceed normally.
@ -6944,9 +6942,7 @@ PresShell::VerifyIncrementalReflow()
// Create a presentation context to view the new frame tree
nsresult rv;
PRBool isPaginated = PR_FALSE;
mPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (mPresContext->IsPaginated()) {
nsCOMPtr<nsIPrintPreviewContext> ppx = do_CreateInstance(kPrintPreviewContextCID, &rv);
if (NS_SUCCEEDED(rv)) {
ppx->QueryInterface(NS_GET_IID(nsIPresContext),(void**)&cx);

View File

@ -296,19 +296,19 @@ public:
* Return true if this presentation context is a paginated
* context.
*/
NS_IMETHOD IsPaginated(PRBool* aResult) = 0;
PRBool IsPaginated() const { return mPaginated; }
/**
* Sets whether the presentation context can scroll for a paginated
* context.
*/
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) = 0;
virtual void SetPaginatedScrolling(PRBool aResult) = 0;
/**
* Return true if this presentation context can scroll for paginated
* context.
*/
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult) = 0;
PRBool HasPaginatedScrolling() const { return mCanPaginatedScroll; }
/**
* Gets the rect for the page dimensions,
@ -555,6 +555,8 @@ protected:
unsigned mNeverAnimate : 1;
unsigned mIsRenderingOnlySelection : 1;
unsigned mNoTheme : 1;
unsigned mPaginated : 1;
unsigned mCanPaginatedScroll : 1;
#ifdef IBMBIDI
unsigned mIsVisual : 1;
unsigned mIsBidiSystem : 1;

View File

@ -296,19 +296,19 @@ public:
* Return true if this presentation context is a paginated
* context.
*/
NS_IMETHOD IsPaginated(PRBool* aResult) = 0;
PRBool IsPaginated() const { return mPaginated; }
/**
* Sets whether the presentation context can scroll for a paginated
* context.
*/
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) = 0;
virtual void SetPaginatedScrolling(PRBool aResult) = 0;
/**
* Return true if this presentation context can scroll for paginated
* context.
*/
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult) = 0;
PRBool HasPaginatedScrolling() const { return mCanPaginatedScroll; }
/**
* Gets the rect for the page dimensions,
@ -555,6 +555,8 @@ protected:
unsigned mNeverAnimate : 1;
unsigned mIsRenderingOnlySelection : 1;
unsigned mNoTheme : 1;
unsigned mPaginated : 1;
unsigned mCanPaginatedScroll : 1;
#ifdef IBMBIDI
unsigned mIsVisual : 1;
unsigned mIsBidiSystem : 1;

View File

@ -44,9 +44,7 @@ public:
GalleyContext();
~GalleyContext();
NS_IMETHOD IsPaginated(PRBool* aResult);
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { return NS_ERROR_FAILURE; }
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
virtual void SetPaginatedScrolling(PRBool aResult) {}
virtual void GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
virtual void SetPageDim(nsRect* aRect);
};
@ -60,25 +58,6 @@ GalleyContext::~GalleyContext()
{
}
NS_IMETHODIMP
GalleyContext::IsPaginated(PRBool* aResult)
{
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
GalleyContext::GetPaginatedScrolling(PRBool* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_FALSE;
return NS_OK;
}
void
GalleyContext::GetPageDim(nsRect* aActualRect, nsRect* aAdjRect)
{

View File

@ -86,9 +86,6 @@ public:
virtual void StopImagesFor(nsIFrame* aTargetFrame);
virtual void SetContainer(nsISupports* aContainer);
virtual already_AddRefed<nsISupports> GetContainer();
NS_IMETHOD IsPaginated(PRBool* aResult) = 0;
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) = 0;
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult) = 0;
virtual void GetPageDim(nsRect* aActualRect, nsRect* aAdjRect) = 0;
virtual void SetPageDim(nsRect* aRect) = 0;
NS_IMETHOD GetTwipsToPixelsForFonts(float* aResult) const;

View File

@ -59,9 +59,7 @@ public:
PrintContext();
~PrintContext();
NS_IMETHOD IsPaginated(PRBool* aResult);
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { return NS_ERROR_FAILURE; }
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
virtual void SetPaginatedScrolling(PRBool aResult) {}
virtual void GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
virtual void SetPageDim(nsRect* aRect);
virtual void SetImageAnimationMode(PRUint16 aMode);
@ -82,6 +80,7 @@ PrintContext::PrintContext() :
mImageAnimationMode = imgIContainer::kDontAnimMode;
mNeverAnimate = PR_TRUE;
mMedium = nsLayoutAtoms::print;
mPaginated = PR_TRUE;
}
PrintContext::~PrintContext()
@ -107,22 +106,6 @@ PrintContext::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return nsPresContext::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP
PrintContext::IsPaginated(PRBool* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
PrintContext::GetPaginatedScrolling(PRBool* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_FALSE;
return NS_OK;
}
void
PrintContext::GetPageDim(nsRect* aActualRect, nsRect* aAdjRect)
{

View File

@ -56,9 +56,11 @@ public:
// another class. Only the base class should use NS_DECL_ISUPPORTS
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD IsPaginated(PRBool* aResult);
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { mCanPaginatedScroll = aResult; return NS_OK; }
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
virtual void SetPaginatedScrolling(PRBool aResult)
{
mCanPaginatedScroll = aResult;
}
virtual void GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
virtual void SetPageDim(nsRect* aRect);
virtual void SetImageAnimationMode(PRUint16 aMode);
@ -69,14 +71,12 @@ public:
protected:
nsRect mPageDim;
PRBool mCanPaginatedScroll;
nsCOMPtr<nsIPrintSettings> mPrintSettings;
PRPackedBool mDoScaledTwips;
};
PrintPreviewContext::PrintPreviewContext() :
mPageDim(-1,-1,-1,-1),
mCanPaginatedScroll(PR_TRUE),
mDoScaledTwips(PR_TRUE)
{
SetBackgroundImageDraw(PR_FALSE);
@ -85,6 +85,8 @@ PrintPreviewContext::PrintPreviewContext() :
mImageAnimationMode = imgIContainer::kDontAnimMode;
mNeverAnimate = PR_TRUE;
mMedium = nsLayoutAtoms::print;
mPaginated = PR_TRUE;
mCanPaginatedScroll = PR_TRUE;
}
PrintPreviewContext::~PrintPreviewContext()
@ -108,22 +110,6 @@ PrintPreviewContext::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return nsPresContext::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP
PrintPreviewContext::IsPaginated(PRBool* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
PrintPreviewContext::GetPaginatedScrolling(PRBool* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mCanPaginatedScroll;
return NS_OK;
}
void
PrintPreviewContext::GetPageDim(nsRect* aActualRect, nsRect* aAdjRect)
{

View File

@ -1943,9 +1943,7 @@ nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
{
NS_ENSURE_ARG_POINTER(aEventStatus);
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}

View File

@ -387,9 +387,7 @@ nsGfxButtonControlFrame::HandleEvent(nsIPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}
// Override the HandleEvent to prevent the nsFrame::HandleEvent

View File

@ -527,9 +527,7 @@ nsListControlFrame::Paint(nsIPresContext* aPresContext,
// Start by assuming we are visible and need to be painted
PRBool isVisible = PR_TRUE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
if (aPresContext->IsRenderingOnlySelection()) {
// Check the quick way first
PRBool isSelected = (mState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
@ -1713,9 +1711,7 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext,
{
NS_ENSURE_ARG_POINTER(aEventStatus);
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}

View File

@ -1208,7 +1208,7 @@ SuppressEventHandlers(nsIPresContext* aPresContext)
// In the current implementation, we only paginate when
// printing or in print preview.
aPresContext->IsPaginated(&suppressHandlers);
suppressHandlers = aPresContext->IsPaginated();
#endif
}
@ -3126,9 +3126,7 @@ nsTextControlFrame::HandleEvent(nsIPresContext* aPresContext,
NS_ENSURE_ARG_POINTER(aEventStatus);
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}

View File

@ -2776,12 +2776,11 @@ nsresult
nsFrame::GetSelectionForVisCheck(nsIPresContext * aPresContext, nsISelection** aSelection)
{
*aSelection = nsnull;
nsresult rv = NS_OK;
// start by checking to see if we are paginated which probably means
// we are in print preview or printing
PRBool isPaginated;
nsresult rv = aPresContext->IsPaginated(&isPaginated);
if (NS_SUCCEEDED(rv) && isPaginated) {
if (aPresContext->IsPaginated()) {
// now see if we are rendering selection only
if (aPresContext->IsRenderingOnlySelection()) {
// Check the quick way first (typically only leaf nodes)

View File

@ -402,9 +402,7 @@ nsSubDocumentFrame::Reflow(nsIPresContext* aPresContext,
}
}
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
if (!isPaginated) {
if (!aPresContext->IsPaginated()) {
nsCOMPtr<nsIDocShell> docShell;
GetDocShell(getter_AddRefs(docShell));

View File

@ -342,9 +342,7 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
{
// Don't create scrollbars if we're printing/print previewing
// Get rid of this code when printing moves to its own presentation
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
// allow scrollbars if this is the child of the viewport, because
// we must be the scrollbars for the print preview window
nsIFrame* parent = GetParent();

View File

@ -880,8 +880,6 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
// we have to split images if we are:
// in Paginated mode, we need to have a constrained height, and have a height larger than our available height
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRUint32 loadStatus = imgIRequest::STATUS_NONE;
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
NS_ASSERTION(imageLoader, "No content node??");
@ -893,7 +891,7 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
currentRequest->GetImageStatus(&loadStatus);
}
}
if (isPaginated &&
if (aPresContext->IsPaginated() &&
((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) &&
NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight &&
aMetrics.height > aReflowState.availableHeight) {

View File

@ -755,9 +755,7 @@ NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
//check that we are only creating page break frames when printing
nsCOMPtr<nsIPresContext> presContext;
aPresShell->GetPresContext(getter_AddRefs(presContext));
PRBool isPaginated;
presContext->IsPaginated(&isPaginated);
NS_ASSERTION(isPaginated, "created a page break frame while not printing");
NS_ASSERTION(presContext->IsPaginated(), "created a page break frame while not printing");
#endif
nsPageBreakFrame* it = new (aPresShell) nsPageBreakFrame;

View File

@ -2011,11 +2011,11 @@ nsresult nsTextFrame::GetTextInfoForPainting(nsIPresContext* aPresConte
if (NS_FAILED(rv) || !(*aSelectionController))
return NS_ERROR_FAILURE;
aPresContext->IsPaginated(&aIsPaginated);
aIsPaginated = aPresContext->IsPaginated();
(*aSelectionController)->GetDisplaySelection(&aSelectionValue);
if(aIsPaginated){
if (aIsPaginated) {
aDisplayingSelection = aPresContext->IsRenderingOnlySelection();
} else {
//if greater than hidden then we display some kind of selection
@ -2156,9 +2156,7 @@ nsTextFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
// Start by assuming we are visible and need to be painted
PRBool isVisible = PR_TRUE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
if (aPresContext->IsRenderingOnlySelection()) {
// Check the quick way first
PRBool isSelected = (mState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;

View File

@ -2776,12 +2776,11 @@ nsresult
nsFrame::GetSelectionForVisCheck(nsIPresContext * aPresContext, nsISelection** aSelection)
{
*aSelection = nsnull;
nsresult rv = NS_OK;
// start by checking to see if we are paginated which probably means
// we are in print preview or printing
PRBool isPaginated;
nsresult rv = aPresContext->IsPaginated(&isPaginated);
if (NS_SUCCEEDED(rv) && isPaginated) {
if (aPresContext->IsPaginated()) {
// now see if we are rendering selection only
if (aPresContext->IsRenderingOnlySelection()) {
// Check the quick way first (typically only leaf nodes)

View File

@ -342,9 +342,7 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
{
// Don't create scrollbars if we're printing/print previewing
// Get rid of this code when printing moves to its own presentation
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
// allow scrollbars if this is the child of the viewport, because
// we must be the scrollbars for the print preview window
nsIFrame* parent = GetParent();

View File

@ -880,8 +880,6 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
// we have to split images if we are:
// in Paginated mode, we need to have a constrained height, and have a height larger than our available height
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRUint32 loadStatus = imgIRequest::STATUS_NONE;
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
NS_ASSERTION(imageLoader, "No content node??");
@ -893,7 +891,7 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
currentRequest->GetImageStatus(&loadStatus);
}
}
if (isPaginated &&
if (aPresContext->IsPaginated() &&
((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) &&
NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight &&
aMetrics.height > aReflowState.availableHeight) {

View File

@ -755,9 +755,7 @@ NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
//check that we are only creating page break frames when printing
nsCOMPtr<nsIPresContext> presContext;
aPresShell->GetPresContext(getter_AddRefs(presContext));
PRBool isPaginated;
presContext->IsPaginated(&isPaginated);
NS_ASSERTION(isPaginated, "created a page break frame while not printing");
NS_ASSERTION(presContext->IsPaginated(), "created a page break frame while not printing");
#endif
nsPageBreakFrame* it = new (aPresShell) nsPageBreakFrame;

View File

@ -2862,9 +2862,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
}
// For printing, we just immediately unsuppress.
PRBool isPaginated = PR_FALSE;
mPresContext->IsPaginated(&isPaginated);
if (!isPaginated) {
if (!mPresContext->IsPaginated()) {
// Kick off a one-shot timer based off our pref value. When this timer
// fires, if painting is still locked down, then we will go ahead and
// trigger a full invalidate and allow painting to proceed normally.
@ -6944,9 +6942,7 @@ PresShell::VerifyIncrementalReflow()
// Create a presentation context to view the new frame tree
nsresult rv;
PRBool isPaginated = PR_FALSE;
mPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (mPresContext->IsPaginated()) {
nsCOMPtr<nsIPrintPreviewContext> ppx = do_CreateInstance(kPrintPreviewContextCID, &rv);
if (NS_SUCCEEDED(rv)) {
ppx->QueryInterface(NS_GET_IID(nsIPresContext),(void**)&cx);

View File

@ -2011,11 +2011,11 @@ nsresult nsTextFrame::GetTextInfoForPainting(nsIPresContext* aPresConte
if (NS_FAILED(rv) || !(*aSelectionController))
return NS_ERROR_FAILURE;
aPresContext->IsPaginated(&aIsPaginated);
aIsPaginated = aPresContext->IsPaginated();
(*aSelectionController)->GetDisplaySelection(&aSelectionValue);
if(aIsPaginated){
if (aIsPaginated) {
aDisplayingSelection = aPresContext->IsRenderingOnlySelection();
} else {
//if greater than hidden then we display some kind of selection
@ -2156,9 +2156,7 @@ nsTextFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
// Start by assuming we are visible and need to be painted
PRBool isVisible = PR_TRUE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
if (aPresContext->IsRenderingOnlySelection()) {
// Check the quick way first
PRBool isSelected = (mState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;

View File

@ -402,9 +402,7 @@ nsSubDocumentFrame::Reflow(nsIPresContext* aPresContext,
}
}
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
if (!isPaginated) {
if (!aPresContext->IsPaginated()) {
nsCOMPtr<nsIDocShell> docShell;
GetDocShell(getter_AddRefs(docShell));

View File

@ -1943,9 +1943,7 @@ nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
{
NS_ENSURE_ARG_POINTER(aEventStatus);
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}

View File

@ -387,9 +387,7 @@ nsGfxButtonControlFrame::HandleEvent(nsIPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}
// Override the HandleEvent to prevent the nsFrame::HandleEvent

View File

@ -527,9 +527,7 @@ nsListControlFrame::Paint(nsIPresContext* aPresContext,
// Start by assuming we are visible and need to be painted
PRBool isVisible = PR_TRUE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
if (aPresContext->IsRenderingOnlySelection()) {
// Check the quick way first
PRBool isSelected = (mState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
@ -1713,9 +1711,7 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext,
{
NS_ENSURE_ARG_POINTER(aEventStatus);
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}

View File

@ -1208,7 +1208,7 @@ SuppressEventHandlers(nsIPresContext* aPresContext)
// In the current implementation, we only paginate when
// printing or in print preview.
aPresContext->IsPaginated(&suppressHandlers);
suppressHandlers = aPresContext->IsPaginated();
#endif
}
@ -3126,9 +3126,7 @@ nsTextControlFrame::HandleEvent(nsIPresContext* aPresContext,
NS_ENSURE_ARG_POINTER(aEventStatus);
// temp fix until Bug 124990 gets fixed
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) {
if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
return NS_OK;
}

View File

@ -821,9 +821,7 @@ AdjustAbsoluteContainingBlock(nsIPresContext* aPresContext,
nsIFrame* aContainingBlockIn)
{
nsIFrame* containingBlock = aContainingBlockIn;
PRBool paginated;
aPresContext->IsPaginated(&paginated);
if (!paginated) {
if (!aPresContext->IsPaginated()) {
if (nsLayoutAtoms::positionedInlineFrame == containingBlock->GetType()) {
containingBlock = ((nsPositionedInlineFrame*)containingBlock)->GetFirstInFlow();
}
@ -3059,10 +3057,8 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
case NS_STYLE_DISPLAY_TABLE:
{
PRBool pageBreakAfter = PR_FALSE;
PRBool paginated;
aPresContext->IsPaginated(&paginated);
if (paginated) {
if (aPresContext->IsPaginated()) {
// See if there is a page break before, if so construct one. Also see if there is one after
pageBreakAfter = PageBreakBefore(aPresShell, aPresContext, aState, aChildContent,
aParentFrame, childStyleContext, aChildItems);
@ -3309,14 +3305,12 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
PRBool isScrollable = IsScrollable(aPresContext, display);
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
nsCOMPtr<nsIPrintPreviewContext> printPreviewContext(do_QueryInterface(aPresContext));
nsIFrame* scrollFrame = nsnull;
// build a scrollframe
if ((!isPaginated || (isPaginated && printPreviewContext)) && isScrollable) {
if ((!aPresContext->IsPaginated() || printPreviewContext) && isScrollable) {
nsIFrame* newScrollFrame = nsnull;
nsRefPtr<nsStyleContext> newContext;
@ -3566,8 +3560,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
// - renders the document element's background. This ensures the background covers
// the entire canvas as specified by the CSS2 spec
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
nsCOMPtr<nsIPrintPreviewContext> printPreviewContext(do_QueryInterface(aPresContext));
nsIFrame* rootFrame = nsnull;
@ -3649,7 +3642,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
if (isPaginated) {
if (printPreviewContext) { // print preview
aPresContext->GetPaginatedScrolling(&isScrollable);
isScrollable = aPresContext->HasPaginatedScrolling();
} else {
isScrollable = PR_FALSE; // we are printing
}
@ -3808,7 +3801,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
rootFrame->Init(aPresContext, aDocElement, parentFrame,
rootPseudoStyle, nsnull);
if (!isPaginated || (isPaginated && printPreviewContext)) {
if (!isPaginated || printPreviewContext) {
if (isScrollable) {
FinishBuildingScrollFrame(aPresContext,
state,
@ -6943,10 +6936,8 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
aContent->GetNameSpaceID(&nameSpaceID);
PRBool pageBreakAfter = PR_FALSE;
PRBool paginated;
aPresContext->IsPaginated(&paginated);
if (paginated) {
if (aPresContext->IsPaginated()) {
// See if there is a page break before, if so construct one. Also see if there is one after
pageBreakAfter = PageBreakBefore(aPresShell, aPresContext, aState, aContent,
aParentFrame, styleContext, aFrameItems);

View File

@ -3005,9 +3005,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
aPresContext->PresShell()->GetRootFrame(&rootFrame);
NS_ASSERTION(rootFrame, "no root frame");
PRBool isPaginated = PR_FALSE;
aPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
if (aPresContext->IsPaginated()) {
nsIFrame* page = nsLayoutUtils::GetPageFrame(aForFrame);
NS_ASSERTION(page, "no page");
rootFrame = page;

View File

@ -836,8 +836,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
SetPriorAvailWidth(aReflowState.availableWidth);
nsIFrame* firstKid = mFrames.FirstChild();
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
nscoord computedPaginatedHeight = 0;
if (aReflowState.mFlags.mSpecialHeightReflow ||
@ -845,7 +843,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;
DISPLAY_REFLOW_CHANGE();
}
else if (isPaginated) {
else if (aPresContext->IsPaginated()) {
computedPaginatedHeight = CalcUnpaginagedHeight(aPresContext, (nsTableCellFrame&)*this, *tableFrame, topInset + bottomInset);
if (computedPaginatedHeight > 0) {
((nsHTMLReflowState&)aReflowState).mComputedHeight = computedPaginatedHeight;

View File

@ -1856,8 +1856,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
// If this is a special height reflow, set our desired size to what is was previously and return
// if we will be getting another special height reflow. In paginated mode, SetNeedSpecialReflow(PR_TRUE)
@ -2118,9 +2117,6 @@ nsTableFrame::ReflowTable(nsIPresContext* aPresContext,
aDidBalance = PR_FALSE;
aLastChildReflowed = nsnull;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool haveReflowedColGroups = PR_TRUE;
if (!mPrevInFlow) {
if (NeedStrategyInit()) {
@ -3156,8 +3152,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
nscoord cellSpacingY = GetCellSpacingY();
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
aOverflowArea = nsRect (0, 0, 0, 0);

View File

@ -1925,13 +1925,11 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
}
aStatus = NS_FRAME_COMPLETE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool needUpdateMetrics = PR_TRUE;
if ((eReflowReason_Resize == aOuterRS.reason) &&
(aOuterRS.availableWidth == mPriorAvailWidth) &&
!isPaginated &&
!aPresContext->IsPaginated() &&
!::IsPctHeight(mInnerTableFrame)) {
// don't do much if we are resize reflowed exactly like last time
aDesiredSize.width = mRect.width;

View File

@ -796,8 +796,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
nsIFrame* tablePrevInFlow;
aTableFrame.GetPrevInFlow(&tablePrevInFlow);
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
nsresult rv = NS_OK;

View File

@ -345,8 +345,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext,
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
if (aFirstRowReflowed) {
*aFirstRowReflowed = nsnull;
@ -564,8 +563,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext,
nsTableFrame::GetTableFrame(this, tableFrame);
if (!aPresContext || !tableFrame) return;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
// all table cells have the same top and bottom margins, namely cellSpacingY
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
@ -1244,8 +1242,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
aStatus = NS_FRAME_COMPLETE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
nsTableFrame* tableFrame = nsnull;
rv = nsTableFrame::GetTableFrame(this, tableFrame);

View File

@ -836,8 +836,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
SetPriorAvailWidth(aReflowState.availableWidth);
nsIFrame* firstKid = mFrames.FirstChild();
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
nscoord computedPaginatedHeight = 0;
if (aReflowState.mFlags.mSpecialHeightReflow ||
@ -845,7 +843,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;
DISPLAY_REFLOW_CHANGE();
}
else if (isPaginated) {
else if (aPresContext->IsPaginated()) {
computedPaginatedHeight = CalcUnpaginagedHeight(aPresContext, (nsTableCellFrame&)*this, *tableFrame, topInset + bottomInset);
if (computedPaginatedHeight > 0) {
((nsHTMLReflowState&)aReflowState).mComputedHeight = computedPaginatedHeight;

View File

@ -1856,8 +1856,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
// If this is a special height reflow, set our desired size to what is was previously and return
// if we will be getting another special height reflow. In paginated mode, SetNeedSpecialReflow(PR_TRUE)
@ -2118,9 +2117,6 @@ nsTableFrame::ReflowTable(nsIPresContext* aPresContext,
aDidBalance = PR_FALSE;
aLastChildReflowed = nsnull;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool haveReflowedColGroups = PR_TRUE;
if (!mPrevInFlow) {
if (NeedStrategyInit()) {
@ -3156,8 +3152,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
nscoord cellSpacingY = GetCellSpacingY();
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
aOverflowArea = nsRect (0, 0, 0, 0);

View File

@ -1925,13 +1925,11 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
}
aStatus = NS_FRAME_COMPLETE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool needUpdateMetrics = PR_TRUE;
if ((eReflowReason_Resize == aOuterRS.reason) &&
(aOuterRS.availableWidth == mPriorAvailWidth) &&
!isPaginated &&
!aPresContext->IsPaginated() &&
!::IsPctHeight(mInnerTableFrame)) {
// don't do much if we are resize reflowed exactly like last time
aDesiredSize.width = mRect.width;

View File

@ -796,8 +796,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
nsIFrame* tablePrevInFlow;
aTableFrame.GetPrevInFlow(&tablePrevInFlow);
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
nsresult rv = NS_OK;

View File

@ -345,8 +345,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext,
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
if (aFirstRowReflowed) {
*aFirstRowReflowed = nsnull;
@ -564,8 +563,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext,
nsTableFrame::GetTableFrame(this, tableFrame);
if (!aPresContext || !tableFrame) return;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
// all table cells have the same top and bottom margins, namely cellSpacingY
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
@ -1244,8 +1242,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
aStatus = NS_FRAME_COMPLETE;
PRBool isPaginated;
aPresContext->IsPaginated(&isPaginated);
PRBool isPaginated = aPresContext->IsPaginated();
nsTableFrame* tableFrame = nsnull;
rv = nsTableFrame::GetTableFrame(this, tableFrame);