diff --git a/mozilla/accessible/src/base/nsAccessible.cpp b/mozilla/accessible/src/base/nsAccessible.cpp index 9ac801e93d4..d7ae7390c95 100644 --- a/mozilla/accessible/src/base/nsAccessible.cpp +++ b/mozilla/accessible/src/base/nsAccessible.cpp @@ -740,7 +740,7 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame // Use next sibling if it exists, or go back up the tree to get the first next-in-flow or next-sibling // within our search while (iterFrame) { - iterFrame->GetNextInFlow(&iterNextFrame); + iterNextFrame = iterFrame->GetNextInFlow(); if (!iterNextFrame) iterNextFrame = iterFrame->GetNextSibling(); if (iterNextFrame || --depth < 0) diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 37d82603967..19735fc2064 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -3203,7 +3203,7 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) if (aType == nsIWebBrowserPrint::PRINTPREVIEW_PREV_PAGE) { if (currentPage) { - currentPage->GetPrevInFlow(&fndPageFrame); + fndPageFrame = currentPage->GetPrevInFlow(); if (!fndPageFrame) { return NS_OK; } @@ -3212,7 +3212,7 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) } } else if (aType == nsIWebBrowserPrint::PRINTPREVIEW_NEXT_PAGE) { if (currentPage) { - currentPage->GetNextInFlow(&fndPageFrame); + fndPageFrame = currentPage->GetNextInFlow(); if (!fndPageFrame) { return NS_OK; } diff --git a/mozilla/content/base/src/nsSelection.cpp b/mozilla/content/base/src/nsSelection.cpp index 0bbef348a1d..6d3560a4732 100644 --- a/mozilla/content/base/src/nsSelection.cpp +++ b/mozilla/content/base/src/nsSelection.cpp @@ -4839,7 +4839,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext, while (!frameRect.width || !frameRect.height) { //try to notify next in flow that its content is selected. - if (NS_SUCCEEDED(frame->GetNextInFlow(&frame)) && frame) + frame = frame->GetNextInFlow(); + if (frame) { frameRect = frame->GetRect(); frame->SetSelected(aPresContext, nsnull,aFlags,eSpreadDown); diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 33f002326fe..318ee4ab77a 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -622,7 +622,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent) do { rcFrame.UnionRect(rcFrame, next->GetRect()); - next->GetNextInFlow(&next); + next = next->GetNextInFlow(); } while (next); if (rcFrame.IsEmpty()) { diff --git a/mozilla/extensions/inspector/base/src/inFlasher.cpp b/mozilla/extensions/inspector/base/src/inFlasher.cpp index c0d941a4734..636b2a08b0d 100644 --- a/mozilla/extensions/inspector/base/src/inFlasher.cpp +++ b/mozilla/extensions/inspector/base/src/inFlasher.cpp @@ -188,7 +188,7 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement) rcontext->InvertRect(rect); } - frame->GetNextInFlow(&frame); + frame = frame->GetNextInFlow(); PRBool isLastFrame = (frame == nsnull); DrawOutline(rect.x, rect.y, rect.width, rect.height, p2t, rcontext, diff --git a/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp b/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp index 82cea75fe88..28c3694ff45 100644 --- a/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp +++ b/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp @@ -2574,8 +2574,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell, if (startRangeOffset < endFrameOffset) { break; } - nsIFrame *nextInFlowFrame = nsnull; - frame->GetNextInFlow(&nextInFlowFrame); + nsIFrame *nextInFlowFrame = frame->GetNextInFlow(); if (nextInFlowFrame) { frame = nextInFlowFrame; } diff --git a/mozilla/layout/base/nsBidiPresUtils.cpp b/mozilla/layout/base/nsBidiPresUtils.cpp index 6d216f093a5..03544d26e05 100644 --- a/mozilla/layout/base/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/nsBidiPresUtils.cpp @@ -803,7 +803,7 @@ nsBidiPresUtils::RemoveBidiContinuation(nsPresContext* aPresContext, frame = aFrame; do { propTable->DeleteProperty(frame, nsLayoutAtoms::nextBidi); - frame->GetPrevInFlow(&frame); + frame = frame->GetPrevInFlow(); if (!frame) { break; } diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 255c49c8612..82a7615f02f 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -450,8 +450,7 @@ GetLastSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame) static nsIFrame* GetNifOrSpecialSibling(nsFrameManager *aFrameManager, nsIFrame *aFrame) { - nsIFrame *result; - aFrame->GetNextInFlow(&result); + nsIFrame *result = aFrame->GetNextInFlow(); if (result) return result; @@ -466,17 +465,14 @@ SetFrameIsSpecial(nsFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aSp NS_PRECONDITION(aFrameManager && aFrame, "bad args!"); // Mark the frame and all of its siblings as "special". - for (nsIFrame* frame = aFrame; frame != nsnull; frame->GetNextInFlow(&frame)) { + for (nsIFrame* frame = aFrame; frame != nsnull; frame = frame->GetNextInFlow()) { frame->AddStateBits(NS_FRAME_IS_SPECIAL); } if (aSpecialSibling) { -#ifdef DEBUG // We should be the first-in-flow - nsIFrame* prev; - aFrame->GetPrevInFlow(&prev); - NS_ASSERTION(! prev, "assigning special sibling to other than first-in-flow!"); -#endif + NS_ASSERTION(!aFrame->GetPrevInFlow(), + "assigning special sibling to other than first-in-flow!"); // Store the "special sibling" (if we were given one) with the // first frame in the flow. @@ -7810,12 +7806,9 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell, nsIFrame* nextSibling; aPresShell->GetPrimaryFrameFor(child, &nextSibling); if (nextSibling) { -#ifdef DEBUG // The primary frame should never be a continuation - nsIFrame* prevInFlow; - nextSibling->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "primary frame is a continuation!?"); -#endif + NS_ASSERTION(!nextSibling->GetPrevInFlow(), + "primary frame is a continuation!?"); // If the frame is out-of-flow, GPFF() will have returned the // out-of-flow frame; we want the placeholder. @@ -7996,12 +7989,9 @@ nsCSSFrameConstructor::FindNextSibling(nsIPresShell* aPresShell, aPresShell->GetPrimaryFrameFor(nsCOMPtr(*iter), &nextSibling); if (nextSibling) { -#ifdef DEBUG // The frame primary frame should never be a continuation - nsIFrame* prevInFlow; - nextSibling->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "primary frame is a continuation!?"); -#endif + NS_ASSERTION(!nextSibling->GetPrevInFlow(), + "primary frame is a continuation!?"); // If the frame is out-of-flow, GPFF() will have returned the // out-of-flow frame; we want the placeholder. @@ -9298,7 +9288,7 @@ DeletingFrameSubtree(nsPresContext* aPresContext, // recursing over a subtree, because those continuing frames should be // found as part of the walk over the top-most frame's continuing frames. // Walking them again will make this an N^2/2 algorithm - aFrame->GetNextInFlow(&aFrame); + aFrame = aFrame->GetNextInFlow(); } while (aFrame); // Now destroy any frames that have been enqueued for destruction. @@ -10691,8 +10681,7 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell, if ((NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == display->mDisplay) || (NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == display->mDisplay)) { // If the row group has was continued, then don't replicate it - nsIFrame* rgNextInFlow; - rowGroupFrame->GetNextInFlow(&rgNextInFlow); + nsIFrame* rgNextInFlow = rowGroupFrame->GetNextInFlow(); if (rgNextInFlow) { ((nsTableRowGroupFrame*)rowGroupFrame)->SetRepeatable(PR_FALSE); } @@ -10746,9 +10735,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, nsStyleContext* styleContext = aFrame->GetStyleContext(); nsIFrame* newFrame = nsnull; nsresult rv = NS_OK; - nsIFrame* nextInFlow = nsnull; - - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); // Use the frame type to determine what type of frame to create nsIAtom* frameType = aFrame->GetType(); @@ -10944,8 +10931,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, return NS_ERROR_UNEXPECTED; } - nsIFrame* prevPage; - pageFrame->GetPrevInFlow(&prevPage); + nsIFrame* prevPage = pageFrame->GetPrevInFlow(); if (!prevPage) { return NS_OK; } @@ -11877,8 +11863,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( // need to be pulled out of the line-frame and become children // of the block. nsIFrame* nextSibling = aPrevSibling->GetNextSibling(); - nsIFrame* nextLineFrame; - prevSiblingParent->GetNextInFlow(&nextLineFrame); + nsIFrame* nextLineFrame = prevSiblingParent->GetNextInFlow(); if (nextSibling || nextLineFrame) { // Oy. We have work to do. Create a list of the new frames // that are going into the block by stripping them away from @@ -11891,7 +11876,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( nsLineFrame* nextLineFrame = (nsLineFrame*) lineFrame; for (;;) { - nextLineFrame->GetNextInFlow(&nextLineFrame); + nextLineFrame = nextLineFrame->GetNextInFlow(); if (!nextLineFrame) { break; } @@ -12324,8 +12309,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( // Destroy the old text frame's continuations (the old text frame // will be destroyed when its letter frame is destroyed). - nsIFrame* nextTextFrame; - textFrame->GetNextInFlow(&nextTextFrame); + nsIFrame* nextTextFrame = textFrame->GetNextInFlow(); if (nextTextFrame) { nsIFrame* nextTextParent = nextTextFrame->GetParent(); if (nextTextParent) { @@ -13268,8 +13252,7 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsPresContext* aPresContext, // If we have a continuation frame, then we need to break the // continuation. - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nextInFlow) { aFrame->SetNextInFlow(nsnull); nextInFlow->SetPrevInFlow(nsnull); diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index eeae52f1fc9..60ff6f6bd12 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -145,8 +145,7 @@ protected: { NS_PRECONDITION(aFrame, "Need a frame"); - nsIFrame *prevInFlow = nsnull; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame *prevInFlow = aFrame->GetPrevInFlow(); if (!prevInFlow || mFrame != prevInFlow) { // Ok, we've got the wrong frame. We have to start from scratch. @@ -163,18 +162,17 @@ protected: } void Init(nsIFrame* aFrame) - { - nsIFrame* inlineFrame; + { // Start with the previous flow frame as our continuation point // is the total of the widths of the previous frames. - aFrame->GetPrevInFlow(&inlineFrame); + nsIFrame* inlineFrame = aFrame->GetPrevInFlow(); while (inlineFrame) { nsRect rect = inlineFrame->GetRect(); mContinuationPoint += rect.width; mUnbrokenWidth += rect.width; mBoundingBox.UnionRect(mBoundingBox, rect); - inlineFrame->GetPrevInFlow(&inlineFrame); + inlineFrame = inlineFrame->GetPrevInFlow(); } // Next add this frame and subsequent frames to the bounding box and @@ -184,7 +182,7 @@ protected: nsRect rect = inlineFrame->GetRect(); mUnbrokenWidth += rect.width; mBoundingBox.UnionRect(mBoundingBox, rect); - inlineFrame->GetNextInFlow(&inlineFrame); + inlineFrame = inlineFrame->GetNextInFlow(); } mFrame = aFrame; diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 37d82603967..19735fc2064 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -3203,7 +3203,7 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) if (aType == nsIWebBrowserPrint::PRINTPREVIEW_PREV_PAGE) { if (currentPage) { - currentPage->GetPrevInFlow(&fndPageFrame); + fndPageFrame = currentPage->GetPrevInFlow(); if (!fndPageFrame) { return NS_OK; } @@ -3212,7 +3212,7 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) } } else if (aType == nsIWebBrowserPrint::PRINTPREVIEW_NEXT_PAGE) { if (currentPage) { - currentPage->GetNextInFlow(&fndPageFrame); + fndPageFrame = currentPage->GetNextInFlow(); if (!fndPageFrame) { return NS_OK; } diff --git a/mozilla/layout/base/nsFrameContentIterator.cpp b/mozilla/layout/base/nsFrameContentIterator.cpp index 31e0f8c46bd..18419911c87 100644 --- a/mozilla/layout/base/nsFrameContentIterator.cpp +++ b/mozilla/layout/base/nsFrameContentIterator.cpp @@ -122,8 +122,7 @@ GetNextChildFrame(nsPresContext* aPresContext, nsIFrame* aFrame) // If there's no next sibling, then check if the parent frame // has a next-in-flow and look there if (!nextSibling) { - nsIFrame* parent; - aFrame->GetParent()->GetNextInFlow(&parent); + nsIFrame* parent = aFrame->GetParent()->GetNextInFlow(); if (parent) { nextSibling = parent->GetFirstChild(nsnull); @@ -184,7 +183,7 @@ GetPrevChildFrame(nsPresContext* aPresContext, nsIFrame* aFrame) // If there's no previous sibling, then check if the parent frame // has a prev-in-flow and look there if (!prevSibling) { - parent->GetPrevInFlow(&parent); + parent = parent->GetPrevInFlow(); if (parent) { firstChild = parent->GetFirstChild(nsnull); @@ -195,8 +194,7 @@ GetPrevChildFrame(nsPresContext* aPresContext, nsIFrame* aFrame) // Get the first-in-flow while (PR_TRUE) { - nsIFrame* prevInFlow; - prevSibling->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = prevSibling->GetPrevInFlow(); if (prevInFlow) { prevSibling = prevInFlow; } else { diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 205e4111135..99933fe8e36 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -1498,8 +1498,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext, localContent->IsContentOfType(nsIContent::eELEMENT)) { // Check for a new :before pseudo and an existing :before // frame, but only if the frame is the first-in-flow. - nsIFrame* prevInFlow = nsnull; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); if (!prevInFlow) { // Checking for a :before frame is cheaper than getting the // :before style context. @@ -1524,8 +1523,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext, localContent->IsContentOfType(nsIContent::eELEMENT)) { // Check for new :after content, but only if the frame is the // first-in-flow. - nsIFrame* nextInFlow = nsnull; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (!nextInFlow) { // Getting the :after frame is more expensive than getting the pseudo @@ -1623,13 +1621,7 @@ nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame, nsIFrame* frame = aFrame; nsIFrame* frame2 = aFrame; -#ifdef DEBUG - { - nsIFrame* prevInFlow; - frame->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "must start with the first in flow"); - } -#endif + NS_ASSERTION(!frame->GetPrevInFlow(), "must start with the first in flow"); // We want to start with this frame and walk all its next-in-flows, // as well as all its special siblings and their next-in-flows, @@ -1650,15 +1642,12 @@ nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame, // If it's going to cause a framechange, then don't bother // with the continuations or special siblings since they'll be // clobbered by the frame reconstruct anyway. -#ifdef NS_DEBUG - nsIFrame* prevInFlow; - frame->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "continuing frame had more severe impact than first-in-flow"); -#endif + NS_ASSERTION(!frame->GetPrevInFlow(), + "continuing frame had more severe impact than first-in-flow"); return topLevelChange; } - frame->GetNextInFlow(&frame); + frame = frame->GetNextInFlow(); } while (frame); // Might we have special siblings? diff --git a/mozilla/layout/base/nsLayoutUtils.cpp b/mozilla/layout/base/nsLayoutUtils.cpp index 247f65d4288..69e449d78f8 100644 --- a/mozilla/layout/base/nsLayoutUtils.cpp +++ b/mozilla/layout/base/nsLayoutUtils.cpp @@ -131,11 +131,7 @@ nsIFrame* nsLayoutUtils::GetBeforeFrame(nsIFrame* aFrame, nsPresContext* aPresContext) { NS_PRECONDITION(aFrame, "NULL frame pointer"); -#ifdef DEBUG - nsIFrame* prevInFlow = nsnull; - aFrame->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "aFrame must be first-in-flow"); -#endif + NS_ASSERTION(!aFrame->GetPrevInFlow(), "aFrame must be first-in-flow"); nsIFrame* firstFrame = GetFirstChildFrame(aPresContext, aFrame, aFrame->GetContent()); diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index b8268bc076e..baee4f7ba37 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -825,9 +825,9 @@ public: /** * Flow member functions */ - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const = 0; + virtual nsIFrame* GetPrevInFlow() const = 0; NS_IMETHOD SetPrevInFlow(nsIFrame*) = 0; - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const = 0; + virtual nsIFrame* GetNextInFlow() const = 0; NS_IMETHOD SetNextInFlow(nsIFrame*) = 0; /** diff --git a/mozilla/layout/base/src/nsBidiPresUtils.cpp b/mozilla/layout/base/src/nsBidiPresUtils.cpp index 6d216f093a5..03544d26e05 100644 --- a/mozilla/layout/base/src/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/src/nsBidiPresUtils.cpp @@ -803,7 +803,7 @@ nsBidiPresUtils::RemoveBidiContinuation(nsPresContext* aPresContext, frame = aFrame; do { propTable->DeleteProperty(frame, nsLayoutAtoms::nextBidi); - frame->GetPrevInFlow(&frame); + frame = frame->GetPrevInFlow(); if (!frame) { break; } diff --git a/mozilla/layout/base/src/nsLayoutUtils.cpp b/mozilla/layout/base/src/nsLayoutUtils.cpp index 247f65d4288..69e449d78f8 100644 --- a/mozilla/layout/base/src/nsLayoutUtils.cpp +++ b/mozilla/layout/base/src/nsLayoutUtils.cpp @@ -131,11 +131,7 @@ nsIFrame* nsLayoutUtils::GetBeforeFrame(nsIFrame* aFrame, nsPresContext* aPresContext) { NS_PRECONDITION(aFrame, "NULL frame pointer"); -#ifdef DEBUG - nsIFrame* prevInFlow = nsnull; - aFrame->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "aFrame must be first-in-flow"); -#endif + NS_ASSERTION(!aFrame->GetPrevInFlow(), "aFrame must be first-in-flow"); nsIFrame* firstFrame = GetFirstChildFrame(aPresContext, aFrame, aFrame->GetContent()); diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index eb78a3b9704..91c7e167f49 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -827,8 +827,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, NS_ASSERTION(NS_SUCCEEDED(rv), "reflow dirty lines failed"); if (NS_FAILED(rv)) return rv; - nsIFrame* nextInFlow; - GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = GetNextInFlow(); if (nextInFlow && NS_FRAME_IS_NOT_COMPLETE(state.mReflowStatus)) { if (GetOverflowLines() || GetOverflowPlaceholders()) { state.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW; @@ -1243,7 +1242,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (mPrevInFlow) { // Reduce the height by the height of prev-in-flows. The last-in-flow will automatically // pick up the bottom border/padding, since it was part of the original aMetrics.height. - for (nsIFrame* prev = mPrevInFlow; prev; prev->GetPrevInFlow(&prev)) { + for (nsIFrame* prev = mPrevInFlow; prev; prev = prev->GetPrevInFlow()) { aMetrics.height -= prev->GetRect().height; // XXX: All block level next-in-flows have borderPadding.top applied to them (bug 174688). // The following should be removed when this gets fixed. bug 174688 prevents us from honoring @@ -1461,8 +1460,7 @@ nsBlockFrame::PrepareChildIncrementalReflow(nsBlockReflowState& aState) // of the continuations. This will allow the incremental // reflow to arrive at the target frame during the first-pass // unconstrained reflow. - nsIFrame *prevInFlow; - (*iter)->GetPrevInFlow(&prevInFlow); + nsIFrame *prevInFlow = (*iter)->GetPrevInFlow(); if (prevInFlow) RetargetInlineIncrementalReflow(iter, line, prevInFlow); } @@ -1507,7 +1505,7 @@ nsBlockFrame::RetargetInlineIncrementalReflow(nsReflowPath::iterator &aTarget, break; *aTarget = aPrevInFlow; - aPrevInFlow->GetPrevInFlow(&aPrevInFlow); + aPrevInFlow = aPrevInFlow->GetPrevInFlow(); #ifdef DEBUG // Paranoia. Ensure that the prev-in-flow is really in the @@ -1548,7 +1546,7 @@ nsBlockFrame::RetargetInlineIncrementalReflow(nsReflowPath::iterator &aTarget, PRInt32 count = lineCount; nsIFrame *prevInFlow; do { - frame->GetPrevInFlow(&prevInFlow); + prevInFlow = frame->GetPrevInFlow(); } while (--count >= 0 && prevInFlow && (frame = prevInFlow)); path->ReplaceElementAt(frame, i); @@ -2975,8 +2973,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // apply its top margin because its not significant. Otherwise, dig // deeper. PRBool applyTopMargin = PR_FALSE; - nsIFrame* framePrevInFlow; - frame->GetPrevInFlow(&framePrevInFlow); + nsIFrame* framePrevInFlow = frame->GetPrevInFlow(); if (nsnull == framePrevInFlow) { applyTopMargin = ShouldApplyTopMargin(aState, aLine); } @@ -4746,8 +4743,7 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsPresContext* aPresContext, nsIFrame* aFrame) { // First remove aFrame's next in flow - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nextInFlow) { nsBlockFrame::DoRemoveOutOfFlowFrame(aPresContext, nextInFlow); } @@ -4890,8 +4886,7 @@ nsBlockFrame::DoRemoveFrame(nsPresContext* aPresContext, // Destroy frame; capture its next-in-flow first in case we need // to destroy that too. - nsIFrame* nextInFlow; - aDeletedFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aDeletedFrame->GetNextInFlow(); #ifdef NOISY_REMOVE_FRAME printf("DoRemoveFrame: line=%p frame=", line); nsFrame::ListTag(stdout, aDeletedFrame); @@ -4973,8 +4968,7 @@ void nsBlockFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, nsIFrame* aNextInFlow) { - nsIFrame* prevInFlow; - aNextInFlow->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aNextInFlow->GetPrevInFlow(); NS_PRECONDITION(prevInFlow, "bad next-in-flow"); NS_PRECONDITION(IsChild(aNextInFlow), "bad geometric parent"); @@ -4997,8 +4991,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, nsReflowStatus& aReflowStatus) { // Delete the placeholder's next in flows, if any - nsIFrame* nextInFlow; - aPlaceholder->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aPlaceholder->GetNextInFlow(); if (nextInFlow) { // If aPlaceholder's parent is an inline, nextInFlow's will be a block. NS_STATIC_CAST(nsHTMLContainerFrame*, nextInFlow->GetParent()) @@ -5025,8 +5018,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, else { const nsStyleDisplay* floatDisplay = floatFrame->GetStyleDisplay(); - nsIFrame* prevInFlow; - floatFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = floatFrame->GetPrevInFlow(); // if the float is continued, constrain its width to the prev-in-flow's width if (prevInFlow) { availWidth = prevInFlow->GetRect().width; @@ -5168,8 +5160,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, // If the placeholder was continued and its first-in-flow was followed by a //
, then cache the
's break type in aState.mFloatBreakType so that // the next frame after the placeholder can combine that break type with its own - nsIFrame* prevPlaceholder = nsnull; - aPlaceholder->GetPrevInFlow(&prevPlaceholder); + nsIFrame* prevPlaceholder = aPlaceholder->GetPrevInFlow(); if (prevPlaceholder) { // the break occurs only after the last continued placeholder PRBool lastPlaceholder = PR_TRUE; @@ -6155,8 +6146,7 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) // and placeholders don't satisfy InSiblingList(). PRBool skipLineList = PR_FALSE; PRBool skipSiblingList = PR_FALSE; - nsIFrame* prevInFlow; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); if (prevInFlow) { nsFrameState state = aFrame->GetStateBits(); skipLineList = (state & NS_FRAME_OUT_OF_FLOW); @@ -6359,7 +6349,7 @@ nsBlockFrame::RenumberListsInBlock(nsPresContext* aPresContext, } // Advance to the next continuation - aBlockFrame->GetNextInFlow((nsIFrame**) &aBlockFrame); + aBlockFrame = NS_STATIC_CAST(nsBlockFrame*, aBlockFrame->GetNextInFlow()); } return renumberedABullet; diff --git a/mozilla/layout/generic/nsBlockReflowContext.cpp b/mozilla/layout/generic/nsBlockReflowContext.cpp index 1117e1c2fae..021b9a25b6a 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.cpp +++ b/mozilla/layout/generic/nsBlockReflowContext.cpp @@ -617,8 +617,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace, // the frame is going to get reflowed again (and may end up wanting // a next-in-flow where it ends up), unless it is an out of flow frame. if (NS_FRAME_IS_COMPLETE(aFrameReflowStatus)) { - nsIFrame* kidNextInFlow; - mFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = mFrame->GetNextInFlow(); if (nsnull != kidNextInFlow) { // Remove all of the childs next-in-flows. Make sure that we ask // the right parent to do the removal (it's possible that the diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index c644b5d9a86..0a3accdb217 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -99,7 +99,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, mReflowStatus = NS_FRAME_COMPLETE; mPresContext = aPresContext; - mBlock->GetNextInFlow(NS_REINTERPRET_CAST(nsIFrame**, &mNextInFlow)); + mNextInFlow = NS_STATIC_CAST(nsBlockFrame*, mBlock->GetNextInFlow()); mKidXMost = 0; // Compute content area width (the content area is inside the border @@ -953,17 +953,15 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache, } // If the float is continued, it will get the same absolute x value as its prev-in-flow nsRect prevRect(0,0,0,0); - nsIFrame* prevInFlow; - floatFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = floatFrame->GetPrevInFlow(); if (prevInFlow) { prevRect = prevInFlow->GetRect(); - nsIFrame *placeParentPrev, *prevPlace; // If prevInFlow's placeholder is in a block that wasn't continued, we need to adjust // prevRect.x to account for the missing frame offsets. nsIFrame* placeParent = placeholder->GetParent(); - placeParent->GetPrevInFlow(&placeParentPrev); - prevPlace = + nsIFrame* placeParentPrev = placeParent->GetPrevInFlow(); + nsIFrame* prevPlace = mPresContext->FrameManager()->GetPlaceholderFrameFor(prevInFlow); nsIFrame* prevPlaceParent = prevPlace->GetParent(); diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 0ce9fd3b615..e065b06d262 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -991,8 +991,7 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame, // If the reflow was successful and the child frame is complete, delete any // next-in-flows if (NS_SUCCEEDED(result) && NS_FRAME_IS_COMPLETE(aStatus)) { - nsIFrame* kidNextInFlow; - aKidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = aKidFrame->GetNextInFlow(); if (nsnull != kidNextInFlow) { // Remove all of the childs next-in-flows. Make sure that we ask // the right parent to do the removal (it's possible that the @@ -1107,15 +1106,13 @@ void nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, nsIFrame* aNextInFlow) { - nsIFrame* prevInFlow; - aNextInFlow->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aNextInFlow->GetPrevInFlow(); NS_PRECONDITION(prevInFlow, "bad prev-in-flow"); NS_PRECONDITION(mFrames.ContainsFrame(aNextInFlow), "bad geometric parent"); // If the next-in-flow has a next-in-flow then delete it, too (and // delete it first). - nsIFrame* nextNextInFlow; - aNextInFlow->GetNextInFlow(&nextNextInFlow); + nsIFrame* nextNextInFlow = aNextInFlow->GetNextInFlow(); if (nextNextInFlow) { NS_STATIC_CAST(nsContainerFrame*, nextNextInFlow->GetParent()) ->DeleteNextInFlowChild(aPresContext, nextNextInFlow); @@ -1153,11 +1150,7 @@ nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, // Delete the next-in-flow frame and its descendants. aNextInFlow->Destroy(aPresContext); -#ifdef NS_DEBUG - nsIFrame* nextInFlow; - prevInFlow->GetNextInFlow(&nextInFlow); - NS_POSTCONDITION(!nextInFlow, "non null next-in-flow"); -#endif + NS_POSTCONDITION(!prevInFlow->GetNextInFlow(), "non null next-in-flow"); } nsIFrame* diff --git a/mozilla/layout/generic/nsFirstLetterFrame.cpp b/mozilla/layout/generic/nsFirstLetterFrame.cpp index 3cbf8c847ac..11a672dce8e 100644 --- a/mozilla/layout/generic/nsFirstLetterFrame.cpp +++ b/mozilla/layout/generic/nsFirstLetterFrame.cpp @@ -292,8 +292,7 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext, // Create a continuation or remove existing continuations based on // the reflow completion status. if (NS_FRAME_IS_COMPLETE(aReflowStatus)) { - nsIFrame* kidNextInFlow; - kid->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kid->GetNextInFlow(); if (kidNextInFlow) { // Remove all of the childs next-in-flows NS_STATIC_CAST(nsContainerFrame*, kidNextInFlow->GetParent()) diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index a50cbdd7021..2d0501504bb 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -1221,9 +1221,8 @@ ContentContainsPoint(nsPresContext *aPresContext, return PR_TRUE; } - rv = frame->GetNextInFlow(&frame); + frame = frame->GetNextInFlow(); - if (NS_FAILED(rv)) return PR_FALSE; } return PR_FALSE; @@ -2100,8 +2099,7 @@ nsFrame::DidReflow(nsPresContext* aPresContext, aReflowState->mStylePosition && // percent height (eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) { - nsIFrame* prevInFlow; - GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = GetPrevInFlow(); if (!prevInFlow) { // 1st in flow aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState); } @@ -2181,10 +2179,9 @@ NS_IMETHODIMP nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } -NS_IMETHODIMP nsFrame::GetPrevInFlow(nsIFrame** aPrevInFlow) const +nsIFrame* nsFrame::GetPrevInFlow() const { - *aPrevInFlow = nsnull; - return NS_OK; + return nsnull; } NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame* aPrevInFlow) @@ -2198,10 +2195,9 @@ NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame* aPrevInFlow) return NS_OK; } -NS_IMETHODIMP nsFrame::GetNextInFlow(nsIFrame** aNextInFlow) const +nsIFrame* nsFrame::GetNextInFlow() const { - *aNextInFlow = nsnull; - return NS_OK; + return nsnull; } NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*) @@ -3042,10 +3038,10 @@ nsFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, P nsRect rect = GetRect(); if (!rect.width || !rect.height) { - nsIFrame *nextFlow = nsnull; //if we have a 0 width or height then lets look for another frame that possibly has //the same content. If we have no frames in flow then just let us return 'this' frame - if (NS_SUCCEEDED(GetNextInFlow(&nextFlow)) && nextFlow) + nsIFrame* nextFlow = GetNextInFlow(); + if (nextFlow) return nextFlow->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame); } *outChildFrame = this; @@ -5262,12 +5258,11 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext, DR_state->PrettyUC(aReflowState.mComputedHeight, height); printf("c=%s,%s ", width, height); - nsIFrame* inFlow; - aFrame->GetPrevInFlow(&inFlow); + nsIFrame* inFlow = aFrame->GetPrevInFlow(); if (inFlow) { printf("pif=%p ", (void*)inFlow); } - aFrame->GetNextInFlow(&inFlow); + inFlow = aFrame->GetNextInFlow(); if (inFlow) { printf("nif=%p ", (void*)inFlow); } diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 0a83d825ad7..1535e46fde4 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -232,9 +232,9 @@ public: nsIAtom* aAttribute, PRInt32 aModType); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; + virtual nsIFrame* GetPrevInFlow() const; NS_IMETHOD SetPrevInFlow(nsIFrame*); - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const; + virtual nsIFrame* GetNextInFlow() const; NS_IMETHOD SetNextInFlow(nsIFrame*); NS_IMETHOD GetOffsetFromView(nsPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const; NS_IMETHOD GetOriginToViewOffset(nsPresContext *aPresContext, nsPoint& aOffset, nsIView **aView) const; diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index cd1371dfc23..db2d194acee 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -248,7 +248,7 @@ HasTextFrameDescendant(nsPresContext* aPresContext, nsIFrame* aParent) static PRBool HasTextFrameDescendantOrInFlow(nsPresContext* aPresContext, nsIFrame* aFrame) { - for (nsIFrame *f = aFrame->GetFirstInFlow(); f; f->GetNextInFlow(&f)) { + for (nsIFrame *f = aFrame->GetFirstInFlow(); f; f = f->GetNextInFlow()) { if (HasTextFrameDescendant(aPresContext, f)) return PR_TRUE; } @@ -311,8 +311,7 @@ nsHTMLContainerFrame::CreateNextInFlow(nsPresContext* aPresContext, { aNextInFlowResult = nsnull; - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nsnull == nextInFlow) { // Create a continuation frame for the child frame and insert it // into our lines child list. diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index fe52fdb8ff4..065afb927af 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -1384,8 +1384,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) } } else if (nsLayoutAtoms::pageContentFrame == frameType) { - nsIFrame* prevInFlow; - rs->frame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = rs->frame->GetPrevInFlow(); // only use the page content frame for a height basis if it is the first in flow if (prevInFlow) break; diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index b8268bc076e..baee4f7ba37 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -825,9 +825,9 @@ public: /** * Flow member functions */ - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const = 0; + virtual nsIFrame* GetPrevInFlow() const = 0; NS_IMETHOD SetPrevInFlow(nsIFrame*) = 0; - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const = 0; + virtual nsIFrame* GetNextInFlow() const = 0; NS_IMETHOD SetNextInFlow(nsIFrame*) = 0; /** diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 110484e17e9..3c48bb1fc96 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -933,7 +933,7 @@ nsImageFrame::GetContinuationOffset(nscoord* aWidth) const } if (mPrevInFlow) { - for (nsIFrame* prevInFlow = mPrevInFlow ; prevInFlow; prevInFlow->GetPrevInFlow(&prevInFlow)) { + for (nsIFrame* prevInFlow = mPrevInFlow ; prevInFlow; prevInFlow = prevInFlow->GetPrevInFlow()) { nsRect rect = prevInFlow->GetRect(); if (aWidth) { *aWidth = rect.width; @@ -1019,12 +1019,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext, aMetrics.descent = 0; if (aMetrics.mComputeMEW) { - // If we have a percentage based width, then our MEW is 0 - if (eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit()) { - aMetrics.mMaxElementWidth = 0; - } else { - aMetrics.mMaxElementWidth = aMetrics.width; - } + aMetrics.SetMEWToActualWidth(aReflowState.mStylePosition->mWidth.GetUnit()); } if (aMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) { diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 1de294c267e..230abed746e 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -261,8 +261,7 @@ nsInlineFrame::RemoveFrame(nsPresContext* aPresContext, // When the parent is an inline frame we have a simple task - just // remove the frame from its parents list and generate a reflow // command. - nsIFrame* oldFrameNextInFlow; - aOldFrame->GetNextInFlow(&oldFrameNextInFlow); + nsIFrame* oldFrameNextInFlow = aOldFrame->GetNextInFlow(); parent->mFrames.DestroyFrame(aPresContext, aOldFrame); aOldFrame = oldFrameNextInFlow; if (aOldFrame) { @@ -514,8 +513,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext, // its parent frame pointer, too. Otherwise, if we reflow frame and it's // complete we'll fail when deleting its next-in-flow which is no longer // needed. This scenario doesn't happen often, but it can happen - nsIFrame* nextInFlow; - frame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = frame->GetNextInFlow(); while (nextInFlow) { // Since we only do lazy setting of parent pointers for the frame's // initial reflow, this frame can't have a next-in-flow. That means @@ -523,7 +521,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext, // not, then something is wrong NS_ASSERTION(mFrames.ContainsFrame(nextInFlow), "unexpected flow"); nextInFlow->SetParent(this); - nextInFlow->GetNextInFlow(&nextInFlow); + nextInFlow = nextInFlow->GetNextInFlow(); } } rv = ReflowInlineFrame(aPresContext, aReflowState, irs, frame, aStatus); diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 03e94b4c984..d0a8e470526 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -230,8 +230,7 @@ PRBool nsLineLayout::AllocateDeque() inline PRBool HasPrevInFlow(nsIFrame *aFrame) { - nsIFrame *prevInFlow; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame *prevInFlow = aFrame->GetPrevInFlow(); return prevInFlow != nsnull; } @@ -1151,8 +1150,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // the frame is going to get reflowed again (and may end up wanting // a next-in-flow where it ends up). if (NS_FRAME_IS_COMPLETE(aReflowStatus)) { - nsIFrame* kidNextInFlow; - aFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = aFrame->GetNextInFlow(); if (nsnull != kidNextInFlow) { // Remove all of the childs next-in-flows. Make sure that we ask // the right parent to do the removal (it's possible that the @@ -1203,8 +1201,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, PRInt32 newEnd; aFrame->GetOffsets(start, newEnd); if (newEnd != end) { - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nextInFlow) { nextInFlow->GetOffsets(start, end); nextInFlow->AdjustOffsetsForBidi(newEnd, end); @@ -1387,11 +1384,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, // If this is a piece of text inside a letter frame... if (pfd->GetFlag(PFD_ISNONEMPTYTEXTFRAME)) { if (psd->mFrame && psd->mFrame->GetFlag(PFD_ISLETTERFRAME)) { - nsIFrame* prevInFlow; - psd->mFrame->mFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = psd->mFrame->mFrame->GetPrevInFlow(); if (prevInFlow) { - nsIFrame* prevPrevInFlow; - prevInFlow->GetPrevInFlow(&prevPrevInFlow); + nsIFrame* prevPrevInFlow = prevInFlow->GetPrevInFlow(); if (!prevPrevInFlow) { // And it's the first continuation of the letter frame... // Then make sure that the text fits @@ -1402,11 +1397,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, } else if (pfd->GetFlag(PFD_ISLETTERFRAME)) { // If this is the first continuation of the letter frame... - nsIFrame* prevInFlow; - pfd->mFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = pfd->mFrame->GetPrevInFlow(); if (prevInFlow) { - nsIFrame* prevPrevInFlow; - prevInFlow->GetPrevInFlow(&prevPrevInFlow); + nsIFrame* prevPrevInFlow = prevInFlow->GetPrevInFlow(); if (!prevPrevInFlow) { return PR_TRUE; } @@ -1929,10 +1922,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // - it has a prev-in-flow // - it has no next in flow // - it's zero sized - nsIFrame* spanNextInFlow; - spanFrame->GetNextInFlow(&spanNextInFlow); - nsIFrame* spanPrevInFlow; - spanFrame->GetPrevInFlow(&spanPrevInFlow); + nsIFrame* spanNextInFlow = spanFrame->GetNextInFlow(); + nsIFrame* spanPrevInFlow = spanFrame->GetPrevInFlow(); PRBool emptyContinuation = spanPrevInFlow && !spanNextInFlow && (0 == spanFramePFD->mBounds.width) && (0 == spanFramePFD->mBounds.height); diff --git a/mozilla/layout/generic/nsPageContentFrame.cpp b/mozilla/layout/generic/nsPageContentFrame.cpp index 1e76bba764a..b33c5fef664 100644 --- a/mozilla/layout/generic/nsPageContentFrame.cpp +++ b/mozilla/layout/generic/nsPageContentFrame.cpp @@ -117,15 +117,8 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsPresContext* aPresContext, // Place and size the child FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, 0, 0, 0); -#ifdef NS_DEBUG - // Is the frame complete? - if (NS_FRAME_IS_COMPLETE(aStatus)) { - nsIFrame* childNextInFlow; - - frame->GetNextInFlow(&childNextInFlow); - NS_ASSERTION(nsnull == childNextInFlow, "bad child flow list"); - } -#endif + NS_ASSERTION(!NS_FRAME_IS_COMPLETE(aStatus) || + !frame->GetNextInFlow(), "bad child flow list"); #ifdef DEBUG_PRINTING nsRect r = frame->GetRect(); diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 14941e08a23..97181eb3dd4 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -221,15 +221,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsPresContext* aPresContext, view->GetViewManager()->SetViewChildClipRegion(view, ®ion); } -#ifdef NS_DEBUG - // Is the frame complete? - if (NS_FRAME_IS_COMPLETE(aStatus)) { - nsIFrame* childNextInFlow; - - frame->GetNextInFlow(&childNextInFlow); - NS_ASSERTION(nsnull == childNextInFlow, "bad child flow list"); - } -#endif + NS_ASSERTION(!NS_FRAME_IS_COMPLETE(aStatus) || + !frame->GetNextInFlow(), "bad child flow list"); } PR_PL(("PageFrame::Reflow %p ", this)); PR_PL(("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.availableWidth, aReflowState.availableHeight)); diff --git a/mozilla/layout/generic/nsSelection.cpp b/mozilla/layout/generic/nsSelection.cpp index 0bbef348a1d..6d3560a4732 100644 --- a/mozilla/layout/generic/nsSelection.cpp +++ b/mozilla/layout/generic/nsSelection.cpp @@ -4839,7 +4839,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext, while (!frameRect.width || !frameRect.height) { //try to notify next in flow that its content is selected. - if (NS_SUCCEEDED(frame->GetNextInFlow(&frame)) && frame) + frame = frame->GetNextInFlow(); + if (frame) { frameRect = frame->GetRect(); frame->SetSelected(aPresContext, nsnull,aFlags,eSpreadDown); diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 1dcab054be3..10af040c3a7 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -428,8 +428,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext, y += deadSpaceGap; // Is the page complete? - nsIFrame* kidNextInFlow; - kidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow(); if (NS_FRAME_IS_COMPLETE(status)) { NS_ASSERTION(nsnull == kidNextInFlow, "bad child flow list"); diff --git a/mozilla/layout/generic/nsSplittableFrame.cpp b/mozilla/layout/generic/nsSplittableFrame.cpp index 10cf15ee0e1..c13d5fef751 100644 --- a/mozilla/layout/generic/nsSplittableFrame.cpp +++ b/mozilla/layout/generic/nsSplittableFrame.cpp @@ -78,10 +78,9 @@ nsSplittableFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } -NS_METHOD nsSplittableFrame::GetPrevInFlow(nsIFrame** aPrevInFlow) const +nsIFrame* nsSplittableFrame::GetPrevInFlow() const { - *aPrevInFlow = mPrevInFlow; - return NS_OK; + return mPrevInFlow; } NS_METHOD nsSplittableFrame::SetPrevInFlow(nsIFrame* aFrame) @@ -90,10 +89,9 @@ NS_METHOD nsSplittableFrame::SetPrevInFlow(nsIFrame* aFrame) return NS_OK; } -NS_METHOD nsSplittableFrame::GetNextInFlow(nsIFrame** aNextInFlow) const +nsIFrame* nsSplittableFrame::GetNextInFlow() const { - *aNextInFlow = mNextInFlow; - return NS_OK; + return mNextInFlow; } NS_METHOD nsSplittableFrame::SetNextInFlow(nsIFrame* aFrame) @@ -126,11 +124,8 @@ nsIFrame* nsSplittableFrame::GetLastInFlow() const void nsSplittableFrame::RemoveFromFlow(nsIFrame* aFrame) { - nsIFrame* prevInFlow; - nsIFrame* nextInFlow; - - aFrame->GetPrevInFlow(&prevInFlow); - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (prevInFlow) { prevInFlow->SetNextInFlow(nextInFlow); @@ -148,25 +143,13 @@ nsSplittableFrame::RemoveFromFlow(nsIFrame* aFrame) void nsSplittableFrame::BreakFromPrevFlow(nsIFrame* aFrame) { - nsIFrame* prevInFlow; - - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); if (prevInFlow) { prevInFlow->SetNextInFlow(nsnull); aFrame->SetPrevInFlow(nsnull); } } -nsIFrame * nsSplittableFrame::GetPrevInFlow() -{ - return mPrevInFlow; -} - -nsIFrame * nsSplittableFrame::GetNextInFlow() -{ - return mNextInFlow; -} - #ifdef DEBUG void nsSplittableFrame::DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData) diff --git a/mozilla/layout/generic/nsSplittableFrame.h b/mozilla/layout/generic/nsSplittableFrame.h index 801ba0f64ee..769344d1887 100644 --- a/mozilla/layout/generic/nsSplittableFrame.h +++ b/mozilla/layout/generic/nsSplittableFrame.h @@ -54,9 +54,9 @@ public: NS_IMETHOD Destroy(nsPresContext* aPresContext); // Flow member functions. - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; + virtual nsIFrame* GetPrevInFlow() const; NS_IMETHOD SetPrevInFlow(nsIFrame*); - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const; + virtual nsIFrame* GetNextInFlow() const; NS_IMETHOD SetNextInFlow(nsIFrame*); /** @@ -76,9 +76,6 @@ public: // Detach from previous frame in flow static void BreakFromPrevFlow(nsIFrame* aFrame); - nsIFrame* GetPrevInFlow(); - nsIFrame* GetNextInFlow(); - protected: #ifdef DEBUG virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData); diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index e44c76e6829..8bad9682b82 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -404,9 +404,8 @@ public: nsIContent* aChild, PRBool aAppend); - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const { - *aNextInFlow = mNextInFlow; - return NS_OK; + virtual nsIFrame* GetNextInFlow() const { + return mNextInFlow; } NS_IMETHOD SetNextInFlow(nsIFrame* aNextInFlow) { mNextInFlow = aNextInFlow; @@ -843,9 +842,8 @@ public: NS_IMETHOD Destroy(nsPresContext* aPresContext); - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const { - *aPrevInFlow = mPrevInFlow; - return NS_OK; + virtual nsIFrame* GetPrevInFlow() const { + return mPrevInFlow; } NS_IMETHOD SetPrevInFlow(nsIFrame* aPrevInFlow) { mPrevInFlow = aPrevInFlow; @@ -925,7 +923,7 @@ nsContinuingTextFrame::GetFirstInFlow() const NS_STATIC_CAST(const nsIFrame*, this)); do { firstInFlow = previous; - firstInFlow->GetPrevInFlow(&previous); + previous = firstInFlow->GetPrevInFlow(); } while (previous); return firstInFlow; } @@ -3568,7 +3566,6 @@ nsTextFrame::SetSelected(nsPresContext* aPresContext, PRBool aSelected, nsSpread aSpread) { - nsresult result; if (aSelected && ParentDisablesSelection()) return NS_OK; @@ -3685,20 +3682,15 @@ nsTextFrame::SetSelected(nsPresContext* aPresContext, } if (aSpread == eSpreadDown) { - nsIFrame *frame; - GetPrevInFlow(&frame); + nsIFrame* frame = GetPrevInFlow(); while(frame){ frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); - result = frame->GetPrevInFlow(&frame); - if (NS_FAILED(result)) - break; + frame = frame->GetPrevInFlow(); } - GetNextInFlow(&frame); + frame = GetNextInFlow(); while (frame){ frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); - result = frame->GetNextInFlow(&frame); - if (NS_FAILED(result)) - break; + frame = frame->GetNextInFlow(); } #ifdef IBMBIDI if ((mState & NS_FRAME_IS_BIDI) && @@ -3831,7 +3823,6 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, { if (nsnull == outChildFrame) return NS_ERROR_NULL_POINTER; - nsresult result; PRInt32 contentOffset = inContentOffset; if (contentOffset != -1) //-1 signified the end of the current content @@ -3840,8 +3831,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, if ((contentOffset > mContentLength) || ((contentOffset == mContentLength) && inHint) ) { //this is not the frame we are looking for. - nsIFrame *nextInFlow; - GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = GetNextInFlow(); if (nextInFlow) { return nextInFlow->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame); @@ -3873,12 +3863,12 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, if (inContentOffset < mContentOffset) //could happen with floats! { - result = GetPrevInFlow(outChildFrame); - if (NS_SUCCEEDED(result) && *outChildFrame) + *outChildFrame = GetPrevInFlow(); + if (*outChildFrame) return (*outChildFrame)->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset,outChildFrame); else - return result; + return NS_OK; //this can't be the right thing to do? } *outFrameContentOffset = contentOffset; @@ -3915,7 +3905,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) } else #endif - GetNextInFlow(&nextInFlow); + nextInFlow = GetNextInFlow(); if (!nextInFlow){ NS_ASSERTION(PR_FALSE,"nsTextFrame::PeekOffset no more flow \n"); return NS_ERROR_INVALID_ARG; @@ -4040,7 +4030,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) if (i <0){ found = PR_FALSE; - GetPrevInFlow(&frameUsed); + frameUsed = GetPrevInFlow(); start = mContentOffset; aPos->mContentOffset = start;//in case next call fails we stop at this offset } @@ -4095,7 +4085,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) */ if (i > mContentLength){ found = PR_FALSE; - GetNextInFlow(&frameUsed); + frameUsed = GetNextInFlow(); start = mContentOffset + mContentLength; aPos->mContentOffset = start;//in case next call fails we stop at this offset } @@ -4250,7 +4240,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) } TryNextFrame: - GetNextInFlow(&frameUsed); + frameUsed = GetNextInFlow(); start = 0; } } @@ -4398,7 +4388,7 @@ nsTextFrame::CheckVisibility(nsPresContext* aContext, PRInt32 aStartIndex, PRInt rv = NS_OK; while (!aFinished && nextInFlow && NS_SUCCEEDED(rv) && !*_retval) //while we havent found anything visible { - rv = nextInFlow->GetNextInFlow(&nextInFlow); + nextInFlow = nextInFlow->GetNextInFlow(); if (nextInFlow) { rv = nextInFlow->CheckVisibility(aContext,aStartIndex,aEndIndex,PR_FALSE,aFinished,_retval); @@ -5186,9 +5176,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext, // Get starting offset into the content PRInt32 startingOffset = 0; - nsIFrame* prevInFlow; - - GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = GetPrevInFlow(); if (nsnull != prevInFlow) { nsTextFrame* prev = (nsTextFrame*)prevInFlow; startingOffset = prev->mContentOffset + prev->mContentLength; @@ -5912,8 +5900,7 @@ nsTextFrame::List(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent) const if (nsnull != mNextSibling) { fprintf(out, " next=%p", NS_STATIC_CAST(void*, mNextSibling)); } - nsIFrame* prevInFlow; - GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = GetPrevInFlow(); if (nsnull != prevInFlow) { fprintf(out, " prev-in-flow=%p", NS_STATIC_CAST(void*, prevInFlow)); } diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index eb78a3b9704..91c7e167f49 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -827,8 +827,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, NS_ASSERTION(NS_SUCCEEDED(rv), "reflow dirty lines failed"); if (NS_FAILED(rv)) return rv; - nsIFrame* nextInFlow; - GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = GetNextInFlow(); if (nextInFlow && NS_FRAME_IS_NOT_COMPLETE(state.mReflowStatus)) { if (GetOverflowLines() || GetOverflowPlaceholders()) { state.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW; @@ -1243,7 +1242,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (mPrevInFlow) { // Reduce the height by the height of prev-in-flows. The last-in-flow will automatically // pick up the bottom border/padding, since it was part of the original aMetrics.height. - for (nsIFrame* prev = mPrevInFlow; prev; prev->GetPrevInFlow(&prev)) { + for (nsIFrame* prev = mPrevInFlow; prev; prev = prev->GetPrevInFlow()) { aMetrics.height -= prev->GetRect().height; // XXX: All block level next-in-flows have borderPadding.top applied to them (bug 174688). // The following should be removed when this gets fixed. bug 174688 prevents us from honoring @@ -1461,8 +1460,7 @@ nsBlockFrame::PrepareChildIncrementalReflow(nsBlockReflowState& aState) // of the continuations. This will allow the incremental // reflow to arrive at the target frame during the first-pass // unconstrained reflow. - nsIFrame *prevInFlow; - (*iter)->GetPrevInFlow(&prevInFlow); + nsIFrame *prevInFlow = (*iter)->GetPrevInFlow(); if (prevInFlow) RetargetInlineIncrementalReflow(iter, line, prevInFlow); } @@ -1507,7 +1505,7 @@ nsBlockFrame::RetargetInlineIncrementalReflow(nsReflowPath::iterator &aTarget, break; *aTarget = aPrevInFlow; - aPrevInFlow->GetPrevInFlow(&aPrevInFlow); + aPrevInFlow = aPrevInFlow->GetPrevInFlow(); #ifdef DEBUG // Paranoia. Ensure that the prev-in-flow is really in the @@ -1548,7 +1546,7 @@ nsBlockFrame::RetargetInlineIncrementalReflow(nsReflowPath::iterator &aTarget, PRInt32 count = lineCount; nsIFrame *prevInFlow; do { - frame->GetPrevInFlow(&prevInFlow); + prevInFlow = frame->GetPrevInFlow(); } while (--count >= 0 && prevInFlow && (frame = prevInFlow)); path->ReplaceElementAt(frame, i); @@ -2975,8 +2973,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // apply its top margin because its not significant. Otherwise, dig // deeper. PRBool applyTopMargin = PR_FALSE; - nsIFrame* framePrevInFlow; - frame->GetPrevInFlow(&framePrevInFlow); + nsIFrame* framePrevInFlow = frame->GetPrevInFlow(); if (nsnull == framePrevInFlow) { applyTopMargin = ShouldApplyTopMargin(aState, aLine); } @@ -4746,8 +4743,7 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsPresContext* aPresContext, nsIFrame* aFrame) { // First remove aFrame's next in flow - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nextInFlow) { nsBlockFrame::DoRemoveOutOfFlowFrame(aPresContext, nextInFlow); } @@ -4890,8 +4886,7 @@ nsBlockFrame::DoRemoveFrame(nsPresContext* aPresContext, // Destroy frame; capture its next-in-flow first in case we need // to destroy that too. - nsIFrame* nextInFlow; - aDeletedFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aDeletedFrame->GetNextInFlow(); #ifdef NOISY_REMOVE_FRAME printf("DoRemoveFrame: line=%p frame=", line); nsFrame::ListTag(stdout, aDeletedFrame); @@ -4973,8 +4968,7 @@ void nsBlockFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, nsIFrame* aNextInFlow) { - nsIFrame* prevInFlow; - aNextInFlow->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aNextInFlow->GetPrevInFlow(); NS_PRECONDITION(prevInFlow, "bad next-in-flow"); NS_PRECONDITION(IsChild(aNextInFlow), "bad geometric parent"); @@ -4997,8 +4991,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, nsReflowStatus& aReflowStatus) { // Delete the placeholder's next in flows, if any - nsIFrame* nextInFlow; - aPlaceholder->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aPlaceholder->GetNextInFlow(); if (nextInFlow) { // If aPlaceholder's parent is an inline, nextInFlow's will be a block. NS_STATIC_CAST(nsHTMLContainerFrame*, nextInFlow->GetParent()) @@ -5025,8 +5018,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, else { const nsStyleDisplay* floatDisplay = floatFrame->GetStyleDisplay(); - nsIFrame* prevInFlow; - floatFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = floatFrame->GetPrevInFlow(); // if the float is continued, constrain its width to the prev-in-flow's width if (prevInFlow) { availWidth = prevInFlow->GetRect().width; @@ -5168,8 +5160,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, // If the placeholder was continued and its first-in-flow was followed by a //
, then cache the
's break type in aState.mFloatBreakType so that // the next frame after the placeholder can combine that break type with its own - nsIFrame* prevPlaceholder = nsnull; - aPlaceholder->GetPrevInFlow(&prevPlaceholder); + nsIFrame* prevPlaceholder = aPlaceholder->GetPrevInFlow(); if (prevPlaceholder) { // the break occurs only after the last continued placeholder PRBool lastPlaceholder = PR_TRUE; @@ -6155,8 +6146,7 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) // and placeholders don't satisfy InSiblingList(). PRBool skipLineList = PR_FALSE; PRBool skipSiblingList = PR_FALSE; - nsIFrame* prevInFlow; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); if (prevInFlow) { nsFrameState state = aFrame->GetStateBits(); skipLineList = (state & NS_FRAME_OUT_OF_FLOW); @@ -6359,7 +6349,7 @@ nsBlockFrame::RenumberListsInBlock(nsPresContext* aPresContext, } // Advance to the next continuation - aBlockFrame->GetNextInFlow((nsIFrame**) &aBlockFrame); + aBlockFrame = NS_STATIC_CAST(nsBlockFrame*, aBlockFrame->GetNextInFlow()); } return renumberedABullet; diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp index 1117e1c2fae..021b9a25b6a 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp @@ -617,8 +617,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace, // the frame is going to get reflowed again (and may end up wanting // a next-in-flow where it ends up), unless it is an out of flow frame. if (NS_FRAME_IS_COMPLETE(aFrameReflowStatus)) { - nsIFrame* kidNextInFlow; - mFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = mFrame->GetNextInFlow(); if (nsnull != kidNextInFlow) { // Remove all of the childs next-in-flows. Make sure that we ask // the right parent to do the removal (it's possible that the diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index c644b5d9a86..0a3accdb217 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -99,7 +99,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, mReflowStatus = NS_FRAME_COMPLETE; mPresContext = aPresContext; - mBlock->GetNextInFlow(NS_REINTERPRET_CAST(nsIFrame**, &mNextInFlow)); + mNextInFlow = NS_STATIC_CAST(nsBlockFrame*, mBlock->GetNextInFlow()); mKidXMost = 0; // Compute content area width (the content area is inside the border @@ -953,17 +953,15 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache, } // If the float is continued, it will get the same absolute x value as its prev-in-flow nsRect prevRect(0,0,0,0); - nsIFrame* prevInFlow; - floatFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = floatFrame->GetPrevInFlow(); if (prevInFlow) { prevRect = prevInFlow->GetRect(); - nsIFrame *placeParentPrev, *prevPlace; // If prevInFlow's placeholder is in a block that wasn't continued, we need to adjust // prevRect.x to account for the missing frame offsets. nsIFrame* placeParent = placeholder->GetParent(); - placeParent->GetPrevInFlow(&placeParentPrev); - prevPlace = + nsIFrame* placeParentPrev = placeParent->GetPrevInFlow(); + nsIFrame* prevPlace = mPresContext->FrameManager()->GetPlaceholderFrameFor(prevInFlow); nsIFrame* prevPlaceParent = prevPlace->GetParent(); diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 0ce9fd3b615..e065b06d262 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -991,8 +991,7 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame, // If the reflow was successful and the child frame is complete, delete any // next-in-flows if (NS_SUCCEEDED(result) && NS_FRAME_IS_COMPLETE(aStatus)) { - nsIFrame* kidNextInFlow; - aKidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = aKidFrame->GetNextInFlow(); if (nsnull != kidNextInFlow) { // Remove all of the childs next-in-flows. Make sure that we ask // the right parent to do the removal (it's possible that the @@ -1107,15 +1106,13 @@ void nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, nsIFrame* aNextInFlow) { - nsIFrame* prevInFlow; - aNextInFlow->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aNextInFlow->GetPrevInFlow(); NS_PRECONDITION(prevInFlow, "bad prev-in-flow"); NS_PRECONDITION(mFrames.ContainsFrame(aNextInFlow), "bad geometric parent"); // If the next-in-flow has a next-in-flow then delete it, too (and // delete it first). - nsIFrame* nextNextInFlow; - aNextInFlow->GetNextInFlow(&nextNextInFlow); + nsIFrame* nextNextInFlow = aNextInFlow->GetNextInFlow(); if (nextNextInFlow) { NS_STATIC_CAST(nsContainerFrame*, nextNextInFlow->GetParent()) ->DeleteNextInFlowChild(aPresContext, nextNextInFlow); @@ -1153,11 +1150,7 @@ nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, // Delete the next-in-flow frame and its descendants. aNextInFlow->Destroy(aPresContext); -#ifdef NS_DEBUG - nsIFrame* nextInFlow; - prevInFlow->GetNextInFlow(&nextInFlow); - NS_POSTCONDITION(!nextInFlow, "non null next-in-flow"); -#endif + NS_POSTCONDITION(!prevInFlow->GetNextInFlow(), "non null next-in-flow"); } nsIFrame* diff --git a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp index 3cbf8c847ac..11a672dce8e 100644 --- a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp @@ -292,8 +292,7 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext, // Create a continuation or remove existing continuations based on // the reflow completion status. if (NS_FRAME_IS_COMPLETE(aReflowStatus)) { - nsIFrame* kidNextInFlow; - kid->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kid->GetNextInFlow(); if (kidNextInFlow) { // Remove all of the childs next-in-flows NS_STATIC_CAST(nsContainerFrame*, kidNextInFlow->GetParent()) diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index a50cbdd7021..2d0501504bb 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -1221,9 +1221,8 @@ ContentContainsPoint(nsPresContext *aPresContext, return PR_TRUE; } - rv = frame->GetNextInFlow(&frame); + frame = frame->GetNextInFlow(); - if (NS_FAILED(rv)) return PR_FALSE; } return PR_FALSE; @@ -2100,8 +2099,7 @@ nsFrame::DidReflow(nsPresContext* aPresContext, aReflowState->mStylePosition && // percent height (eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) { - nsIFrame* prevInFlow; - GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = GetPrevInFlow(); if (!prevInFlow) { // 1st in flow aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState); } @@ -2181,10 +2179,9 @@ NS_IMETHODIMP nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } -NS_IMETHODIMP nsFrame::GetPrevInFlow(nsIFrame** aPrevInFlow) const +nsIFrame* nsFrame::GetPrevInFlow() const { - *aPrevInFlow = nsnull; - return NS_OK; + return nsnull; } NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame* aPrevInFlow) @@ -2198,10 +2195,9 @@ NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame* aPrevInFlow) return NS_OK; } -NS_IMETHODIMP nsFrame::GetNextInFlow(nsIFrame** aNextInFlow) const +nsIFrame* nsFrame::GetNextInFlow() const { - *aNextInFlow = nsnull; - return NS_OK; + return nsnull; } NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*) @@ -3042,10 +3038,10 @@ nsFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, P nsRect rect = GetRect(); if (!rect.width || !rect.height) { - nsIFrame *nextFlow = nsnull; //if we have a 0 width or height then lets look for another frame that possibly has //the same content. If we have no frames in flow then just let us return 'this' frame - if (NS_SUCCEEDED(GetNextInFlow(&nextFlow)) && nextFlow) + nsIFrame* nextFlow = GetNextInFlow(); + if (nextFlow) return nextFlow->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame); } *outChildFrame = this; @@ -5262,12 +5258,11 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext, DR_state->PrettyUC(aReflowState.mComputedHeight, height); printf("c=%s,%s ", width, height); - nsIFrame* inFlow; - aFrame->GetPrevInFlow(&inFlow); + nsIFrame* inFlow = aFrame->GetPrevInFlow(); if (inFlow) { printf("pif=%p ", (void*)inFlow); } - aFrame->GetNextInFlow(&inFlow); + inFlow = aFrame->GetNextInFlow(); if (inFlow) { printf("nif=%p ", (void*)inFlow); } diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index 0a83d825ad7..1535e46fde4 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -232,9 +232,9 @@ public: nsIAtom* aAttribute, PRInt32 aModType); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; + virtual nsIFrame* GetPrevInFlow() const; NS_IMETHOD SetPrevInFlow(nsIFrame*); - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const; + virtual nsIFrame* GetNextInFlow() const; NS_IMETHOD SetNextInFlow(nsIFrame*); NS_IMETHOD GetOffsetFromView(nsPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const; NS_IMETHOD GetOriginToViewOffset(nsPresContext *aPresContext, nsPoint& aOffset, nsIView **aView) const; diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 205e4111135..99933fe8e36 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -1498,8 +1498,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext, localContent->IsContentOfType(nsIContent::eELEMENT)) { // Check for a new :before pseudo and an existing :before // frame, but only if the frame is the first-in-flow. - nsIFrame* prevInFlow = nsnull; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); if (!prevInFlow) { // Checking for a :before frame is cheaper than getting the // :before style context. @@ -1524,8 +1523,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext, localContent->IsContentOfType(nsIContent::eELEMENT)) { // Check for new :after content, but only if the frame is the // first-in-flow. - nsIFrame* nextInFlow = nsnull; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (!nextInFlow) { // Getting the :after frame is more expensive than getting the pseudo @@ -1623,13 +1621,7 @@ nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame, nsIFrame* frame = aFrame; nsIFrame* frame2 = aFrame; -#ifdef DEBUG - { - nsIFrame* prevInFlow; - frame->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "must start with the first in flow"); - } -#endif + NS_ASSERTION(!frame->GetPrevInFlow(), "must start with the first in flow"); // We want to start with this frame and walk all its next-in-flows, // as well as all its special siblings and their next-in-flows, @@ -1650,15 +1642,12 @@ nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame, // If it's going to cause a framechange, then don't bother // with the continuations or special siblings since they'll be // clobbered by the frame reconstruct anyway. -#ifdef NS_DEBUG - nsIFrame* prevInFlow; - frame->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "continuing frame had more severe impact than first-in-flow"); -#endif + NS_ASSERTION(!frame->GetPrevInFlow(), + "continuing frame had more severe impact than first-in-flow"); return topLevelChange; } - frame->GetNextInFlow(&frame); + frame = frame->GetNextInFlow(); } while (frame); // Might we have special siblings? diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index cd1371dfc23..db2d194acee 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -248,7 +248,7 @@ HasTextFrameDescendant(nsPresContext* aPresContext, nsIFrame* aParent) static PRBool HasTextFrameDescendantOrInFlow(nsPresContext* aPresContext, nsIFrame* aFrame) { - for (nsIFrame *f = aFrame->GetFirstInFlow(); f; f->GetNextInFlow(&f)) { + for (nsIFrame *f = aFrame->GetFirstInFlow(); f; f = f->GetNextInFlow()) { if (HasTextFrameDescendant(aPresContext, f)) return PR_TRUE; } @@ -311,8 +311,7 @@ nsHTMLContainerFrame::CreateNextInFlow(nsPresContext* aPresContext, { aNextInFlowResult = nsnull; - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nsnull == nextInFlow) { // Create a continuation frame for the child frame and insert it // into our lines child list. diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index fe52fdb8ff4..065afb927af 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -1384,8 +1384,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) } } else if (nsLayoutAtoms::pageContentFrame == frameType) { - nsIFrame* prevInFlow; - rs->frame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = rs->frame->GetPrevInFlow(); // only use the page content frame for a height basis if it is the first in flow if (prevInFlow) break; diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 110484e17e9..3c48bb1fc96 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -933,7 +933,7 @@ nsImageFrame::GetContinuationOffset(nscoord* aWidth) const } if (mPrevInFlow) { - for (nsIFrame* prevInFlow = mPrevInFlow ; prevInFlow; prevInFlow->GetPrevInFlow(&prevInFlow)) { + for (nsIFrame* prevInFlow = mPrevInFlow ; prevInFlow; prevInFlow = prevInFlow->GetPrevInFlow()) { nsRect rect = prevInFlow->GetRect(); if (aWidth) { *aWidth = rect.width; @@ -1019,12 +1019,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext, aMetrics.descent = 0; if (aMetrics.mComputeMEW) { - // If we have a percentage based width, then our MEW is 0 - if (eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit()) { - aMetrics.mMaxElementWidth = 0; - } else { - aMetrics.mMaxElementWidth = aMetrics.width; - } + aMetrics.SetMEWToActualWidth(aReflowState.mStylePosition->mWidth.GetUnit()); } if (aMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) { diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 1de294c267e..230abed746e 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -261,8 +261,7 @@ nsInlineFrame::RemoveFrame(nsPresContext* aPresContext, // When the parent is an inline frame we have a simple task - just // remove the frame from its parents list and generate a reflow // command. - nsIFrame* oldFrameNextInFlow; - aOldFrame->GetNextInFlow(&oldFrameNextInFlow); + nsIFrame* oldFrameNextInFlow = aOldFrame->GetNextInFlow(); parent->mFrames.DestroyFrame(aPresContext, aOldFrame); aOldFrame = oldFrameNextInFlow; if (aOldFrame) { @@ -514,8 +513,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext, // its parent frame pointer, too. Otherwise, if we reflow frame and it's // complete we'll fail when deleting its next-in-flow which is no longer // needed. This scenario doesn't happen often, but it can happen - nsIFrame* nextInFlow; - frame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = frame->GetNextInFlow(); while (nextInFlow) { // Since we only do lazy setting of parent pointers for the frame's // initial reflow, this frame can't have a next-in-flow. That means @@ -523,7 +521,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext, // not, then something is wrong NS_ASSERTION(mFrames.ContainsFrame(nextInFlow), "unexpected flow"); nextInFlow->SetParent(this); - nextInFlow->GetNextInFlow(&nextInFlow); + nextInFlow = nextInFlow->GetNextInFlow(); } } rv = ReflowInlineFrame(aPresContext, aReflowState, irs, frame, aStatus); diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 03e94b4c984..d0a8e470526 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -230,8 +230,7 @@ PRBool nsLineLayout::AllocateDeque() inline PRBool HasPrevInFlow(nsIFrame *aFrame) { - nsIFrame *prevInFlow; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame *prevInFlow = aFrame->GetPrevInFlow(); return prevInFlow != nsnull; } @@ -1151,8 +1150,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // the frame is going to get reflowed again (and may end up wanting // a next-in-flow where it ends up). if (NS_FRAME_IS_COMPLETE(aReflowStatus)) { - nsIFrame* kidNextInFlow; - aFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = aFrame->GetNextInFlow(); if (nsnull != kidNextInFlow) { // Remove all of the childs next-in-flows. Make sure that we ask // the right parent to do the removal (it's possible that the @@ -1203,8 +1201,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, PRInt32 newEnd; aFrame->GetOffsets(start, newEnd); if (newEnd != end) { - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nextInFlow) { nextInFlow->GetOffsets(start, end); nextInFlow->AdjustOffsetsForBidi(newEnd, end); @@ -1387,11 +1384,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, // If this is a piece of text inside a letter frame... if (pfd->GetFlag(PFD_ISNONEMPTYTEXTFRAME)) { if (psd->mFrame && psd->mFrame->GetFlag(PFD_ISLETTERFRAME)) { - nsIFrame* prevInFlow; - psd->mFrame->mFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = psd->mFrame->mFrame->GetPrevInFlow(); if (prevInFlow) { - nsIFrame* prevPrevInFlow; - prevInFlow->GetPrevInFlow(&prevPrevInFlow); + nsIFrame* prevPrevInFlow = prevInFlow->GetPrevInFlow(); if (!prevPrevInFlow) { // And it's the first continuation of the letter frame... // Then make sure that the text fits @@ -1402,11 +1397,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, } else if (pfd->GetFlag(PFD_ISLETTERFRAME)) { // If this is the first continuation of the letter frame... - nsIFrame* prevInFlow; - pfd->mFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = pfd->mFrame->GetPrevInFlow(); if (prevInFlow) { - nsIFrame* prevPrevInFlow; - prevInFlow->GetPrevInFlow(&prevPrevInFlow); + nsIFrame* prevPrevInFlow = prevInFlow->GetPrevInFlow(); if (!prevPrevInFlow) { return PR_TRUE; } @@ -1929,10 +1922,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // - it has a prev-in-flow // - it has no next in flow // - it's zero sized - nsIFrame* spanNextInFlow; - spanFrame->GetNextInFlow(&spanNextInFlow); - nsIFrame* spanPrevInFlow; - spanFrame->GetPrevInFlow(&spanPrevInFlow); + nsIFrame* spanNextInFlow = spanFrame->GetNextInFlow(); + nsIFrame* spanPrevInFlow = spanFrame->GetPrevInFlow(); PRBool emptyContinuation = spanPrevInFlow && !spanNextInFlow && (0 == spanFramePFD->mBounds.width) && (0 == spanFramePFD->mBounds.height); diff --git a/mozilla/layout/html/base/src/nsPageContentFrame.cpp b/mozilla/layout/html/base/src/nsPageContentFrame.cpp index 1e76bba764a..b33c5fef664 100644 --- a/mozilla/layout/html/base/src/nsPageContentFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageContentFrame.cpp @@ -117,15 +117,8 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsPresContext* aPresContext, // Place and size the child FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, 0, 0, 0); -#ifdef NS_DEBUG - // Is the frame complete? - if (NS_FRAME_IS_COMPLETE(aStatus)) { - nsIFrame* childNextInFlow; - - frame->GetNextInFlow(&childNextInFlow); - NS_ASSERTION(nsnull == childNextInFlow, "bad child flow list"); - } -#endif + NS_ASSERTION(!NS_FRAME_IS_COMPLETE(aStatus) || + !frame->GetNextInFlow(), "bad child flow list"); #ifdef DEBUG_PRINTING nsRect r = frame->GetRect(); diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 14941e08a23..97181eb3dd4 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -221,15 +221,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsPresContext* aPresContext, view->GetViewManager()->SetViewChildClipRegion(view, ®ion); } -#ifdef NS_DEBUG - // Is the frame complete? - if (NS_FRAME_IS_COMPLETE(aStatus)) { - nsIFrame* childNextInFlow; - - frame->GetNextInFlow(&childNextInFlow); - NS_ASSERTION(nsnull == childNextInFlow, "bad child flow list"); - } -#endif + NS_ASSERTION(!NS_FRAME_IS_COMPLETE(aStatus) || + !frame->GetNextInFlow(), "bad child flow list"); } PR_PL(("PageFrame::Reflow %p ", this)); PR_PL(("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.availableWidth, aReflowState.availableHeight)); diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 1dcab054be3..10af040c3a7 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -428,8 +428,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext, y += deadSpaceGap; // Is the page complete? - nsIFrame* kidNextInFlow; - kidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow(); if (NS_FRAME_IS_COMPLETE(status)) { NS_ASSERTION(nsnull == kidNextInFlow, "bad child flow list"); diff --git a/mozilla/layout/html/base/src/nsSplittableFrame.cpp b/mozilla/layout/html/base/src/nsSplittableFrame.cpp index 10cf15ee0e1..c13d5fef751 100644 --- a/mozilla/layout/html/base/src/nsSplittableFrame.cpp +++ b/mozilla/layout/html/base/src/nsSplittableFrame.cpp @@ -78,10 +78,9 @@ nsSplittableFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } -NS_METHOD nsSplittableFrame::GetPrevInFlow(nsIFrame** aPrevInFlow) const +nsIFrame* nsSplittableFrame::GetPrevInFlow() const { - *aPrevInFlow = mPrevInFlow; - return NS_OK; + return mPrevInFlow; } NS_METHOD nsSplittableFrame::SetPrevInFlow(nsIFrame* aFrame) @@ -90,10 +89,9 @@ NS_METHOD nsSplittableFrame::SetPrevInFlow(nsIFrame* aFrame) return NS_OK; } -NS_METHOD nsSplittableFrame::GetNextInFlow(nsIFrame** aNextInFlow) const +nsIFrame* nsSplittableFrame::GetNextInFlow() const { - *aNextInFlow = mNextInFlow; - return NS_OK; + return mNextInFlow; } NS_METHOD nsSplittableFrame::SetNextInFlow(nsIFrame* aFrame) @@ -126,11 +124,8 @@ nsIFrame* nsSplittableFrame::GetLastInFlow() const void nsSplittableFrame::RemoveFromFlow(nsIFrame* aFrame) { - nsIFrame* prevInFlow; - nsIFrame* nextInFlow; - - aFrame->GetPrevInFlow(&prevInFlow); - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (prevInFlow) { prevInFlow->SetNextInFlow(nextInFlow); @@ -148,25 +143,13 @@ nsSplittableFrame::RemoveFromFlow(nsIFrame* aFrame) void nsSplittableFrame::BreakFromPrevFlow(nsIFrame* aFrame) { - nsIFrame* prevInFlow; - - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aFrame->GetPrevInFlow(); if (prevInFlow) { prevInFlow->SetNextInFlow(nsnull); aFrame->SetPrevInFlow(nsnull); } } -nsIFrame * nsSplittableFrame::GetPrevInFlow() -{ - return mPrevInFlow; -} - -nsIFrame * nsSplittableFrame::GetNextInFlow() -{ - return mNextInFlow; -} - #ifdef DEBUG void nsSplittableFrame::DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData) diff --git a/mozilla/layout/html/base/src/nsSplittableFrame.h b/mozilla/layout/html/base/src/nsSplittableFrame.h index 801ba0f64ee..769344d1887 100644 --- a/mozilla/layout/html/base/src/nsSplittableFrame.h +++ b/mozilla/layout/html/base/src/nsSplittableFrame.h @@ -54,9 +54,9 @@ public: NS_IMETHOD Destroy(nsPresContext* aPresContext); // Flow member functions. - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; + virtual nsIFrame* GetPrevInFlow() const; NS_IMETHOD SetPrevInFlow(nsIFrame*); - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const; + virtual nsIFrame* GetNextInFlow() const; NS_IMETHOD SetNextInFlow(nsIFrame*); /** @@ -76,9 +76,6 @@ public: // Detach from previous frame in flow static void BreakFromPrevFlow(nsIFrame* aFrame); - nsIFrame* GetPrevInFlow(); - nsIFrame* GetNextInFlow(); - protected: #ifdef DEBUG virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData); diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index e44c76e6829..8bad9682b82 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -404,9 +404,8 @@ public: nsIContent* aChild, PRBool aAppend); - NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const { - *aNextInFlow = mNextInFlow; - return NS_OK; + virtual nsIFrame* GetNextInFlow() const { + return mNextInFlow; } NS_IMETHOD SetNextInFlow(nsIFrame* aNextInFlow) { mNextInFlow = aNextInFlow; @@ -843,9 +842,8 @@ public: NS_IMETHOD Destroy(nsPresContext* aPresContext); - NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const { - *aPrevInFlow = mPrevInFlow; - return NS_OK; + virtual nsIFrame* GetPrevInFlow() const { + return mPrevInFlow; } NS_IMETHOD SetPrevInFlow(nsIFrame* aPrevInFlow) { mPrevInFlow = aPrevInFlow; @@ -925,7 +923,7 @@ nsContinuingTextFrame::GetFirstInFlow() const NS_STATIC_CAST(const nsIFrame*, this)); do { firstInFlow = previous; - firstInFlow->GetPrevInFlow(&previous); + previous = firstInFlow->GetPrevInFlow(); } while (previous); return firstInFlow; } @@ -3568,7 +3566,6 @@ nsTextFrame::SetSelected(nsPresContext* aPresContext, PRBool aSelected, nsSpread aSpread) { - nsresult result; if (aSelected && ParentDisablesSelection()) return NS_OK; @@ -3685,20 +3682,15 @@ nsTextFrame::SetSelected(nsPresContext* aPresContext, } if (aSpread == eSpreadDown) { - nsIFrame *frame; - GetPrevInFlow(&frame); + nsIFrame* frame = GetPrevInFlow(); while(frame){ frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); - result = frame->GetPrevInFlow(&frame); - if (NS_FAILED(result)) - break; + frame = frame->GetPrevInFlow(); } - GetNextInFlow(&frame); + frame = GetNextInFlow(); while (frame){ frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); - result = frame->GetNextInFlow(&frame); - if (NS_FAILED(result)) - break; + frame = frame->GetNextInFlow(); } #ifdef IBMBIDI if ((mState & NS_FRAME_IS_BIDI) && @@ -3831,7 +3823,6 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, { if (nsnull == outChildFrame) return NS_ERROR_NULL_POINTER; - nsresult result; PRInt32 contentOffset = inContentOffset; if (contentOffset != -1) //-1 signified the end of the current content @@ -3840,8 +3831,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, if ((contentOffset > mContentLength) || ((contentOffset == mContentLength) && inHint) ) { //this is not the frame we are looking for. - nsIFrame *nextInFlow; - GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = GetNextInFlow(); if (nextInFlow) { return nextInFlow->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame); @@ -3873,12 +3863,12 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, if (inContentOffset < mContentOffset) //could happen with floats! { - result = GetPrevInFlow(outChildFrame); - if (NS_SUCCEEDED(result) && *outChildFrame) + *outChildFrame = GetPrevInFlow(); + if (*outChildFrame) return (*outChildFrame)->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset,outChildFrame); else - return result; + return NS_OK; //this can't be the right thing to do? } *outFrameContentOffset = contentOffset; @@ -3915,7 +3905,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) } else #endif - GetNextInFlow(&nextInFlow); + nextInFlow = GetNextInFlow(); if (!nextInFlow){ NS_ASSERTION(PR_FALSE,"nsTextFrame::PeekOffset no more flow \n"); return NS_ERROR_INVALID_ARG; @@ -4040,7 +4030,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) if (i <0){ found = PR_FALSE; - GetPrevInFlow(&frameUsed); + frameUsed = GetPrevInFlow(); start = mContentOffset; aPos->mContentOffset = start;//in case next call fails we stop at this offset } @@ -4095,7 +4085,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) */ if (i > mContentLength){ found = PR_FALSE; - GetNextInFlow(&frameUsed); + frameUsed = GetNextInFlow(); start = mContentOffset + mContentLength; aPos->mContentOffset = start;//in case next call fails we stop at this offset } @@ -4250,7 +4240,7 @@ nsTextFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) } TryNextFrame: - GetNextInFlow(&frameUsed); + frameUsed = GetNextInFlow(); start = 0; } } @@ -4398,7 +4388,7 @@ nsTextFrame::CheckVisibility(nsPresContext* aContext, PRInt32 aStartIndex, PRInt rv = NS_OK; while (!aFinished && nextInFlow && NS_SUCCEEDED(rv) && !*_retval) //while we havent found anything visible { - rv = nextInFlow->GetNextInFlow(&nextInFlow); + nextInFlow = nextInFlow->GetNextInFlow(); if (nextInFlow) { rv = nextInFlow->CheckVisibility(aContext,aStartIndex,aEndIndex,PR_FALSE,aFinished,_retval); @@ -5186,9 +5176,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext, // Get starting offset into the content PRInt32 startingOffset = 0; - nsIFrame* prevInFlow; - - GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = GetPrevInFlow(); if (nsnull != prevInFlow) { nsTextFrame* prev = (nsTextFrame*)prevInFlow; startingOffset = prev->mContentOffset + prev->mContentLength; @@ -5912,8 +5900,7 @@ nsTextFrame::List(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent) const if (nsnull != mNextSibling) { fprintf(out, " next=%p", NS_STATIC_CAST(void*, mNextSibling)); } - nsIFrame* prevInFlow; - GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = GetPrevInFlow(); if (nsnull != prevInFlow) { fprintf(out, " prev-in-flow=%p", NS_STATIC_CAST(void*, prevInFlow)); } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 255c49c8612..82a7615f02f 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -450,8 +450,7 @@ GetLastSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame) static nsIFrame* GetNifOrSpecialSibling(nsFrameManager *aFrameManager, nsIFrame *aFrame) { - nsIFrame *result; - aFrame->GetNextInFlow(&result); + nsIFrame *result = aFrame->GetNextInFlow(); if (result) return result; @@ -466,17 +465,14 @@ SetFrameIsSpecial(nsFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aSp NS_PRECONDITION(aFrameManager && aFrame, "bad args!"); // Mark the frame and all of its siblings as "special". - for (nsIFrame* frame = aFrame; frame != nsnull; frame->GetNextInFlow(&frame)) { + for (nsIFrame* frame = aFrame; frame != nsnull; frame = frame->GetNextInFlow()) { frame->AddStateBits(NS_FRAME_IS_SPECIAL); } if (aSpecialSibling) { -#ifdef DEBUG // We should be the first-in-flow - nsIFrame* prev; - aFrame->GetPrevInFlow(&prev); - NS_ASSERTION(! prev, "assigning special sibling to other than first-in-flow!"); -#endif + NS_ASSERTION(!aFrame->GetPrevInFlow(), + "assigning special sibling to other than first-in-flow!"); // Store the "special sibling" (if we were given one) with the // first frame in the flow. @@ -7810,12 +7806,9 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell, nsIFrame* nextSibling; aPresShell->GetPrimaryFrameFor(child, &nextSibling); if (nextSibling) { -#ifdef DEBUG // The primary frame should never be a continuation - nsIFrame* prevInFlow; - nextSibling->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "primary frame is a continuation!?"); -#endif + NS_ASSERTION(!nextSibling->GetPrevInFlow(), + "primary frame is a continuation!?"); // If the frame is out-of-flow, GPFF() will have returned the // out-of-flow frame; we want the placeholder. @@ -7996,12 +7989,9 @@ nsCSSFrameConstructor::FindNextSibling(nsIPresShell* aPresShell, aPresShell->GetPrimaryFrameFor(nsCOMPtr(*iter), &nextSibling); if (nextSibling) { -#ifdef DEBUG // The frame primary frame should never be a continuation - nsIFrame* prevInFlow; - nextSibling->GetPrevInFlow(&prevInFlow); - NS_ASSERTION(!prevInFlow, "primary frame is a continuation!?"); -#endif + NS_ASSERTION(!nextSibling->GetPrevInFlow(), + "primary frame is a continuation!?"); // If the frame is out-of-flow, GPFF() will have returned the // out-of-flow frame; we want the placeholder. @@ -9298,7 +9288,7 @@ DeletingFrameSubtree(nsPresContext* aPresContext, // recursing over a subtree, because those continuing frames should be // found as part of the walk over the top-most frame's continuing frames. // Walking them again will make this an N^2/2 algorithm - aFrame->GetNextInFlow(&aFrame); + aFrame = aFrame->GetNextInFlow(); } while (aFrame); // Now destroy any frames that have been enqueued for destruction. @@ -10691,8 +10681,7 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell, if ((NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == display->mDisplay) || (NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == display->mDisplay)) { // If the row group has was continued, then don't replicate it - nsIFrame* rgNextInFlow; - rowGroupFrame->GetNextInFlow(&rgNextInFlow); + nsIFrame* rgNextInFlow = rowGroupFrame->GetNextInFlow(); if (rgNextInFlow) { ((nsTableRowGroupFrame*)rowGroupFrame)->SetRepeatable(PR_FALSE); } @@ -10746,9 +10735,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, nsStyleContext* styleContext = aFrame->GetStyleContext(); nsIFrame* newFrame = nsnull; nsresult rv = NS_OK; - nsIFrame* nextInFlow = nsnull; - - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); // Use the frame type to determine what type of frame to create nsIAtom* frameType = aFrame->GetType(); @@ -10944,8 +10931,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, return NS_ERROR_UNEXPECTED; } - nsIFrame* prevPage; - pageFrame->GetPrevInFlow(&prevPage); + nsIFrame* prevPage = pageFrame->GetPrevInFlow(); if (!prevPage) { return NS_OK; } @@ -11877,8 +11863,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( // need to be pulled out of the line-frame and become children // of the block. nsIFrame* nextSibling = aPrevSibling->GetNextSibling(); - nsIFrame* nextLineFrame; - prevSiblingParent->GetNextInFlow(&nextLineFrame); + nsIFrame* nextLineFrame = prevSiblingParent->GetNextInFlow(); if (nextSibling || nextLineFrame) { // Oy. We have work to do. Create a list of the new frames // that are going into the block by stripping them away from @@ -11891,7 +11876,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( nsLineFrame* nextLineFrame = (nsLineFrame*) lineFrame; for (;;) { - nextLineFrame->GetNextInFlow(&nextLineFrame); + nextLineFrame = nextLineFrame->GetNextInFlow(); if (!nextLineFrame) { break; } @@ -12324,8 +12309,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( // Destroy the old text frame's continuations (the old text frame // will be destroyed when its letter frame is destroyed). - nsIFrame* nextTextFrame; - textFrame->GetNextInFlow(&nextTextFrame); + nsIFrame* nextTextFrame = textFrame->GetNextInFlow(); if (nextTextFrame) { nsIFrame* nextTextParent = nextTextFrame->GetParent(); if (nextTextParent) { @@ -13268,8 +13252,7 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsPresContext* aPresContext, // If we have a continuation frame, then we need to break the // continuation. - nsIFrame* nextInFlow; - aFrame->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aFrame->GetNextInFlow(); if (nextInFlow) { aFrame->SetNextInFlow(nsnull); nextInFlow->SetPrevInFlow(nsnull); diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index eeae52f1fc9..60ff6f6bd12 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -145,8 +145,7 @@ protected: { NS_PRECONDITION(aFrame, "Need a frame"); - nsIFrame *prevInFlow = nsnull; - aFrame->GetPrevInFlow(&prevInFlow); + nsIFrame *prevInFlow = aFrame->GetPrevInFlow(); if (!prevInFlow || mFrame != prevInFlow) { // Ok, we've got the wrong frame. We have to start from scratch. @@ -163,18 +162,17 @@ protected: } void Init(nsIFrame* aFrame) - { - nsIFrame* inlineFrame; + { // Start with the previous flow frame as our continuation point // is the total of the widths of the previous frames. - aFrame->GetPrevInFlow(&inlineFrame); + nsIFrame* inlineFrame = aFrame->GetPrevInFlow(); while (inlineFrame) { nsRect rect = inlineFrame->GetRect(); mContinuationPoint += rect.width; mUnbrokenWidth += rect.width; mBoundingBox.UnionRect(mBoundingBox, rect); - inlineFrame->GetPrevInFlow(&inlineFrame); + inlineFrame = inlineFrame->GetPrevInFlow(); } // Next add this frame and subsequent frames to the bounding box and @@ -184,7 +182,7 @@ protected: nsRect rect = inlineFrame->GetRect(); mUnbrokenWidth += rect.width; mBoundingBox.UnionRect(mBoundingBox, rect); - inlineFrame->GetNextInFlow(&inlineFrame); + inlineFrame = inlineFrame->GetNextInFlow(); } mFrame = aFrame; diff --git a/mozilla/layout/html/style/src/nsFrameContentIterator.cpp b/mozilla/layout/html/style/src/nsFrameContentIterator.cpp index 31e0f8c46bd..18419911c87 100644 --- a/mozilla/layout/html/style/src/nsFrameContentIterator.cpp +++ b/mozilla/layout/html/style/src/nsFrameContentIterator.cpp @@ -122,8 +122,7 @@ GetNextChildFrame(nsPresContext* aPresContext, nsIFrame* aFrame) // If there's no next sibling, then check if the parent frame // has a next-in-flow and look there if (!nextSibling) { - nsIFrame* parent; - aFrame->GetParent()->GetNextInFlow(&parent); + nsIFrame* parent = aFrame->GetParent()->GetNextInFlow(); if (parent) { nextSibling = parent->GetFirstChild(nsnull); @@ -184,7 +183,7 @@ GetPrevChildFrame(nsPresContext* aPresContext, nsIFrame* aFrame) // If there's no previous sibling, then check if the parent frame // has a prev-in-flow and look there if (!prevSibling) { - parent->GetPrevInFlow(&parent); + parent = parent->GetPrevInFlow(); if (parent) { firstChild = parent->GetFirstChild(nsnull); @@ -195,8 +194,7 @@ GetPrevChildFrame(nsPresContext* aPresContext, nsIFrame* aFrame) // Get the first-in-flow while (PR_TRUE) { - nsIFrame* prevInFlow; - prevSibling->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = prevSibling->GetPrevInFlow(); if (prevInFlow) { prevSibling = prevInFlow; } else { diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index 0d58e2018e8..8f630ddccaa 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -170,11 +170,8 @@ PRBool BasicTableLayoutStrategy::Initialize(const nsHTMLReflowState& aReflowStat void BasicTableLayoutStrategy::ContinuingFrameCheck() { -#ifdef NS_DEBUG - nsIFrame* tablePIF = nsnull; - mTableFrame->GetPrevInFlow(&tablePIF); - NS_ASSERTION(!tablePIF, "never ever call me on a continuing frame!"); -#endif + NS_ASSERTION(!mTableFrame->GetPrevInFlow(), + "never ever call me on a continuing frame!"); } PRBool BCW_Wrapup(const nsHTMLReflowState& aReflowState, diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index db4af5be795..d595ed3bb28 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -1723,8 +1723,7 @@ void nsTableFrame::CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState) { if (!aReflowState.frame) ABORT0(); - nsIFrame* prevInFlow; - aReflowState.frame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aReflowState.frame->GetPrevInFlow(); if (!prevInFlow && // 1st in flow && // 1st in flow ((NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) || // no computed height @@ -3104,8 +3103,7 @@ nsTableFrame::OrderRowGroups(nsVoidArray& aChildren, // Get the next sibling but skip it if it's also the next-in-flow, since // a next-in-flow will not be part of the current table. while (kidFrame) { - nsIFrame* nif; - kidFrame->GetNextInFlow(&nif); + nsIFrame* nif = kidFrame->GetNextInFlow(); kidFrame = kidFrame->GetNextSibling(); if (kidFrame != nif) break; @@ -3219,8 +3217,7 @@ nsTableFrame::ReflowChildren(nsPresContext* aPresContext, // record the next in flow in case it gets destroyed and the row group array // needs to be recomputed. - nsIFrame* kidNextInFlow; - kidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow(); rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, aReflowState.x, aReflowState.y, 0, aStatus); @@ -3243,7 +3240,7 @@ nsTableFrame::ReflowChildren(nsPresContext* aPresContext, // Special handling for incomplete children if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) { - kidFrame->GetNextInFlow(&kidNextInFlow); + kidNextInFlow = kidFrame->GetNextInFlow(); if (!kidNextInFlow) { // The child doesn't have a next-in-flow so create a continuing // frame. This hooks the child into the flow @@ -7487,12 +7484,11 @@ void DumpTableFramesRecur(nsIFrame* aFrame, GetFrameTypeName(fType, fName); printf("%s%s %p", indent, fName, aFrame); - nsIFrame* flowFrame; - aFrame->GetPrevInFlow(&flowFrame); + nsIFrame* flowFrame = aFrame->GetPrevInFlow(); if (flowFrame) { printf(" pif=%p", flowFrame); } - aFrame->GetNextInFlow(&flowFrame); + flowFrame = aFrame->GetNextInFlow(); if (flowFrame) { printf(" nif=%p", flowFrame); } @@ -7516,15 +7512,15 @@ nsTableFrame::DumpTableFrames(nsIFrame* aFrame) nsTableFrame* tableFrame = nsnull; if (nsLayoutAtoms::tableFrame == aFrame->GetType()) { - tableFrame = (nsTableFrame*)aFrame; + tableFrame = NS_STATIC_CAST(nsTableFrame*, aFrame); } else { nsTableFrame::GetTableFrame(aFrame, tableFrame); } - tableFrame = (nsTableFrame*)tableFrame->GetFirstInFlow(); + tableFrame = NS_STATIC_CAST(nsTableFrame*, tableFrame->GetFirstInFlow()); while (tableFrame) { DumpTableFramesRecur(tableFrame, 0); - tableFrame->GetNextInFlow((nsIFrame**)&tableFrame); + tableFrame = NS_STATIC_CAST(nsTableFrame*, tableFrame->GetNextInFlow()); } } @@ -7532,4 +7528,3 @@ nsTableFrame::DumpTableFrames(nsIFrame* aFrame) - diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index 22b7f908ea4..9d7ca357618 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -2116,9 +2116,7 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsPresContext* aPresContext, if (!aChild) return; NS_PRECONDITION(mFrames.ContainsFrame(aChild), "bad geometric parent"); - nsIFrame* nextInFlow; - - aChild->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aChild->GetNextInFlow(); if (!nextInFlow) { NS_ASSERTION(PR_FALSE, "null next-in-flow"); return; @@ -2132,9 +2130,7 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsPresContext* aPresContext, } // If the next-in-flow has a next-in-flow then delete it too (and // delete it first). - nsIFrame* nextNextInFlow; - - nextInFlow->GetNextInFlow(&nextNextInFlow); + nsIFrame* nextNextInFlow = nextInFlow->GetNextInFlow(); if (nextNextInFlow) { parent->DeleteChildsNextInFlow(aPresContext, nextInFlow); } @@ -2159,10 +2155,7 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsPresContext* aPresContext, // Delete the next-in-flow frame and adjust it's parent's child count nextInFlow->Destroy(aPresContext); -#ifdef NS_DEBUG - aChild->GetNextInFlow(&nextInFlow); - NS_POSTCONDITION(nsnull == nextInFlow, "non null next-in-flow"); -#endif + NS_POSTCONDITION(!aChild->GetNextInFlow(), "non null next-in-flow"); } nsIAtom* diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 38fc27e42ff..a7b9ce76282 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -783,7 +783,7 @@ nscoord CalcHeightFromUnpaginatedHeight(nsPresContext* aPresContext, if (firstInFlow->HasUnpaginatedHeight()) { height = firstInFlow->GetUnpaginatedHeight(aPresContext); for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow; - prevInFlow->GetPrevInFlow(&prevInFlow)) { + prevInFlow = prevInFlow->GetPrevInFlow()) { height -= prevInFlow->GetSize().height; } } @@ -806,8 +806,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, GET_PIXELS_TO_TWIPS(aPresContext, p2t); PRBool borderCollapse = (((nsTableFrame*)aTableFrame.GetFirstInFlow())->IsBorderCollapse()); - nsIFrame* tablePrevInFlow; - aTableFrame.GetPrevInFlow(&tablePrevInFlow); + nsIFrame* tablePrevInFlow = aTableFrame.GetPrevInFlow(); PRBool isPaginated = aPresContext->IsPaginated(); nsresult rv = NS_OK; @@ -899,8 +898,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, // the cell wants to be bigger than what was available last time or // it is a style change reflow or we are printing, then we must reflow the // cell. Otherwise we can skip the reflow. - nsIFrame* kidNextInFlow; - kidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow(); nsSize cellDesiredSize = cellFrame->GetDesiredSize(); if ((availCellWidth != cellFrame->GetPriorAvailWidth()) || (cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) || @@ -1348,9 +1346,7 @@ nsTableRowFrame::IR_TargetIsChild(nsPresContext* aPresContext, if (mNextInFlow) { for (nsIFrame* cell = mFrames.FirstChild(); cell; cell = cell->GetNextSibling()) { - nsIFrame* contFrame; - - cell->GetNextInFlow(&contFrame); + nsIFrame* contFrame = cell->GetNextInFlow(); if (contFrame) { aStatus = NS_FRAME_NOT_COMPLETE; break; diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 0d58e2018e8..8f630ddccaa 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -170,11 +170,8 @@ PRBool BasicTableLayoutStrategy::Initialize(const nsHTMLReflowState& aReflowStat void BasicTableLayoutStrategy::ContinuingFrameCheck() { -#ifdef NS_DEBUG - nsIFrame* tablePIF = nsnull; - mTableFrame->GetPrevInFlow(&tablePIF); - NS_ASSERTION(!tablePIF, "never ever call me on a continuing frame!"); -#endif + NS_ASSERTION(!mTableFrame->GetPrevInFlow(), + "never ever call me on a continuing frame!"); } PRBool BCW_Wrapup(const nsHTMLReflowState& aReflowState, diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index db4af5be795..d595ed3bb28 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -1723,8 +1723,7 @@ void nsTableFrame::CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState) { if (!aReflowState.frame) ABORT0(); - nsIFrame* prevInFlow; - aReflowState.frame->GetPrevInFlow(&prevInFlow); + nsIFrame* prevInFlow = aReflowState.frame->GetPrevInFlow(); if (!prevInFlow && // 1st in flow && // 1st in flow ((NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) || // no computed height @@ -3104,8 +3103,7 @@ nsTableFrame::OrderRowGroups(nsVoidArray& aChildren, // Get the next sibling but skip it if it's also the next-in-flow, since // a next-in-flow will not be part of the current table. while (kidFrame) { - nsIFrame* nif; - kidFrame->GetNextInFlow(&nif); + nsIFrame* nif = kidFrame->GetNextInFlow(); kidFrame = kidFrame->GetNextSibling(); if (kidFrame != nif) break; @@ -3219,8 +3217,7 @@ nsTableFrame::ReflowChildren(nsPresContext* aPresContext, // record the next in flow in case it gets destroyed and the row group array // needs to be recomputed. - nsIFrame* kidNextInFlow; - kidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow(); rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, aReflowState.x, aReflowState.y, 0, aStatus); @@ -3243,7 +3240,7 @@ nsTableFrame::ReflowChildren(nsPresContext* aPresContext, // Special handling for incomplete children if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) { - kidFrame->GetNextInFlow(&kidNextInFlow); + kidNextInFlow = kidFrame->GetNextInFlow(); if (!kidNextInFlow) { // The child doesn't have a next-in-flow so create a continuing // frame. This hooks the child into the flow @@ -7487,12 +7484,11 @@ void DumpTableFramesRecur(nsIFrame* aFrame, GetFrameTypeName(fType, fName); printf("%s%s %p", indent, fName, aFrame); - nsIFrame* flowFrame; - aFrame->GetPrevInFlow(&flowFrame); + nsIFrame* flowFrame = aFrame->GetPrevInFlow(); if (flowFrame) { printf(" pif=%p", flowFrame); } - aFrame->GetNextInFlow(&flowFrame); + flowFrame = aFrame->GetNextInFlow(); if (flowFrame) { printf(" nif=%p", flowFrame); } @@ -7516,15 +7512,15 @@ nsTableFrame::DumpTableFrames(nsIFrame* aFrame) nsTableFrame* tableFrame = nsnull; if (nsLayoutAtoms::tableFrame == aFrame->GetType()) { - tableFrame = (nsTableFrame*)aFrame; + tableFrame = NS_STATIC_CAST(nsTableFrame*, aFrame); } else { nsTableFrame::GetTableFrame(aFrame, tableFrame); } - tableFrame = (nsTableFrame*)tableFrame->GetFirstInFlow(); + tableFrame = NS_STATIC_CAST(nsTableFrame*, tableFrame->GetFirstInFlow()); while (tableFrame) { DumpTableFramesRecur(tableFrame, 0); - tableFrame->GetNextInFlow((nsIFrame**)&tableFrame); + tableFrame = NS_STATIC_CAST(nsTableFrame*, tableFrame->GetNextInFlow()); } } @@ -7532,4 +7528,3 @@ nsTableFrame::DumpTableFrames(nsIFrame* aFrame) - diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index 22b7f908ea4..9d7ca357618 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -2116,9 +2116,7 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsPresContext* aPresContext, if (!aChild) return; NS_PRECONDITION(mFrames.ContainsFrame(aChild), "bad geometric parent"); - nsIFrame* nextInFlow; - - aChild->GetNextInFlow(&nextInFlow); + nsIFrame* nextInFlow = aChild->GetNextInFlow(); if (!nextInFlow) { NS_ASSERTION(PR_FALSE, "null next-in-flow"); return; @@ -2132,9 +2130,7 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsPresContext* aPresContext, } // If the next-in-flow has a next-in-flow then delete it too (and // delete it first). - nsIFrame* nextNextInFlow; - - nextInFlow->GetNextInFlow(&nextNextInFlow); + nsIFrame* nextNextInFlow = nextInFlow->GetNextInFlow(); if (nextNextInFlow) { parent->DeleteChildsNextInFlow(aPresContext, nextInFlow); } @@ -2159,10 +2155,7 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsPresContext* aPresContext, // Delete the next-in-flow frame and adjust it's parent's child count nextInFlow->Destroy(aPresContext); -#ifdef NS_DEBUG - aChild->GetNextInFlow(&nextInFlow); - NS_POSTCONDITION(nsnull == nextInFlow, "non null next-in-flow"); -#endif + NS_POSTCONDITION(!aChild->GetNextInFlow(), "non null next-in-flow"); } nsIAtom* diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 38fc27e42ff..a7b9ce76282 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -783,7 +783,7 @@ nscoord CalcHeightFromUnpaginatedHeight(nsPresContext* aPresContext, if (firstInFlow->HasUnpaginatedHeight()) { height = firstInFlow->GetUnpaginatedHeight(aPresContext); for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow; - prevInFlow->GetPrevInFlow(&prevInFlow)) { + prevInFlow = prevInFlow->GetPrevInFlow()) { height -= prevInFlow->GetSize().height; } } @@ -806,8 +806,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, GET_PIXELS_TO_TWIPS(aPresContext, p2t); PRBool borderCollapse = (((nsTableFrame*)aTableFrame.GetFirstInFlow())->IsBorderCollapse()); - nsIFrame* tablePrevInFlow; - aTableFrame.GetPrevInFlow(&tablePrevInFlow); + nsIFrame* tablePrevInFlow = aTableFrame.GetPrevInFlow(); PRBool isPaginated = aPresContext->IsPaginated(); nsresult rv = NS_OK; @@ -899,8 +898,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, // the cell wants to be bigger than what was available last time or // it is a style change reflow or we are printing, then we must reflow the // cell. Otherwise we can skip the reflow. - nsIFrame* kidNextInFlow; - kidFrame->GetNextInFlow(&kidNextInFlow); + nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow(); nsSize cellDesiredSize = cellFrame->GetDesiredSize(); if ((availCellWidth != cellFrame->GetPriorAvailWidth()) || (cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) || @@ -1348,9 +1346,7 @@ nsTableRowFrame::IR_TargetIsChild(nsPresContext* aPresContext, if (mNextInFlow) { for (nsIFrame* cell = mFrames.FirstChild(); cell; cell = cell->GetNextSibling()) { - nsIFrame* contFrame; - - cell->GetNextInFlow(&contFrame); + nsIFrame* contFrame = cell->GetNextInFlow(); if (contFrame) { aStatus = NS_FRAME_NOT_COMPLETE; break; diff --git a/mozilla/layout/xul/base/src/nsBoxObject.cpp b/mozilla/layout/xul/base/src/nsBoxObject.cpp index 82677fc6b8d..3360bb8a919 100644 --- a/mozilla/layout/xul/base/src/nsBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsBoxObject.cpp @@ -201,7 +201,7 @@ nsBoxObject::GetOffsetRect(nsRect& aRect) nsIFrame* next = frame; do { rcFrame.UnionRect(rcFrame, next->GetRect()); - next->GetNextInFlow(&next); + next = next->GetNextInFlow(); } while (nsnull != next);