From 5f9ef1d95e8184e33d727fd85c4dbf00cede021c Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Mon, 30 Jun 2003 18:52:23 +0000 Subject: [PATCH] Ongoing deCOMtamination. r+sr=dbaron --- layout/generic/nsPageContentFrame.cpp | 1 - layout/generic/nsSimplePageSequence.cpp | 79 ++++++++----------- layout/generic/nsSimplePageSequence.h | 4 - layout/generic/nsTextFrame.cpp | 75 ++++++------------ layout/html/base/src/nsPageContentFrame.cpp | 1 - layout/html/base/src/nsSimplePageSequence.cpp | 79 ++++++++----------- layout/html/base/src/nsSimplePageSequence.h | 4 - layout/html/base/src/nsTextFrame.cpp | 75 ++++++------------ 8 files changed, 112 insertions(+), 206 deletions(-) diff --git a/layout/generic/nsPageContentFrame.cpp b/layout/generic/nsPageContentFrame.cpp index 5c92e151dbf..13f9699d6ff 100644 --- a/layout/generic/nsPageContentFrame.cpp +++ b/layout/generic/nsPageContentFrame.cpp @@ -111,7 +111,6 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext, if (NS_FRAME_OUTSIDE_CHILDREN & frame->GetStateBits()) { // The background covers the content area and padding area, so check // for children sticking outside the child frame's padding edge - nscoord paddingEdgeX = aDesiredSize.width - border.right - padding.right; if (aDesiredSize.mOverflowArea.XMost() > aDesiredSize.width) { mPD->mPageContentXMost = aDesiredSize.mOverflowArea.XMost() + border.right + padding.right; } diff --git a/layout/generic/nsSimplePageSequence.cpp b/layout/generic/nsSimplePageSequence.cpp index bcba9f20e37..a74b0b0d84a 100644 --- a/layout/generic/nsSimplePageSequence.cpp +++ b/layout/generic/nsSimplePageSequence.cpp @@ -481,19 +481,19 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, } // Get the next page - kidFrame->GetNextSibling(&kidFrame); + kidFrame = kidFrame->GetNextSibling(); } // Get Total Page Count nsIFrame* page; PRInt32 pageTot = 0; - for (page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { + for (page = mFrames.FirstChild(); page; page = page->GetNextSibling()) { pageTot++; } // Set Page Number Info PRInt32 pageNum = 1; - for (page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { + for (page = mFrames.FirstChild(); page; page = page->GetNextSibling()) { nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, page); if (pf != nsnull) { pf->SetPageNumInfo(pageNum, pageTot); @@ -674,14 +674,12 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, #if defined(DEBUG_rods) || defined(DEBUG_dcone) { - nsIView* seqView = GetView(aPresContext); - nsRect rect; - GetRect(rect); + nsIView* seqView = GetView(); + nsRect rect = GetRect(); PR_PL(("Seq Frame: %p - [%5d,%5d,%5d,%5d] ", this, rect.x, rect.y, rect.width, rect.height)); PR_PL(("view: %p ", seqView)); - nsRect viewRect; if (seqView) { - seqView->GetBounds(viewRect); + nsRect viewRect = seqView->GetBounds(); PR_PL((" [%5d,%5d,%5d,%5d]", viewRect.x, viewRect.y, viewRect.width, viewRect.height)); } PR_PL(("\n")); @@ -689,13 +687,12 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, { PRInt32 pageNum = 1; - for (nsIFrame* page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { - nsIView* view = page->GetView(aPresContext); - NS_ASSERTION(nsnull != view, "no page view"); - nsRect rect; - page->GetRect(rect); - nsRect viewRect; - view->GetBounds(viewRect); + for (nsIFrame* page = mFrames.FirstChild(); page; + page = page->GetNextSibling()) { + nsIView* view = page->GetView(); + NS_ASSERTION(view, "no page view"); + nsRect rect = page->GetRect(); + nsRect viewRect = view->GetBounds(); PR_PL((" Page: %p No: %d - [%5d,%5d,%5d,%5d] ", page, pageNum, rect.x, rect.y, rect.width, rect.height)); PR_PL((" [%5d,%5d,%5d,%5d]\n", viewRect.x, viewRect.y, viewRect.width, viewRect.height)); pageNum++; @@ -717,13 +714,13 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, PRInt32 pageNum = 1; nscoord y = 0;//mMargin.top; - for (nsIFrame* page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { - nsIView* view = page->GetView(aPresContext); - NS_ASSERTION(nsnull != view, "no page view"); + for (nsIFrame* page = mFrames.FirstChild(); page; + page = page->GetNextSibling()) { + nsIView* view = page->GetView(); + NS_ASSERTION(view, "no page view"); - nsCOMPtr vm; - view->GetViewManager(*getter_AddRefs(vm)); - NS_ASSERTION(nsnull != vm, "no view manager"); + nsIViewManager* vm = view->GetViewManager(); + NS_ASSERTION(vm, "no view manager"); if (pageNum < mFromPageNum || pageNum > mToPageNum) { // Hide the pages that won't be printed to the Viewmanager @@ -734,14 +731,12 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, nsRegion emptyRegion; vm->SetViewChildClipRegion(view, &emptyRegion); } else { - nsRect rect; - page->GetRect(rect); + nsRect rect = page->GetRect(); rect.y = y; rect.height = height; - page->SetRect(aPresContext, rect); + page->SetRect(rect); - nsRect viewRect; - view->GetBounds(viewRect); + nsRect viewRect = view->GetBounds(); viewRect.y = y; viewRect.height = height; vm->MoveViewTo(view, viewRect.x, viewRect.y); @@ -829,12 +824,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) aPresContext->GetDeviceContext(getter_AddRefs(dc)); NS_ASSERTION(dc, "nsIDeviceContext can't be NULL!"); - nsCOMPtr presShell; - aPresContext->GetShell(getter_AddRefs(presShell)); - NS_ASSERTION(presShell, "nsIPresShell can't be NULL!"); - - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = aPresContext->GetViewManager(); NS_ASSERTION(vm, "nsIViewManager can't be NULL!"); nsresult rv = NS_OK; @@ -886,9 +876,9 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* conFrame; childFrame->FirstChild(aPresContext, nsnull, &conFrame); - containerView = conFrame->GetView(aPresContext); - NS_ASSERTION(containerView != nsnull, "Container view can't be null!"); - containerView->GetBounds(containerRect); + containerView = conFrame->GetView(); + NS_ASSERTION(containerView, "Container view can't be null!"); + containerRect = containerView->GetBounds(); containerRect.y -= mYSelOffset; slidingRect.SetRect(0,mYSelOffset,width,height); @@ -919,9 +909,9 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) } // Print the page - nsIView* view = mCurrentPageFrame->GetView(aPresContext); + nsIView* view = mCurrentPageFrame->GetView(); - NS_ASSERTION(nsnull != view, "no page view"); + NS_ASSERTION(view, "no page view"); PR_PL(("SeqFr::Paint -> %p PageNo: %d View: %p", pf, mPageNum, view)); PR_PL((" At: %d,%d\n", mMargin.left+mOffsetX, mMargin.top+mOffsetY)); @@ -973,7 +963,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) } mPageNum++; - rv = mCurrentPageFrame->GetNextSibling(&mCurrentPageFrame); + mCurrentPageFrame = mCurrentPageFrame->GetNextSibling(); } return rv; @@ -1005,8 +995,8 @@ nsSimplePageSequenceFrame::DoPageEnd(nsIPresContext* aPresContext) mPageNum++; - if( nsnull != mCurrentPageFrame){ - rv = mCurrentPageFrame->GetNextSibling(&mCurrentPageFrame); + if (mCurrentPageFrame) { + mCurrentPageFrame = mCurrentPageFrame->GetNextSibling(); } return rv; @@ -1015,7 +1005,7 @@ nsSimplePageSequenceFrame::DoPageEnd(nsIPresContext* aPresContext) NS_IMETHODIMP nsSimplePageSequenceFrame::SuppressHeadersAndFooters(PRBool aDoSup) { - for (nsIFrame* f = mFrames.FirstChild(); f != nsnull; f->GetNextSibling(&f)) { + for (nsIFrame* f = mFrames.FirstChild(); f; f = f->GetNextSibling()) { nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, f); if (pf != nsnull) { pf->SuppressHeadersAndFooters(aDoSup); @@ -1027,7 +1017,7 @@ nsSimplePageSequenceFrame::SuppressHeadersAndFooters(PRBool aDoSup) NS_IMETHODIMP nsSimplePageSequenceFrame::SetClipRect(nsIPresContext* aPresContext, nsRect* aRect) { - for (nsIFrame* f = mFrames.FirstChild(); f != nsnull; f->GetNextSibling(&f)) { + for (nsIFrame* f = mFrames.FirstChild(); f; f = f->GetNextSibling()) { nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, f); if (pf != nsnull) { pf->SetClipRect(aRect); @@ -1062,11 +1052,6 @@ nsSimplePageSequenceFrame::Paint(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP nsSimplePageSequenceFrame::SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight) -{ - return nsFrame::SizeTo(aPresContext, aWidth, aHeight); -} - NS_IMETHODIMP nsSimplePageSequenceFrame::GetFrameType(nsIAtom** aType) const { diff --git a/layout/generic/nsSimplePageSequence.h b/layout/generic/nsSimplePageSequence.h index 5a160efe046..f87cbe7867f 100644 --- a/layout/generic/nsSimplePageSequence.h +++ b/layout/generic/nsSimplePageSequence.h @@ -122,10 +122,6 @@ public: NS_IMETHOD SuppressHeadersAndFooters(PRBool aDoSup); NS_IMETHOD SetClipRect(nsIPresContext* aPresContext, nsRect* aSize); - NS_IMETHOD SizeTo(nsIPresContext* aPresContext, - nscoord aWidth, - nscoord aHeight); - /** * Get the "type" of the frame * diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 18cf9a10ef0..5df87c047eb 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -338,16 +338,12 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer) // Determine damaged area and tell view manager to redraw it nsPoint offset; - nsRect bounds; - frameData->mFrame->GetRect(bounds); + nsRect bounds = frameData->mFrame->GetRect(); nsIView* view; frameData->mFrame->GetOffsetFromView(frameData->mPresContext, offset, &view); - nsIViewManager* vm; - view->GetViewManager(vm); bounds.x = offset.x; bounds.y = offset.y; - vm->UpdateView(view, bounds, 0); - NS_RELEASE(vm); + view->GetViewManager()->UpdateView(view, bounds, 0); } return NS_OK; } @@ -889,10 +885,7 @@ nsContinuingTextFrame::Init(nsIPresContext* aPresContext, mPrevInFlow = aPrevInFlow; aPrevInFlow->SetNextInFlow(this); #ifdef IBMBIDI - nsFrameState state; - aPrevInFlow->GetFrameState(&state); - - if (state & NS_FRAME_IS_BIDI) { + if (aPrevInFlow->GetStateBits() & NS_FRAME_IS_BIDI) { PRInt32 start, end; aPrevInFlow->GetOffsets(start, mContentOffset); @@ -1860,8 +1853,7 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext, } if (aDetails){ - nsRect rect; - GetRect(rect); + nsRect rect = GetRect(); while(aDetails){ const nscoord* sp= aSpacing; PRInt32 startOffset = 0; @@ -1983,26 +1975,23 @@ nsTextFrame::GetContentAndOffsetsForSelection(nsIPresContext *aPresContext, nsIC *aContent = nsnull; *aOffset = mContentOffset; *aLength = mContentLength; - nsIFrame *parent; - nsresult rv = GetParent(&parent); - if (NS_SUCCEEDED(rv) && parent) + nsIFrame *parent = GetParent(); + if (parent) { if ((mState & NS_FRAME_GENERATED_CONTENT) != 0)//parent is generated so so are we. { //we COULD check the previous sibling but I dont think that is reliable - rv = parent->GetContent(aContent); - if (NS_FAILED(rv)) - return rv; + *aContent = parent->GetContent(); if(!*aContent) return NS_ERROR_FAILURE; + NS_ADDREF(*aContent); //ARE WE A BEFORE FRAME? if not then we assume we are an after frame. this may be bad later - nsIFrame *grandParent; - nsIFrame *firstParent; - rv = parent->GetParent(&grandParent); - if (NS_SUCCEEDED(rv) && grandParent) + nsIFrame *grandParent = parent->GetParent(); + if (grandParent) { - rv = grandParent->FirstChild(aPresContext,nsnull, &firstParent); + nsIFrame *firstParent; + nsresult rv = grandParent->FirstChild(aPresContext,nsnull, &firstParent); if (NS_SUCCEEDED(rv) && firstParent) { *aLength = 0; @@ -2090,9 +2079,7 @@ nsresult nsTextFrame::GetTextInfoForPainting(nsIPresContext* aPresConte doc->GetLineBreaker(aLineBreaker); - nsFrameState frameState; - GetFrameState(&frameState); - aIsSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT; + aIsSelected = (GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT; return NS_OK; } @@ -3605,10 +3592,8 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, if (aSelected && ParentDisablesSelection()) return NS_OK; - nsFrameState frameState; - GetFrameState(&frameState); #if 0 - PRBool isSelected = ((frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT); + PRBool isSelected = ((GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT); if (!aSelected && !isSelected) //already set thanks { return NS_OK; @@ -3633,10 +3618,7 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, aRange->GetEndOffset(&endOffset); aRange->GetStartContainer(getter_AddRefs(startNode)); aRange->GetStartOffset(&startOffset); - nsCOMPtr content; - result = GetContent(getter_AddRefs(content)); - nsCOMPtr thisNode; - thisNode = do_QueryInterface(content); + nsCOMPtr thisNode = do_QueryInterface(GetContent()); if (thisNode == startNode) { @@ -3669,13 +3651,13 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, } } else { - if ( aSelected != (PRBool)(frameState | NS_FRAME_SELECTED_CONTENT) ){ + if (aSelected != ((GetStateBits() & NS_FRAME_SELECTED_CONTENT) != 0)) { found = PR_TRUE; } } if ( aSelected ) - frameState |= NS_FRAME_SELECTED_CONTENT; + AddStateBits(NS_FRAME_SELECTED_CONTENT); else {//we need to see if any other selection available. SelectionDetails *details = nsnull; @@ -3707,7 +3689,7 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, } } if (!details) - frameState &= ~NS_FRAME_SELECTED_CONTENT; + RemoveStateBits(NS_FRAME_SELECTED_CONTENT); else { SelectionDetails *sdptr = details; @@ -3718,10 +3700,8 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, delete details; } } - SetFrameState(frameState); if (found){ //if range contains this frame... - nsRect frameRect; - GetRect(frameRect); + nsRect frameRect = GetRect(); nsRect rect(0, 0, frameRect.width, frameRect.height); if (!rect.IsEmpty()) Invalidate(aPresContext, rect, PR_FALSE); @@ -3902,8 +3882,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, // continuation frame if (mState & NS_FRAME_IS_BIDI) { - nsIFrame *nextBidi; - GetNextSibling(&nextBidi); + nsIFrame *nextBidi = GetNextSibling(); if (nextBidi) { PRInt32 start, end; @@ -5710,9 +5689,8 @@ nsTextFrame::ComputeTotalWordDimensions(nsIPresContext* aPresContext, nsTextDimensions addedDimensions; PRUnichar *newWordBuf = aWordBuf; PRUint32 newWordBufSize = aWordBufSize; - while (nsnull != aNextFrame) { - nsCOMPtr content; - aNextFrame->GetContent(getter_AddRefs(content)); + while (aNextFrame) { + nsIContent* content = aNextFrame->GetContent(); #ifdef DEBUG_WORD_WRAPPING printf(" next textRun="); @@ -6010,7 +5988,7 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons fprintf(out, " [parent=%p]", mParent); #endif if (HasView()) { - fprintf(out, " [view=%p]", NS_STATIC_CAST(void*, GetView(aPresContext))); + fprintf(out, " [view=%p]", NS_STATIC_CAST(void*, GetView())); } PRInt32 totalContentLength; @@ -6118,12 +6096,7 @@ void nsTextFrame::AdjustSelectionPointsForBidi(SelectionDetails *sdptr, void nsTextFrame::AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd) { - nsFrameState frameState; - - GetFrameState(&frameState); - frameState |= NS_FRAME_IS_BIDI; - SetFrameState(frameState); - + AddStateBits(NS_FRAME_IS_BIDI); SetOffsets(aStart, aEnd); } diff --git a/layout/html/base/src/nsPageContentFrame.cpp b/layout/html/base/src/nsPageContentFrame.cpp index 5c92e151dbf..13f9699d6ff 100644 --- a/layout/html/base/src/nsPageContentFrame.cpp +++ b/layout/html/base/src/nsPageContentFrame.cpp @@ -111,7 +111,6 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext, if (NS_FRAME_OUTSIDE_CHILDREN & frame->GetStateBits()) { // The background covers the content area and padding area, so check // for children sticking outside the child frame's padding edge - nscoord paddingEdgeX = aDesiredSize.width - border.right - padding.right; if (aDesiredSize.mOverflowArea.XMost() > aDesiredSize.width) { mPD->mPageContentXMost = aDesiredSize.mOverflowArea.XMost() + border.right + padding.right; } diff --git a/layout/html/base/src/nsSimplePageSequence.cpp b/layout/html/base/src/nsSimplePageSequence.cpp index bcba9f20e37..a74b0b0d84a 100644 --- a/layout/html/base/src/nsSimplePageSequence.cpp +++ b/layout/html/base/src/nsSimplePageSequence.cpp @@ -481,19 +481,19 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, } // Get the next page - kidFrame->GetNextSibling(&kidFrame); + kidFrame = kidFrame->GetNextSibling(); } // Get Total Page Count nsIFrame* page; PRInt32 pageTot = 0; - for (page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { + for (page = mFrames.FirstChild(); page; page = page->GetNextSibling()) { pageTot++; } // Set Page Number Info PRInt32 pageNum = 1; - for (page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { + for (page = mFrames.FirstChild(); page; page = page->GetNextSibling()) { nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, page); if (pf != nsnull) { pf->SetPageNumInfo(pageNum, pageTot); @@ -674,14 +674,12 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, #if defined(DEBUG_rods) || defined(DEBUG_dcone) { - nsIView* seqView = GetView(aPresContext); - nsRect rect; - GetRect(rect); + nsIView* seqView = GetView(); + nsRect rect = GetRect(); PR_PL(("Seq Frame: %p - [%5d,%5d,%5d,%5d] ", this, rect.x, rect.y, rect.width, rect.height)); PR_PL(("view: %p ", seqView)); - nsRect viewRect; if (seqView) { - seqView->GetBounds(viewRect); + nsRect viewRect = seqView->GetBounds(); PR_PL((" [%5d,%5d,%5d,%5d]", viewRect.x, viewRect.y, viewRect.width, viewRect.height)); } PR_PL(("\n")); @@ -689,13 +687,12 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, { PRInt32 pageNum = 1; - for (nsIFrame* page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { - nsIView* view = page->GetView(aPresContext); - NS_ASSERTION(nsnull != view, "no page view"); - nsRect rect; - page->GetRect(rect); - nsRect viewRect; - view->GetBounds(viewRect); + for (nsIFrame* page = mFrames.FirstChild(); page; + page = page->GetNextSibling()) { + nsIView* view = page->GetView(); + NS_ASSERTION(view, "no page view"); + nsRect rect = page->GetRect(); + nsRect viewRect = view->GetBounds(); PR_PL((" Page: %p No: %d - [%5d,%5d,%5d,%5d] ", page, pageNum, rect.x, rect.y, rect.width, rect.height)); PR_PL((" [%5d,%5d,%5d,%5d]\n", viewRect.x, viewRect.y, viewRect.width, viewRect.height)); pageNum++; @@ -717,13 +714,13 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, PRInt32 pageNum = 1; nscoord y = 0;//mMargin.top; - for (nsIFrame* page = mFrames.FirstChild(); nsnull != page; page->GetNextSibling(&page)) { - nsIView* view = page->GetView(aPresContext); - NS_ASSERTION(nsnull != view, "no page view"); + for (nsIFrame* page = mFrames.FirstChild(); page; + page = page->GetNextSibling()) { + nsIView* view = page->GetView(); + NS_ASSERTION(view, "no page view"); - nsCOMPtr vm; - view->GetViewManager(*getter_AddRefs(vm)); - NS_ASSERTION(nsnull != vm, "no view manager"); + nsIViewManager* vm = view->GetViewManager(); + NS_ASSERTION(vm, "no view manager"); if (pageNum < mFromPageNum || pageNum > mToPageNum) { // Hide the pages that won't be printed to the Viewmanager @@ -734,14 +731,12 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext, nsRegion emptyRegion; vm->SetViewChildClipRegion(view, &emptyRegion); } else { - nsRect rect; - page->GetRect(rect); + nsRect rect = page->GetRect(); rect.y = y; rect.height = height; - page->SetRect(aPresContext, rect); + page->SetRect(rect); - nsRect viewRect; - view->GetBounds(viewRect); + nsRect viewRect = view->GetBounds(); viewRect.y = y; viewRect.height = height; vm->MoveViewTo(view, viewRect.x, viewRect.y); @@ -829,12 +824,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) aPresContext->GetDeviceContext(getter_AddRefs(dc)); NS_ASSERTION(dc, "nsIDeviceContext can't be NULL!"); - nsCOMPtr presShell; - aPresContext->GetShell(getter_AddRefs(presShell)); - NS_ASSERTION(presShell, "nsIPresShell can't be NULL!"); - - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = aPresContext->GetViewManager(); NS_ASSERTION(vm, "nsIViewManager can't be NULL!"); nsresult rv = NS_OK; @@ -886,9 +876,9 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* conFrame; childFrame->FirstChild(aPresContext, nsnull, &conFrame); - containerView = conFrame->GetView(aPresContext); - NS_ASSERTION(containerView != nsnull, "Container view can't be null!"); - containerView->GetBounds(containerRect); + containerView = conFrame->GetView(); + NS_ASSERTION(containerView, "Container view can't be null!"); + containerRect = containerView->GetBounds(); containerRect.y -= mYSelOffset; slidingRect.SetRect(0,mYSelOffset,width,height); @@ -919,9 +909,9 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) } // Print the page - nsIView* view = mCurrentPageFrame->GetView(aPresContext); + nsIView* view = mCurrentPageFrame->GetView(); - NS_ASSERTION(nsnull != view, "no page view"); + NS_ASSERTION(view, "no page view"); PR_PL(("SeqFr::Paint -> %p PageNo: %d View: %p", pf, mPageNum, view)); PR_PL((" At: %d,%d\n", mMargin.left+mOffsetX, mMargin.top+mOffsetY)); @@ -973,7 +963,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) } mPageNum++; - rv = mCurrentPageFrame->GetNextSibling(&mCurrentPageFrame); + mCurrentPageFrame = mCurrentPageFrame->GetNextSibling(); } return rv; @@ -1005,8 +995,8 @@ nsSimplePageSequenceFrame::DoPageEnd(nsIPresContext* aPresContext) mPageNum++; - if( nsnull != mCurrentPageFrame){ - rv = mCurrentPageFrame->GetNextSibling(&mCurrentPageFrame); + if (mCurrentPageFrame) { + mCurrentPageFrame = mCurrentPageFrame->GetNextSibling(); } return rv; @@ -1015,7 +1005,7 @@ nsSimplePageSequenceFrame::DoPageEnd(nsIPresContext* aPresContext) NS_IMETHODIMP nsSimplePageSequenceFrame::SuppressHeadersAndFooters(PRBool aDoSup) { - for (nsIFrame* f = mFrames.FirstChild(); f != nsnull; f->GetNextSibling(&f)) { + for (nsIFrame* f = mFrames.FirstChild(); f; f = f->GetNextSibling()) { nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, f); if (pf != nsnull) { pf->SuppressHeadersAndFooters(aDoSup); @@ -1027,7 +1017,7 @@ nsSimplePageSequenceFrame::SuppressHeadersAndFooters(PRBool aDoSup) NS_IMETHODIMP nsSimplePageSequenceFrame::SetClipRect(nsIPresContext* aPresContext, nsRect* aRect) { - for (nsIFrame* f = mFrames.FirstChild(); f != nsnull; f->GetNextSibling(&f)) { + for (nsIFrame* f = mFrames.FirstChild(); f; f = f->GetNextSibling()) { nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, f); if (pf != nsnull) { pf->SetClipRect(aRect); @@ -1062,11 +1052,6 @@ nsSimplePageSequenceFrame::Paint(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP nsSimplePageSequenceFrame::SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight) -{ - return nsFrame::SizeTo(aPresContext, aWidth, aHeight); -} - NS_IMETHODIMP nsSimplePageSequenceFrame::GetFrameType(nsIAtom** aType) const { diff --git a/layout/html/base/src/nsSimplePageSequence.h b/layout/html/base/src/nsSimplePageSequence.h index 5a160efe046..f87cbe7867f 100644 --- a/layout/html/base/src/nsSimplePageSequence.h +++ b/layout/html/base/src/nsSimplePageSequence.h @@ -122,10 +122,6 @@ public: NS_IMETHOD SuppressHeadersAndFooters(PRBool aDoSup); NS_IMETHOD SetClipRect(nsIPresContext* aPresContext, nsRect* aSize); - NS_IMETHOD SizeTo(nsIPresContext* aPresContext, - nscoord aWidth, - nscoord aHeight); - /** * Get the "type" of the frame * diff --git a/layout/html/base/src/nsTextFrame.cpp b/layout/html/base/src/nsTextFrame.cpp index 18cf9a10ef0..5df87c047eb 100644 --- a/layout/html/base/src/nsTextFrame.cpp +++ b/layout/html/base/src/nsTextFrame.cpp @@ -338,16 +338,12 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer) // Determine damaged area and tell view manager to redraw it nsPoint offset; - nsRect bounds; - frameData->mFrame->GetRect(bounds); + nsRect bounds = frameData->mFrame->GetRect(); nsIView* view; frameData->mFrame->GetOffsetFromView(frameData->mPresContext, offset, &view); - nsIViewManager* vm; - view->GetViewManager(vm); bounds.x = offset.x; bounds.y = offset.y; - vm->UpdateView(view, bounds, 0); - NS_RELEASE(vm); + view->GetViewManager()->UpdateView(view, bounds, 0); } return NS_OK; } @@ -889,10 +885,7 @@ nsContinuingTextFrame::Init(nsIPresContext* aPresContext, mPrevInFlow = aPrevInFlow; aPrevInFlow->SetNextInFlow(this); #ifdef IBMBIDI - nsFrameState state; - aPrevInFlow->GetFrameState(&state); - - if (state & NS_FRAME_IS_BIDI) { + if (aPrevInFlow->GetStateBits() & NS_FRAME_IS_BIDI) { PRInt32 start, end; aPrevInFlow->GetOffsets(start, mContentOffset); @@ -1860,8 +1853,7 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext, } if (aDetails){ - nsRect rect; - GetRect(rect); + nsRect rect = GetRect(); while(aDetails){ const nscoord* sp= aSpacing; PRInt32 startOffset = 0; @@ -1983,26 +1975,23 @@ nsTextFrame::GetContentAndOffsetsForSelection(nsIPresContext *aPresContext, nsIC *aContent = nsnull; *aOffset = mContentOffset; *aLength = mContentLength; - nsIFrame *parent; - nsresult rv = GetParent(&parent); - if (NS_SUCCEEDED(rv) && parent) + nsIFrame *parent = GetParent(); + if (parent) { if ((mState & NS_FRAME_GENERATED_CONTENT) != 0)//parent is generated so so are we. { //we COULD check the previous sibling but I dont think that is reliable - rv = parent->GetContent(aContent); - if (NS_FAILED(rv)) - return rv; + *aContent = parent->GetContent(); if(!*aContent) return NS_ERROR_FAILURE; + NS_ADDREF(*aContent); //ARE WE A BEFORE FRAME? if not then we assume we are an after frame. this may be bad later - nsIFrame *grandParent; - nsIFrame *firstParent; - rv = parent->GetParent(&grandParent); - if (NS_SUCCEEDED(rv) && grandParent) + nsIFrame *grandParent = parent->GetParent(); + if (grandParent) { - rv = grandParent->FirstChild(aPresContext,nsnull, &firstParent); + nsIFrame *firstParent; + nsresult rv = grandParent->FirstChild(aPresContext,nsnull, &firstParent); if (NS_SUCCEEDED(rv) && firstParent) { *aLength = 0; @@ -2090,9 +2079,7 @@ nsresult nsTextFrame::GetTextInfoForPainting(nsIPresContext* aPresConte doc->GetLineBreaker(aLineBreaker); - nsFrameState frameState; - GetFrameState(&frameState); - aIsSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT; + aIsSelected = (GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT; return NS_OK; } @@ -3605,10 +3592,8 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, if (aSelected && ParentDisablesSelection()) return NS_OK; - nsFrameState frameState; - GetFrameState(&frameState); #if 0 - PRBool isSelected = ((frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT); + PRBool isSelected = ((GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT); if (!aSelected && !isSelected) //already set thanks { return NS_OK; @@ -3633,10 +3618,7 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, aRange->GetEndOffset(&endOffset); aRange->GetStartContainer(getter_AddRefs(startNode)); aRange->GetStartOffset(&startOffset); - nsCOMPtr content; - result = GetContent(getter_AddRefs(content)); - nsCOMPtr thisNode; - thisNode = do_QueryInterface(content); + nsCOMPtr thisNode = do_QueryInterface(GetContent()); if (thisNode == startNode) { @@ -3669,13 +3651,13 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, } } else { - if ( aSelected != (PRBool)(frameState | NS_FRAME_SELECTED_CONTENT) ){ + if (aSelected != ((GetStateBits() & NS_FRAME_SELECTED_CONTENT) != 0)) { found = PR_TRUE; } } if ( aSelected ) - frameState |= NS_FRAME_SELECTED_CONTENT; + AddStateBits(NS_FRAME_SELECTED_CONTENT); else {//we need to see if any other selection available. SelectionDetails *details = nsnull; @@ -3707,7 +3689,7 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, } } if (!details) - frameState &= ~NS_FRAME_SELECTED_CONTENT; + RemoveStateBits(NS_FRAME_SELECTED_CONTENT); else { SelectionDetails *sdptr = details; @@ -3718,10 +3700,8 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, delete details; } } - SetFrameState(frameState); if (found){ //if range contains this frame... - nsRect frameRect; - GetRect(frameRect); + nsRect frameRect = GetRect(); nsRect rect(0, 0, frameRect.width, frameRect.height); if (!rect.IsEmpty()) Invalidate(aPresContext, rect, PR_FALSE); @@ -3902,8 +3882,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, // continuation frame if (mState & NS_FRAME_IS_BIDI) { - nsIFrame *nextBidi; - GetNextSibling(&nextBidi); + nsIFrame *nextBidi = GetNextSibling(); if (nextBidi) { PRInt32 start, end; @@ -5710,9 +5689,8 @@ nsTextFrame::ComputeTotalWordDimensions(nsIPresContext* aPresContext, nsTextDimensions addedDimensions; PRUnichar *newWordBuf = aWordBuf; PRUint32 newWordBufSize = aWordBufSize; - while (nsnull != aNextFrame) { - nsCOMPtr content; - aNextFrame->GetContent(getter_AddRefs(content)); + while (aNextFrame) { + nsIContent* content = aNextFrame->GetContent(); #ifdef DEBUG_WORD_WRAPPING printf(" next textRun="); @@ -6010,7 +5988,7 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons fprintf(out, " [parent=%p]", mParent); #endif if (HasView()) { - fprintf(out, " [view=%p]", NS_STATIC_CAST(void*, GetView(aPresContext))); + fprintf(out, " [view=%p]", NS_STATIC_CAST(void*, GetView())); } PRInt32 totalContentLength; @@ -6118,12 +6096,7 @@ void nsTextFrame::AdjustSelectionPointsForBidi(SelectionDetails *sdptr, void nsTextFrame::AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd) { - nsFrameState frameState; - - GetFrameState(&frameState); - frameState |= NS_FRAME_IS_BIDI; - SetFrameState(frameState); - + AddStateBits(NS_FRAME_IS_BIDI); SetOffsets(aStart, aEnd); }