From 7895bff6577c84362d768256d39a9b7ba7fec96b Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Sun, 29 Jun 2003 03:43:05 +0000 Subject: [PATCH] Ongoing deCOMtamination. r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@144251 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsFrameManager.cpp | 75 ++++++------------- mozilla/layout/generic/nsGfxScrollFrame.cpp | 56 +++++--------- .../layout/generic/nsHTMLContainerFrame.cpp | 55 ++++++-------- mozilla/layout/generic/nsHTMLFrame.cpp | 29 ++----- .../layout/generic/nsHTMLReflowCommand.cpp | 2 +- mozilla/layout/generic/nsHTMLReflowState.cpp | 67 +++++++---------- mozilla/layout/generic/nsImageFrame.cpp | 20 +++-- mozilla/layout/generic/nsImageMap.cpp | 8 +- .../layout/html/base/src/nsFrameManager.cpp | 75 ++++++------------- .../layout/html/base/src/nsGfxScrollFrame.cpp | 56 +++++--------- mozilla/layout/html/base/src/nsHRFrame.cpp | 20 ++--- .../html/base/src/nsHTMLContainerFrame.cpp | 55 ++++++-------- mozilla/layout/html/base/src/nsHTMLFrame.cpp | 29 ++----- .../html/base/src/nsHTMLReflowCommand.cpp | 2 +- .../html/base/src/nsHTMLReflowState.cpp | 67 +++++++---------- mozilla/layout/html/base/src/nsImageFrame.cpp | 20 +++-- mozilla/layout/html/base/src/nsImageMap.cpp | 8 +- 17 files changed, 228 insertions(+), 416 deletions(-) diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index b28a502d933..ac94c83686e 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -163,9 +163,7 @@ PR_STATIC_CALLBACK(const void *) PrimaryFrameMapGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) { PrimaryFrameMapEntry *entry = NS_STATIC_CAST(PrimaryFrameMapEntry*, hdr); - nsCOMPtr content; - entry->frame->GetContent(getter_AddRefs(content)); - return content; + return entry->frame->GetContent(); // and then release it, but we know the frame still owns it :-) } @@ -175,9 +173,7 @@ PrimaryFrameMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, { const PrimaryFrameMapEntry *entry = NS_STATIC_CAST(const PrimaryFrameMapEntry*, hdr); - nsCOMPtr content; - entry->frame->GetContent(getter_AddRefs(content)); - return content == key; + return entry->frame->GetContent() == key; } static PLDHashTableOps PrimaryFrameMapOps = { @@ -559,7 +555,7 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const *aCanvasFrame = siblingFrame; break; } else { - siblingFrame->GetNextSibling(&siblingFrame); + siblingFrame = siblingFrame->GetNextSibling(); } } // move on to the child's child @@ -675,10 +671,7 @@ FrameManager::SetPrimaryFrameFor(nsIContent* aContent, // This code should be used if/when we switch back to a 2-word entry // in the primary frame map. #if 0 -//#ifdef DEBUG - nsCOMPtr content; - aPrimaryFrame->GetContent(getter_AddRefs(content)); - NS_PRECONDITION(content == aContent, "wrong content"); + NS_PRECONDITION(aPrimaryFrame->GetContent() == aContent, "wrong content"); #endif // Create a new hashtable if necessary @@ -1031,10 +1024,8 @@ FrameManager::NotifyDestroyingFrame(nsIFrame* aFrame) #ifdef DEBUG if (mPrimaryFrameMap.ops) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); PrimaryFrameMapEntry *entry = NS_STATIC_CAST(PrimaryFrameMapEntry*, - PL_DHashTableOperate(&mPrimaryFrameMap, content, PL_DHASH_LOOKUP)); + PL_DHashTableOperate(&mPrimaryFrameMap, aFrame->GetContent(), PL_DHASH_LOOKUP)); NS_ASSERTION(!PL_DHASH_ENTRY_IS_BUSY(entry) || entry->frame != aFrame, "frame was not removed from primary frame map before " "destruction or was readded to map after being removed"); @@ -1429,9 +1420,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* child = nsnull; nsresult result = aFrame->FirstChild(aPresContext, childList, &child); while ((NS_SUCCEEDED(result)) && child) { - nsFrameState state; - child->GetFrameState(&state); - if (NS_FRAME_OUT_OF_FLOW != (state & NS_FRAME_OUT_OF_FLOW)) { + if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow child->GetFrameType(&frameType); if (nsLayoutAtoms::placeholderFrame == frameType) { @@ -1452,7 +1441,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* } NS_IF_RELEASE(frameType); } - child->GetNextSibling(&child); + child = child->GetNextSibling(); } NS_IF_RELEASE(childList); @@ -1515,9 +1504,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, child = nsnull; result = aFrame->FirstChild(presContext, childList, &child); while ((NS_SUCCEEDED(result)) && child) { - nsFrameState state; - child->GetFrameState(&state); - if (NS_FRAME_OUT_OF_FLOW != (state & NS_FRAME_OUT_OF_FLOW)) { + if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow child->GetFrameType(&frameType); if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder @@ -1537,7 +1524,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, NS_IF_RELEASE(frameType); } - child->GetNextSibling(&child); + child = child->GetNextSibling(); } NS_IF_RELEASE(childList); @@ -1653,19 +1640,11 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, if (oldContext) { oldContext->AddRef(); nsCOMPtr pseudoTag = oldContext->GetPseudoType(); - nsIContent* localContent = nsnull; - nsIContent* content = nsnull; - result = aFrame->GetContent(&localContent); - if (NS_SUCCEEDED(result) && localContent) { - content = localContent; - } - else { - content = aParentContent; - } + nsIContent* localContent = aFrame->GetContent(); + nsIContent* content = localContent ? localContent : aParentContent; + if (aParentContent && aAttribute) { // attribute came from parent, we don't care about it here when recursing - nsFrameState frameState; - aFrame->GetFrameState(&frameState); - if (0 == (frameState & NS_FRAME_GENERATED_CONTENT)) { // keep it for generated content + if (!(aFrame->GetStateBits() & NS_FRAME_GENERATED_CONTENT)) { // keep it for generated content aAttribute = nsnull; } } @@ -1934,9 +1913,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, nsIFrame* child = nsnull; result = aFrame->FirstChild(aPresContext, childList, &child); while (NS_SUCCEEDED(result) && child) { - nsFrameState state; - child->GetFrameState(&state); - if (!(state & NS_FRAME_OUT_OF_FLOW)) { + if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow nsCOMPtr frameType; child->GetFrameType(getter_AddRefs(frameType)); @@ -1970,7 +1947,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, } } } - child->GetNextSibling(&child); + child = child->GetNextSibling(); } NS_IF_RELEASE(childList); @@ -1980,7 +1957,6 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, } newContext->Release(); - NS_IF_RELEASE(localContent); } } @@ -2035,9 +2011,7 @@ FrameManager::ComputeStyleChangeFor(nsIFrame* aFrame, } while (frame); // Might we have special siblings? - nsFrameState frame2state; - frame2->GetFrameState(&frame2state); - if (! (frame2state & NS_FRAME_IS_SPECIAL)) { + if (!(frame2->GetStateBits() & NS_FRAME_IS_SPECIAL)) { // nothing more to do here return NS_OK; } @@ -2096,11 +2070,8 @@ FrameManager::CaptureFrameStateFor(nsIFrame* aFrame, // Generate the hash key to store the state under // Exit early if we get empty key - nsCOMPtr content; - rv = aFrame->GetContent(getter_AddRefs(content)); - nsCAutoString stateKey; - rv = nsContentUtils::GenerateStateKey(content, aID, stateKey); + rv = nsContentUtils::GenerateStateKey(aFrame->GetContent(), aID, stateKey); if(NS_FAILED(rv) || stateKey.IsEmpty()) { return rv; } @@ -2128,7 +2099,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, while (childFrame) { rv = CaptureFrameState(childFrame, aState); // Get the next sibling child frame - childFrame->GetNextSibling(&childFrame); + childFrame = childFrame->GetNextSibling(); } NS_IF_RELEASE(childListName); aFrame->GetAdditionalChildListName(childListIndex++, &childListName); @@ -2155,17 +2126,15 @@ FrameManager::RestoreFrameStateFor(nsIFrame* aFrame, // Generate the hash key the state was stored under // Exit early if we get empty key - nsresult rv = NS_OK; - nsCOMPtr content; - rv = aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); // If we don't have content, we can't generate a hash // key and there's probably no state information for us. if (!content) { - return rv; + return NS_OK; } nsCAutoString stateKey; - rv = nsContentUtils::GenerateStateKey(content, aID, stateKey); + nsresult rv = nsContentUtils::GenerateStateKey(content, aID, stateKey); if (NS_FAILED(rv) || stateKey.IsEmpty()) { return rv; } @@ -2203,7 +2172,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) while (childFrame) { rv = RestoreFrameState(childFrame, aState); // Get the next sibling child frame - childFrame->GetNextSibling(&childFrame); + childFrame = childFrame->GetNextSibling(); } NS_IF_RELEASE(childListName); aFrame->GetAdditionalChildListName(childListIndex++, &childListName); diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index e6556987743..cb0987ae27c 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -611,19 +611,16 @@ nsGfxScrollFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, nsIFrame* frame = nsnull; mInner->mScrollAreaBox->GetFrame(&frame); nsPoint point(aPoint); - nsPoint currentPoint; //we need to translate the coordinates to the inner - nsIView *view = GetClosestView(aCX); + nsIView *view = GetClosestView(); if (!view) return NS_ERROR_FAILURE; - nsIView *innerView = GetClosestView(aCX); + nsIView *innerView = GetClosestView(); while (view != innerView && innerView) { - innerView->GetPosition(¤tPoint.x, ¤tPoint.y); - point.x -= currentPoint.x; - point.y -= currentPoint.y; - innerView->GetParent(innerView); + point -= innerView->GetPosition(); + innerView = innerView->GetParent(); } return frame->GetContentAndOffsetsFromPoint(aCX, point, aNewContent, aContentOffset, aContentOffsetEnd, aBeginFrameContent); @@ -982,15 +979,10 @@ nsGfxScrollFrameInner::CurPosAttributeChanged(nsIPresContext* aPresContext, if (mVScrollbarBox) mVScrollbarBox->GetFrame(&vframe); - nsCOMPtr vcontent; - nsCOMPtr hcontent; + nsIContent* vcontent = vframe ? vframe->GetContent() : nsnull; + nsIContent* hcontent = hframe ? hframe->GetContent() : nsnull; - if (hframe) - hframe->GetContent(getter_AddRefs(hcontent)); - if (vframe) - vframe->GetContent(getter_AddRefs(vcontent)); - - if (hcontent.get() == aContent || vcontent.get() == aContent) + if (hcontent == aContent || vcontent == aContent) { nscoord x = 0; nscoord y = 0; @@ -1054,7 +1046,7 @@ nsGfxScrollFrameInner::CurPosAttributeChanged(nsIPresContext* aPresContext, // likewise for vcontent and vframe. Thus targetFrame will always // be non-null in here. nsIFrame* targetFrame = - hcontent.get() == aContent ? hframe : vframe; + hcontent == aContent ? hframe : vframe; presShell->HandleEventWithTarget(&event, targetFrame, aContent, NS_EVENT_FLAG_INIT, &status); @@ -1070,7 +1062,7 @@ nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext) { nsIFrame* frame = nsnull; mScrollAreaBox->GetFrame(&frame); - nsIView* view = frame->GetView(aPresContext); + nsIView* view = frame->GetView(); if (!view) return nsnull; nsIScrollableView* scrollingView; @@ -1569,8 +1561,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) if ((oldScrollAreaBounds.width != scrollAreaRect.width || oldScrollAreaBounds.height != scrollAreaRect.height) && nsBoxLayoutState::Dirty == aState.GetLayoutReason()) { - nsIFrame* parentFrame; - mOuter->GetParent(&parentFrame); + nsIFrame* parentFrame = mOuter->GetParent(); if (parentFrame) { nsCOMPtr parentFrameType; parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); @@ -1622,11 +1613,9 @@ nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, { nsIFrame* frame = nsnull; aBox->GetFrame(&frame); - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); nsAutoString newValue; newValue.AppendInt(aSize); - content->SetAttr(kNameSpaceID_None, aAtom, newValue, aReflow); + frame->GetContent()->SetAttr(kNameSpaceID_None, aAtom, newValue, aReflow); return PR_TRUE; } @@ -1643,20 +1632,16 @@ nsGfxScrollFrameInner::GetScrolledSize(nsIPresContext* aPresContext, { // our scrolled size is the size of our scrolled view. - nsSize size; nsIBox* child = nsnull; mScrollAreaBox->GetChildBox(&child); nsIFrame* frame; child->GetFrame(&frame); - nsIView* view = frame->GetView(aPresContext); + nsIView* view = frame->GetView(); NS_ASSERTION(view,"Scrolled frame must have a view!!!"); - nsRect rect(0,0,0,0); - view->GetBounds(rect); - - size.width = rect.width; - size.height = rect.height; - + nsRect rect = view->GetBounds(); + nsSize size(rect.width, rect.height); + nsBox::AddMargin(child, size); nsBox::AddBorderAndPadding(mScrollAreaBox, size); nsBox::AddInset(mScrollAreaBox, size); @@ -1676,8 +1661,7 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl nsIFrame* frame = nsnull; aScrollbar->GetFrame(&frame); - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); + nsIContent* content = frame->GetContent(); PRBool old = PR_TRUE; @@ -1716,8 +1700,7 @@ nsGfxScrollFrameInner::GetIntegerAttribute(nsIBox* aBox, nsIAtom* atom, PRInt32 nsIFrame* frame = nsnull; aBox->GetFrame(&frame); - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); + nsIContent* content = frame->GetContent(); nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, atom, value)) @@ -1734,6 +1717,7 @@ nsGfxScrollFrameInner::GetIntegerAttribute(nsIBox* aBox, nsIAtom* atom, PRInt32 nsresult nsGfxScrollFrame::GetContentOf(nsIContent** aContent) { - GetContent(aContent); - return NS_OK; + *aContent = GetContent(); + NS_IF_ADDREF(*aContent); + return NS_OK; } diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index 5aecd6e4c95..c3207649445 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -180,7 +180,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext, } else { // walk tree - for (nsIFrame *frame = this; frame && decorMask; frame->GetParent(&frame)) { + for (nsIFrame *frame = this; frame && decorMask; frame = frame->GetParent()) { // find text-decorations. "Inherit" from parent *block* frames nsStyleContext* styleContext = frame->GetStyleContext(); @@ -233,7 +233,7 @@ HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent) nsCOMPtr frameType; for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; - kid->GetNextSibling(&kid)) + kid = kid->GetNextSibling()) { kid->GetFrameType(getter_AddRefs(frameType)); if (frameType == nsLayoutAtoms::textFrame) { @@ -330,8 +330,7 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext* aPresContext, if (nsnull == nextInFlow) { // Create a continuation frame for the child frame and insert it // into our lines child list. - nsIFrame* nextFrame; - aFrame->GetNextSibling(&nextFrame); + nsIFrame* nextFrame = aFrame->GetNextSibling(); nsIPresShell* presShell; nsIStyleSet* styleSet; @@ -369,7 +368,7 @@ ReparentFrameViewTo(nsIPresContext* aPresContext, // Does aFrame have a view? if (aFrame->HasView()) { - nsIView* view = aFrame->GetView(aPresContext); + nsIView* view = aFrame->GetView(); // Verify that the current parent view is what we think it is //nsIView* parentView; //NS_ASSERTION(parentView == aOldParentView, "unexpected parent view"); @@ -392,7 +391,7 @@ ReparentFrameViewTo(nsIPresContext* aPresContext, // a view nsIFrame* childFrame; aFrame->FirstChild(aPresContext, listName, &childFrame); - for (; childFrame; childFrame->GetNextSibling(&childFrame)) { + for (; childFrame; childFrame = childFrame->GetNextSibling()) { ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView); } @@ -434,8 +433,8 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, // This works well in the common case where we push/pull and the old parent // frame and the new parent frame are part of the same flow. They will // typically be the same distance (height wise) from the - aOldParentFrame->GetParent(&aOldParentFrame); - aNewParentFrame->GetParent(&aNewParentFrame); + aOldParentFrame = aOldParentFrame->GetParent(); + aNewParentFrame = aNewParentFrame->GetParent(); // We should never walk all the way to the root frame without finding // a view @@ -458,18 +457,15 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, // We found views for one or both of the ancestor frames before we // found a common ancestor. - nsIView* oldParentView = aOldParentFrame->GetClosestView(aPresContext); - nsIView* newParentView = aNewParentFrame->GetClosestView(aPresContext); + nsIView* oldParentView = aOldParentFrame->GetClosestView(); + nsIView* newParentView = aNewParentFrame->GetClosestView(); // See if the old parent frame and the new parent frame are in the // same view sub-hierarchy. If they are then we don't have to do // anything if (oldParentView != newParentView) { - nsCOMPtr viewManager; - oldParentView->GetViewManager(*getter_AddRefs(viewManager)); - // They're not so we need to reparent any child views - return ReparentFrameViewTo(aPresContext, aChildFrame, viewManager, newParentView, + return ReparentFrameViewTo(aPresContext, aChildFrame, oldParentView->GetViewManager(), newParentView, oldParentView); } @@ -496,8 +492,8 @@ nsHTMLContainerFrame::ReparentFrameViewList(nsIPresContext* aPresContext, // This works well in the common case where we push/pull and the old parent // frame and the new parent frame are part of the same flow. They will // typically be the same distance (height wise) from the - aOldParentFrame->GetParent(&aOldParentFrame); - aNewParentFrame->GetParent(&aNewParentFrame); + aOldParentFrame = aOldParentFrame->GetParent(); + aNewParentFrame = aNewParentFrame->GetParent(); // We should never walk all the way to the root frame without finding // a view @@ -521,18 +517,17 @@ nsHTMLContainerFrame::ReparentFrameViewList(nsIPresContext* aPresContext, // We found views for one or both of the ancestor frames before we // found a common ancestor. - nsIView* oldParentView = aOldParentFrame->GetClosestView(aPresContext); - nsIView* newParentView = aNewParentFrame->GetClosestView(aPresContext); + nsIView* oldParentView = aOldParentFrame->GetClosestView(); + nsIView* newParentView = aNewParentFrame->GetClosestView(); // See if the old parent frame and the new parent frame are in the // same view sub-hierarchy. If they are then we don't have to do // anything if (oldParentView != newParentView) { - nsCOMPtr viewManager; - oldParentView->GetViewManager(*getter_AddRefs(viewManager)); + nsIViewManager* viewManager = oldParentView->GetViewManager(); // They're not so we need to reparent any child views - for (nsIFrame* f = aChildFrameList; f; f->GetNextSibling(&f)) { + for (nsIFrame* f = aChildFrameList; f; f = f->GetNextSibling()) { ReparentFrameViewTo(aPresContext, f, viewManager, newParentView, oldParentView); } @@ -559,11 +554,10 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, } // Create a view - nsIFrame* parent = nsnull; - aFrame->GetParentWithView(aPresContext, &parent); + nsIFrame* parent = aFrame->GetAncestorWithView(); NS_ASSERTION(parent, "GetParentWithView failed"); - nsIView* parentView = parent->GetView(aPresContext); + nsIView* parentView = parent->GetView(); NS_ASSERTION(parentView, "no parent with view"); // Create a view @@ -574,14 +568,11 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, return result; } - nsCOMPtr viewManager; - parentView->GetViewManager(*getter_AddRefs(viewManager)); - NS_ASSERTION(nsnull != viewManager, "null view manager"); + nsIViewManager* viewManager = parentView->GetViewManager(); + NS_ASSERTION(viewManager, "null view manager"); // Initialize the view - nsRect bounds; - aFrame->GetRect(bounds); - view->Init(viewManager, bounds, parentView); + view->Init(viewManager, aFrame->GetRect(), parentView); SyncFrameViewProperties(aPresContext, aFrame, aStyleContext, view); @@ -595,7 +586,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, viewManager->InsertChild(parentView, view, nsnull, PR_TRUE); if (nsnull != aContentParentFrame) { - nsIView* zParentView = aContentParentFrame->GetClosestView(aPresContext); + nsIView* zParentView = aContentParentFrame->GetClosestView(); if (zParentView != parentView) { viewManager->InsertZPlaceholder(zParentView, view, nsnull, PR_TRUE); } @@ -610,7 +601,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, } // Remember our view - aFrame->SetView(aPresContext, view); + aFrame->SetView(view); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsHTMLContainerFrame::CreateViewForFrame: frame=%p view=%p", diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index dcc3dbade3a..a1fec30f7d6 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -227,9 +227,7 @@ CanvasFrame::Init(nsIPresContext* aPresContext, { nsresult rv = nsHTMLContainerFrame::Init(aPresContext,aContent,aParent,aContext,aPrevInFlow); - nsCOMPtr presShell; - aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->GetViewManager(getter_AddRefs(mViewManager)); + mViewManager = aPresContext->GetViewManager(); nsIScrollableView* scrollingView = nsnull; mViewManager->GetRootScrollableView(&scrollingView); @@ -359,9 +357,7 @@ CanvasFrame::RemoveFrame(nsIPresContext* aPresContext, } else if (aOldFrame == mFrames.FirstChild()) { // It's our one and only child frame // Damage the area occupied by the deleted frame - nsRect damageRect; - aOldFrame->GetRect(damageRect); - Invalidate(aPresContext, damageRect, PR_FALSE); + Invalidate(aPresContext, aOldFrame->GetRect(), PR_FALSE); // Remove the frame and destroy it mFrames.DestroyFrame(aPresContext, aOldFrame); @@ -430,8 +426,7 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, #endif if (mDoPaintFocus) { - nsRect focusRect; - GetRect(focusRect); + nsRect focusRect = GetRect(); ///////////////////// // draw focus // XXX This is only temporary @@ -441,14 +436,13 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, nsCOMPtr stateManager; nsresult rv = aPresContext->GetEventStateManager(getter_AddRefs(stateManager)); if (NS_SUCCEEDED(rv)) { - nsIFrame * parentFrame; - GetParent(&parentFrame); + nsIFrame * parentFrame = GetParent(); nsIScrollableFrame* scrollableFrame; if (NS_SUCCEEDED(parentFrame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollableFrame))) { nscoord width, height; scrollableFrame->GetClipSize(aPresContext, &width, &height); } - nsIView* parentView = parentFrame->GetView(aPresContext); + nsIView* parentView = parentFrame->GetView(); nsIScrollableView* scrollableView; if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollableView))) { @@ -456,8 +450,7 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, scrollableView->GetContainerSize(&width, &height); const nsIView* clippedView; scrollableView->GetClipView(&clippedView); - nsRect vcr; - clippedView->GetBounds(vcr); + nsRect vcr = clippedView->GetBounds(); focusRect.width = vcr.width; focusRect.height = vcr.height; nscoord x,y; @@ -573,11 +566,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext, if (eReflowReason_Incremental == aReflowState.reason) { // Restore original kid desired dimensions in case it decides to // reuse them during incremental reflow. - nsRect r; - kidFrame->GetRect(r); - r.width = mSavedChildWidth; - r.height = mSavedChildHeight; - kidFrame->SetRect(aPresContext, r); + kidFrame->SetSize(nsSize(mSavedChildWidth, mSavedChildHeight)); } // Reflow the frame @@ -592,15 +581,13 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext, // take into account the combined area and any space taken up by // absolutely positioned elements nsMargin border; - nsFrameState kidState; if (!kidReflowState.mStyleBorder->GetBorder(border)) { NS_NOTYETIMPLEMENTED("percentage border"); } - kidFrame->GetFrameState(&kidState); // First check the combined area - if (NS_FRAME_OUTSIDE_CHILDREN & kidState) { + if (NS_FRAME_OUTSIDE_CHILDREN & kidFrame->GetStateBits()) { // The background covers the content area and padding area, so check // for children sticking outside the child frame's padding edge nscoord paddingEdgeX = kidDesiredSize.width - border.right; diff --git a/mozilla/layout/generic/nsHTMLReflowCommand.cpp b/mozilla/layout/generic/nsHTMLReflowCommand.cpp index 8833d2d9479..f4d7ad032bd 100644 --- a/mozilla/layout/generic/nsHTMLReflowCommand.cpp +++ b/mozilla/layout/generic/nsHTMLReflowCommand.cpp @@ -233,7 +233,7 @@ nsHTMLReflowCommand::List(FILE* out) const // state at this point. if (mTargetFrame) { PRBool didOne = PR_FALSE; - for (nsIFrame* f = mTargetFrame; nsnull != f; f->GetParent(&f)) { + for (nsIFrame* f = mTargetFrame; f; f = f->GetParent()) { if (f != mTargetFrame) { fprintf(out, " "); nsFrame::ListTag(out, f); diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index f35318c695d..2bbc42614c4 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -389,15 +389,11 @@ nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame, { nsCSSFrameType frameType; - // Get the frame state - nsFrameState frameState; - aFrame->GetFrameState(&frameState); - // Section 9.7 of the CSS2 spec indicates that absolute position // takes precedence over float which takes precedence over display. // Make sure the frame was actually moved out of the flow, and don't // just assume what the style says - if (frameState & NS_FRAME_OUT_OF_FLOW) { + if (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) { if (aDisplay->IsAbsolutelyPositioned()) { frameType = NS_CSS_FRAME_TYPE_ABSOLUTE; } @@ -448,7 +444,7 @@ nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame, } // See if the frame is replaced - if (frameState & NS_FRAME_REPLACED_ELEMENT) { + if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) { frameType = NS_FRAME_REPLACED(frameType); } @@ -589,7 +585,7 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs, static nsIFrame* GetNearestContainingBlock(nsIFrame* aFrame, nsMargin& aContentArea) { - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); while (aFrame) { nsIAtom* frameType; PRBool isBlock; @@ -602,13 +598,12 @@ GetNearestContainingBlock(nsIFrame* aFrame, nsMargin& aContentArea) if (isBlock) { break; } - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); } if (aFrame) { - nsSize size; - - aFrame->GetSize(size); + nsSize size = aFrame->GetSize(); + aContentArea.left = 0; aContentArea.top = 0; aContentArea.right = size.width; @@ -738,18 +733,14 @@ GetPlaceholderOffset(nsIFrame* aPlaceholderFrame, nsIFrame* aBlockFrame, nsPoint& aOffset) { - aPlaceholderFrame->GetOrigin(aOffset); + aOffset = aPlaceholderFrame->GetPosition(); // Convert the placeholder position to the coordinate space of the block // frame that contains it - nsIFrame* parent; - aPlaceholderFrame->GetParent(&parent); + nsIFrame* parent = aPlaceholderFrame->GetParent(); while (parent && (parent != aBlockFrame)) { - nsPoint origin; - - parent->GetOrigin(origin); - aOffset += origin; - parent->GetParent(&parent); + aOffset += parent->GetPosition(); + parent = parent->GetParent(); } } @@ -759,9 +750,7 @@ FindImmediateChildOf(nsIFrame* aParent, nsIFrame* aDescendantFrame) nsIFrame* result = aDescendantFrame; while (result) { - nsIFrame* parent; - - result->GetParent(&parent); + nsIFrame* parent = result->GetParent(); if (parent == aParent) { break; } @@ -928,15 +917,14 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext, if (aBlockFrame != aAbsoluteContainingBlockFrame) { nsIFrame* parent = aBlockFrame; do { - nsPoint origin; + nsPoint origin = parent->GetPosition(); - parent->GetOrigin(origin); aHypotheticalBox.mLeft += origin.x; aHypotheticalBox.mRight += origin.x; aHypotheticalBox.mTop += origin.y; // Move up the tree one level - parent->GetParent(&parent); + parent = parent->GetParent(); } while (parent && (parent != aAbsoluteContainingBlockFrame)); } @@ -1335,10 +1323,8 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext, static PRBool IsInitialContainingBlock(nsIFrame* aFrame) { - nsCOMPtr content; - PRBool result = PR_FALSE; + nsIContent* content = aFrame->GetContent(); - aFrame->GetContent(getter_AddRefs(content)); if (content) { nsCOMPtr parentContent; @@ -1346,10 +1332,10 @@ IsInitialContainingBlock(nsIFrame* aFrame) if (!parentContent) { // The containing block corresponds to the document element so it's // the initial containing block - result = PR_TRUE; + return PR_TRUE; } } - return result; + return PR_FALSE; } nscoord @@ -1457,18 +1443,18 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState, #ifdef DEBUG // make sure the Area is the HTML and the Block is the BODY - nsCOMPtr frameContent; - nsCOMPtr contentTag; - if(firstBlockRS) { - firstBlockRS->frame->GetContent(getter_AddRefs(frameContent)); + if (firstBlockRS) { + nsIContent* frameContent = firstBlockRS->frame->GetContent(); if (frameContent) { + nsCOMPtr contentTag; frameContent->GetTag(getter_AddRefs(contentTag)); NS_ASSERTION(contentTag.get() == nsHTMLAtoms::body, "block is not BODY"); } } - if(firstAreaRS) { - firstAreaRS->frame->GetContent(getter_AddRefs(frameContent)); + if (firstAreaRS) { + nsIContent* frameContent = firstAreaRS->frame->GetContent(); if (frameContent) { + nsCOMPtr contentTag; frameContent->GetTag(getter_AddRefs(contentTag)); NS_ASSERTION(contentTag.get() == nsHTMLAtoms::html, "Area frame is not HTML element"); } @@ -2785,11 +2771,7 @@ nsHTMLReflowState::IsBidiFormControl(nsIPresContext* aPresContext) return PR_FALSE; } - nsCOMPtr content, parent; - nsresult rv = frame->GetContent(getter_AddRefs(content) ); - if (NS_FAILED(rv)) { - return PR_FALSE; - } + nsIContent* content = frame->GetContent(); if (!content) { return PR_FALSE; } @@ -2799,9 +2781,10 @@ nsHTMLReflowState::IsBidiFormControl(nsIPresContext* aPresContext) // Otherwise, just test this content node if (mReflowDepth == 0) { while (content) { - if (content->IsContentOfType(nsIContent::eHTML_FORM_CONTROL)) { + if (content->IsContentOfType(nsIContent::eHTML_FORM_CONTROL)) { return PR_TRUE; } + nsCOMPtr parent; content->GetParent(getter_AddRefs(parent)); content = parent; } diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 8c33ad5b38b..7517ed96c08 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -678,8 +678,7 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest, mParent->ReflowDirtyChild(presShell, NS_STATIC_CAST(nsIFrame*, this)); } } else { - nsSize s; - GetSize(s); + nsSize s = GetSize(); nsRect r(0, 0, s.width, s.height); if (!r.IsEmpty()) { Invalidate(mPresContext, r, PR_FALSE); @@ -864,8 +863,7 @@ nsImageFrame::GetContinuationOffset(nscoord* aWidth) const if (mPrevInFlow) { for (nsIFrame* prevInFlow = mPrevInFlow ; prevInFlow; prevInFlow->GetPrevInFlow(&prevInFlow)) { - nsRect rect; - prevInFlow->GetRect(rect); + nsRect rect = prevInFlow->GetRect(); if (aWidth) { *aWidth = rect.width; } @@ -1211,14 +1209,12 @@ nsImageFrame::DisplayAltFeedback(nsIPresContext* aPresContext, // If there's still room, display the alt-text if (!inner.IsEmpty()) { - nsCOMPtr content; - nsCOMPtr tag; - nsAutoString altText; - - GetContent(getter_AddRefs(content)); + nsIContent* content = GetContent(); if (content) { + nsCOMPtr tag; content->GetTag(getter_AddRefs(tag)); if (tag) { + nsAutoString altText; nsCSSFrameConstructor::GetAlternateTextFor(content, tag, altText); DisplayAltText(aPresContext, aRenderingContext, altText, inner); } @@ -1659,7 +1655,9 @@ nsImageFrame::GetContentForEvent(nsIPresContext* aPresContext, } } - return GetContent(aContent); + *aContent = GetContent(); + NS_IF_ADDREF(*aContent); + return NS_OK; } // XXX what should clicks on transparent pixels do? @@ -1819,7 +1817,7 @@ nsImageFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con fprintf(out, " [parent=%p]", mParent); #endif if (HasView()) { - fprintf(out, " [view=%p]", GetView(aPresContext)); + fprintf(out, " [view=%p]", GetView()); } fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); diff --git a/mozilla/layout/generic/nsImageMap.cpp b/mozilla/layout/generic/nsImageMap.cpp index 52e97e71e67..0b205b8d139 100644 --- a/mozilla/layout/generic/nsImageMap.cpp +++ b/mozilla/layout/generic/nsImageMap.cpp @@ -1189,22 +1189,20 @@ nsImageMap::HandleEvent(nsIDOMEvent* aEvent) nsresult nsImageMap::Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect) { - nsCOMPtr viewManager; PRUint32 flags = NS_VMREFRESH_IMMEDIATE; nsIView* view; nsRect damageRect(aRect); if (aFrame->HasView()) { - view = aFrame->GetView(aPresContext); + view = aFrame->GetView(); } else { nsPoint offset; aFrame->GetOffsetFromView(aPresContext, offset, &view); - NS_ASSERTION(nsnull != view, "no view"); + NS_ASSERTION(view, "no view"); damageRect += offset; } - view->GetViewManager(*getter_AddRefs(viewManager)); - viewManager->UpdateView(view, damageRect, flags); + view->GetViewManager()->UpdateView(view, damageRect, flags); return NS_OK; diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index b28a502d933..ac94c83686e 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -163,9 +163,7 @@ PR_STATIC_CALLBACK(const void *) PrimaryFrameMapGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) { PrimaryFrameMapEntry *entry = NS_STATIC_CAST(PrimaryFrameMapEntry*, hdr); - nsCOMPtr content; - entry->frame->GetContent(getter_AddRefs(content)); - return content; + return entry->frame->GetContent(); // and then release it, but we know the frame still owns it :-) } @@ -175,9 +173,7 @@ PrimaryFrameMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, { const PrimaryFrameMapEntry *entry = NS_STATIC_CAST(const PrimaryFrameMapEntry*, hdr); - nsCOMPtr content; - entry->frame->GetContent(getter_AddRefs(content)); - return content == key; + return entry->frame->GetContent() == key; } static PLDHashTableOps PrimaryFrameMapOps = { @@ -559,7 +555,7 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const *aCanvasFrame = siblingFrame; break; } else { - siblingFrame->GetNextSibling(&siblingFrame); + siblingFrame = siblingFrame->GetNextSibling(); } } // move on to the child's child @@ -675,10 +671,7 @@ FrameManager::SetPrimaryFrameFor(nsIContent* aContent, // This code should be used if/when we switch back to a 2-word entry // in the primary frame map. #if 0 -//#ifdef DEBUG - nsCOMPtr content; - aPrimaryFrame->GetContent(getter_AddRefs(content)); - NS_PRECONDITION(content == aContent, "wrong content"); + NS_PRECONDITION(aPrimaryFrame->GetContent() == aContent, "wrong content"); #endif // Create a new hashtable if necessary @@ -1031,10 +1024,8 @@ FrameManager::NotifyDestroyingFrame(nsIFrame* aFrame) #ifdef DEBUG if (mPrimaryFrameMap.ops) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); PrimaryFrameMapEntry *entry = NS_STATIC_CAST(PrimaryFrameMapEntry*, - PL_DHashTableOperate(&mPrimaryFrameMap, content, PL_DHASH_LOOKUP)); + PL_DHashTableOperate(&mPrimaryFrameMap, aFrame->GetContent(), PL_DHASH_LOOKUP)); NS_ASSERTION(!PL_DHASH_ENTRY_IS_BUSY(entry) || entry->frame != aFrame, "frame was not removed from primary frame map before " "destruction or was readded to map after being removed"); @@ -1429,9 +1420,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* child = nsnull; nsresult result = aFrame->FirstChild(aPresContext, childList, &child); while ((NS_SUCCEEDED(result)) && child) { - nsFrameState state; - child->GetFrameState(&state); - if (NS_FRAME_OUT_OF_FLOW != (state & NS_FRAME_OUT_OF_FLOW)) { + if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow child->GetFrameType(&frameType); if (nsLayoutAtoms::placeholderFrame == frameType) { @@ -1452,7 +1441,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* } NS_IF_RELEASE(frameType); } - child->GetNextSibling(&child); + child = child->GetNextSibling(); } NS_IF_RELEASE(childList); @@ -1515,9 +1504,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, child = nsnull; result = aFrame->FirstChild(presContext, childList, &child); while ((NS_SUCCEEDED(result)) && child) { - nsFrameState state; - child->GetFrameState(&state); - if (NS_FRAME_OUT_OF_FLOW != (state & NS_FRAME_OUT_OF_FLOW)) { + if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow child->GetFrameType(&frameType); if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder @@ -1537,7 +1524,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, NS_IF_RELEASE(frameType); } - child->GetNextSibling(&child); + child = child->GetNextSibling(); } NS_IF_RELEASE(childList); @@ -1653,19 +1640,11 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, if (oldContext) { oldContext->AddRef(); nsCOMPtr pseudoTag = oldContext->GetPseudoType(); - nsIContent* localContent = nsnull; - nsIContent* content = nsnull; - result = aFrame->GetContent(&localContent); - if (NS_SUCCEEDED(result) && localContent) { - content = localContent; - } - else { - content = aParentContent; - } + nsIContent* localContent = aFrame->GetContent(); + nsIContent* content = localContent ? localContent : aParentContent; + if (aParentContent && aAttribute) { // attribute came from parent, we don't care about it here when recursing - nsFrameState frameState; - aFrame->GetFrameState(&frameState); - if (0 == (frameState & NS_FRAME_GENERATED_CONTENT)) { // keep it for generated content + if (!(aFrame->GetStateBits() & NS_FRAME_GENERATED_CONTENT)) { // keep it for generated content aAttribute = nsnull; } } @@ -1934,9 +1913,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, nsIFrame* child = nsnull; result = aFrame->FirstChild(aPresContext, childList, &child); while (NS_SUCCEEDED(result) && child) { - nsFrameState state; - child->GetFrameState(&state); - if (!(state & NS_FRAME_OUT_OF_FLOW)) { + if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow nsCOMPtr frameType; child->GetFrameType(getter_AddRefs(frameType)); @@ -1970,7 +1947,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, } } } - child->GetNextSibling(&child); + child = child->GetNextSibling(); } NS_IF_RELEASE(childList); @@ -1980,7 +1957,6 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, } newContext->Release(); - NS_IF_RELEASE(localContent); } } @@ -2035,9 +2011,7 @@ FrameManager::ComputeStyleChangeFor(nsIFrame* aFrame, } while (frame); // Might we have special siblings? - nsFrameState frame2state; - frame2->GetFrameState(&frame2state); - if (! (frame2state & NS_FRAME_IS_SPECIAL)) { + if (!(frame2->GetStateBits() & NS_FRAME_IS_SPECIAL)) { // nothing more to do here return NS_OK; } @@ -2096,11 +2070,8 @@ FrameManager::CaptureFrameStateFor(nsIFrame* aFrame, // Generate the hash key to store the state under // Exit early if we get empty key - nsCOMPtr content; - rv = aFrame->GetContent(getter_AddRefs(content)); - nsCAutoString stateKey; - rv = nsContentUtils::GenerateStateKey(content, aID, stateKey); + rv = nsContentUtils::GenerateStateKey(aFrame->GetContent(), aID, stateKey); if(NS_FAILED(rv) || stateKey.IsEmpty()) { return rv; } @@ -2128,7 +2099,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, while (childFrame) { rv = CaptureFrameState(childFrame, aState); // Get the next sibling child frame - childFrame->GetNextSibling(&childFrame); + childFrame = childFrame->GetNextSibling(); } NS_IF_RELEASE(childListName); aFrame->GetAdditionalChildListName(childListIndex++, &childListName); @@ -2155,17 +2126,15 @@ FrameManager::RestoreFrameStateFor(nsIFrame* aFrame, // Generate the hash key the state was stored under // Exit early if we get empty key - nsresult rv = NS_OK; - nsCOMPtr content; - rv = aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); // If we don't have content, we can't generate a hash // key and there's probably no state information for us. if (!content) { - return rv; + return NS_OK; } nsCAutoString stateKey; - rv = nsContentUtils::GenerateStateKey(content, aID, stateKey); + nsresult rv = nsContentUtils::GenerateStateKey(content, aID, stateKey); if (NS_FAILED(rv) || stateKey.IsEmpty()) { return rv; } @@ -2203,7 +2172,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) while (childFrame) { rv = RestoreFrameState(childFrame, aState); // Get the next sibling child frame - childFrame->GetNextSibling(&childFrame); + childFrame = childFrame->GetNextSibling(); } NS_IF_RELEASE(childListName); aFrame->GetAdditionalChildListName(childListIndex++, &childListName); diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index e6556987743..cb0987ae27c 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -611,19 +611,16 @@ nsGfxScrollFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, nsIFrame* frame = nsnull; mInner->mScrollAreaBox->GetFrame(&frame); nsPoint point(aPoint); - nsPoint currentPoint; //we need to translate the coordinates to the inner - nsIView *view = GetClosestView(aCX); + nsIView *view = GetClosestView(); if (!view) return NS_ERROR_FAILURE; - nsIView *innerView = GetClosestView(aCX); + nsIView *innerView = GetClosestView(); while (view != innerView && innerView) { - innerView->GetPosition(¤tPoint.x, ¤tPoint.y); - point.x -= currentPoint.x; - point.y -= currentPoint.y; - innerView->GetParent(innerView); + point -= innerView->GetPosition(); + innerView = innerView->GetParent(); } return frame->GetContentAndOffsetsFromPoint(aCX, point, aNewContent, aContentOffset, aContentOffsetEnd, aBeginFrameContent); @@ -982,15 +979,10 @@ nsGfxScrollFrameInner::CurPosAttributeChanged(nsIPresContext* aPresContext, if (mVScrollbarBox) mVScrollbarBox->GetFrame(&vframe); - nsCOMPtr vcontent; - nsCOMPtr hcontent; + nsIContent* vcontent = vframe ? vframe->GetContent() : nsnull; + nsIContent* hcontent = hframe ? hframe->GetContent() : nsnull; - if (hframe) - hframe->GetContent(getter_AddRefs(hcontent)); - if (vframe) - vframe->GetContent(getter_AddRefs(vcontent)); - - if (hcontent.get() == aContent || vcontent.get() == aContent) + if (hcontent == aContent || vcontent == aContent) { nscoord x = 0; nscoord y = 0; @@ -1054,7 +1046,7 @@ nsGfxScrollFrameInner::CurPosAttributeChanged(nsIPresContext* aPresContext, // likewise for vcontent and vframe. Thus targetFrame will always // be non-null in here. nsIFrame* targetFrame = - hcontent.get() == aContent ? hframe : vframe; + hcontent == aContent ? hframe : vframe; presShell->HandleEventWithTarget(&event, targetFrame, aContent, NS_EVENT_FLAG_INIT, &status); @@ -1070,7 +1062,7 @@ nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext) { nsIFrame* frame = nsnull; mScrollAreaBox->GetFrame(&frame); - nsIView* view = frame->GetView(aPresContext); + nsIView* view = frame->GetView(); if (!view) return nsnull; nsIScrollableView* scrollingView; @@ -1569,8 +1561,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) if ((oldScrollAreaBounds.width != scrollAreaRect.width || oldScrollAreaBounds.height != scrollAreaRect.height) && nsBoxLayoutState::Dirty == aState.GetLayoutReason()) { - nsIFrame* parentFrame; - mOuter->GetParent(&parentFrame); + nsIFrame* parentFrame = mOuter->GetParent(); if (parentFrame) { nsCOMPtr parentFrameType; parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); @@ -1622,11 +1613,9 @@ nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, { nsIFrame* frame = nsnull; aBox->GetFrame(&frame); - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); nsAutoString newValue; newValue.AppendInt(aSize); - content->SetAttr(kNameSpaceID_None, aAtom, newValue, aReflow); + frame->GetContent()->SetAttr(kNameSpaceID_None, aAtom, newValue, aReflow); return PR_TRUE; } @@ -1643,20 +1632,16 @@ nsGfxScrollFrameInner::GetScrolledSize(nsIPresContext* aPresContext, { // our scrolled size is the size of our scrolled view. - nsSize size; nsIBox* child = nsnull; mScrollAreaBox->GetChildBox(&child); nsIFrame* frame; child->GetFrame(&frame); - nsIView* view = frame->GetView(aPresContext); + nsIView* view = frame->GetView(); NS_ASSERTION(view,"Scrolled frame must have a view!!!"); - nsRect rect(0,0,0,0); - view->GetBounds(rect); - - size.width = rect.width; - size.height = rect.height; - + nsRect rect = view->GetBounds(); + nsSize size(rect.width, rect.height); + nsBox::AddMargin(child, size); nsBox::AddBorderAndPadding(mScrollAreaBox, size); nsBox::AddInset(mScrollAreaBox, size); @@ -1676,8 +1661,7 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl nsIFrame* frame = nsnull; aScrollbar->GetFrame(&frame); - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); + nsIContent* content = frame->GetContent(); PRBool old = PR_TRUE; @@ -1716,8 +1700,7 @@ nsGfxScrollFrameInner::GetIntegerAttribute(nsIBox* aBox, nsIAtom* atom, PRInt32 nsIFrame* frame = nsnull; aBox->GetFrame(&frame); - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); + nsIContent* content = frame->GetContent(); nsAutoString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, atom, value)) @@ -1734,6 +1717,7 @@ nsGfxScrollFrameInner::GetIntegerAttribute(nsIBox* aBox, nsIAtom* atom, PRInt32 nsresult nsGfxScrollFrame::GetContentOf(nsIContent** aContent) { - GetContent(aContent); - return NS_OK; + *aContent = GetContent(); + NS_IF_ADDREF(*aContent); + return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsHRFrame.cpp b/mozilla/layout/html/base/src/nsHRFrame.cpp index 1c4647bf23c..937c4663c72 100644 --- a/mozilla/layout/html/base/src/nsHRFrame.cpp +++ b/mozilla/layout/html/base/src/nsHRFrame.cpp @@ -123,20 +123,14 @@ HRuleFrame::Paint(nsIPresContext* aPresContext, return NS_OK; } - nsIFrame *parent = nsnull; - //hack to get around lack of selection bit setting. - GetParent(&parent);//get the parent and check to see if its selected + nsIFrame *parent = GetParent(); + // hack to get around lack of selection bit setting. + // get the parent and check to see if its selected PRBool isSelected = PR_FALSE; if (parent) { - nsCOMPtr content; - parent->GetContent(getter_AddRefs(content)); - nsFrameState frameState; - if (content.get() == mContent) - parent->GetFrameState(&frameState); - else - GetFrameState(&frameState); - isSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT; + isSelected = (((parent->GetContent() == mContent) ? parent : this)->GetStateBits() + & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT; } if (isSelected) //check the display flags to see if we draw this frame selected. { @@ -379,9 +373,7 @@ HRuleFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aPresContext, if (!aNewContent) return NS_ERROR_NULL_POINTER; if (!mContent) return NS_ERROR_NULL_POINTER; - nsRect thisRect; - rv = GetRect(thisRect); - if (NS_FAILED(rv)) return rv; + nsRect thisRect = GetRect(); nsPoint offsetPoint; nsIView *view; GetOffsetFromView(aPresContext, offsetPoint, &view); diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index 5aecd6e4c95..c3207649445 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -180,7 +180,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext, } else { // walk tree - for (nsIFrame *frame = this; frame && decorMask; frame->GetParent(&frame)) { + for (nsIFrame *frame = this; frame && decorMask; frame = frame->GetParent()) { // find text-decorations. "Inherit" from parent *block* frames nsStyleContext* styleContext = frame->GetStyleContext(); @@ -233,7 +233,7 @@ HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent) nsCOMPtr frameType; for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; - kid->GetNextSibling(&kid)) + kid = kid->GetNextSibling()) { kid->GetFrameType(getter_AddRefs(frameType)); if (frameType == nsLayoutAtoms::textFrame) { @@ -330,8 +330,7 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext* aPresContext, if (nsnull == nextInFlow) { // Create a continuation frame for the child frame and insert it // into our lines child list. - nsIFrame* nextFrame; - aFrame->GetNextSibling(&nextFrame); + nsIFrame* nextFrame = aFrame->GetNextSibling(); nsIPresShell* presShell; nsIStyleSet* styleSet; @@ -369,7 +368,7 @@ ReparentFrameViewTo(nsIPresContext* aPresContext, // Does aFrame have a view? if (aFrame->HasView()) { - nsIView* view = aFrame->GetView(aPresContext); + nsIView* view = aFrame->GetView(); // Verify that the current parent view is what we think it is //nsIView* parentView; //NS_ASSERTION(parentView == aOldParentView, "unexpected parent view"); @@ -392,7 +391,7 @@ ReparentFrameViewTo(nsIPresContext* aPresContext, // a view nsIFrame* childFrame; aFrame->FirstChild(aPresContext, listName, &childFrame); - for (; childFrame; childFrame->GetNextSibling(&childFrame)) { + for (; childFrame; childFrame = childFrame->GetNextSibling()) { ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView); } @@ -434,8 +433,8 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, // This works well in the common case where we push/pull and the old parent // frame and the new parent frame are part of the same flow. They will // typically be the same distance (height wise) from the - aOldParentFrame->GetParent(&aOldParentFrame); - aNewParentFrame->GetParent(&aNewParentFrame); + aOldParentFrame = aOldParentFrame->GetParent(); + aNewParentFrame = aNewParentFrame->GetParent(); // We should never walk all the way to the root frame without finding // a view @@ -458,18 +457,15 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, // We found views for one or both of the ancestor frames before we // found a common ancestor. - nsIView* oldParentView = aOldParentFrame->GetClosestView(aPresContext); - nsIView* newParentView = aNewParentFrame->GetClosestView(aPresContext); + nsIView* oldParentView = aOldParentFrame->GetClosestView(); + nsIView* newParentView = aNewParentFrame->GetClosestView(); // See if the old parent frame and the new parent frame are in the // same view sub-hierarchy. If they are then we don't have to do // anything if (oldParentView != newParentView) { - nsCOMPtr viewManager; - oldParentView->GetViewManager(*getter_AddRefs(viewManager)); - // They're not so we need to reparent any child views - return ReparentFrameViewTo(aPresContext, aChildFrame, viewManager, newParentView, + return ReparentFrameViewTo(aPresContext, aChildFrame, oldParentView->GetViewManager(), newParentView, oldParentView); } @@ -496,8 +492,8 @@ nsHTMLContainerFrame::ReparentFrameViewList(nsIPresContext* aPresContext, // This works well in the common case where we push/pull and the old parent // frame and the new parent frame are part of the same flow. They will // typically be the same distance (height wise) from the - aOldParentFrame->GetParent(&aOldParentFrame); - aNewParentFrame->GetParent(&aNewParentFrame); + aOldParentFrame = aOldParentFrame->GetParent(); + aNewParentFrame = aNewParentFrame->GetParent(); // We should never walk all the way to the root frame without finding // a view @@ -521,18 +517,17 @@ nsHTMLContainerFrame::ReparentFrameViewList(nsIPresContext* aPresContext, // We found views for one or both of the ancestor frames before we // found a common ancestor. - nsIView* oldParentView = aOldParentFrame->GetClosestView(aPresContext); - nsIView* newParentView = aNewParentFrame->GetClosestView(aPresContext); + nsIView* oldParentView = aOldParentFrame->GetClosestView(); + nsIView* newParentView = aNewParentFrame->GetClosestView(); // See if the old parent frame and the new parent frame are in the // same view sub-hierarchy. If they are then we don't have to do // anything if (oldParentView != newParentView) { - nsCOMPtr viewManager; - oldParentView->GetViewManager(*getter_AddRefs(viewManager)); + nsIViewManager* viewManager = oldParentView->GetViewManager(); // They're not so we need to reparent any child views - for (nsIFrame* f = aChildFrameList; f; f->GetNextSibling(&f)) { + for (nsIFrame* f = aChildFrameList; f; f = f->GetNextSibling()) { ReparentFrameViewTo(aPresContext, f, viewManager, newParentView, oldParentView); } @@ -559,11 +554,10 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, } // Create a view - nsIFrame* parent = nsnull; - aFrame->GetParentWithView(aPresContext, &parent); + nsIFrame* parent = aFrame->GetAncestorWithView(); NS_ASSERTION(parent, "GetParentWithView failed"); - nsIView* parentView = parent->GetView(aPresContext); + nsIView* parentView = parent->GetView(); NS_ASSERTION(parentView, "no parent with view"); // Create a view @@ -574,14 +568,11 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, return result; } - nsCOMPtr viewManager; - parentView->GetViewManager(*getter_AddRefs(viewManager)); - NS_ASSERTION(nsnull != viewManager, "null view manager"); + nsIViewManager* viewManager = parentView->GetViewManager(); + NS_ASSERTION(viewManager, "null view manager"); // Initialize the view - nsRect bounds; - aFrame->GetRect(bounds); - view->Init(viewManager, bounds, parentView); + view->Init(viewManager, aFrame->GetRect(), parentView); SyncFrameViewProperties(aPresContext, aFrame, aStyleContext, view); @@ -595,7 +586,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, viewManager->InsertChild(parentView, view, nsnull, PR_TRUE); if (nsnull != aContentParentFrame) { - nsIView* zParentView = aContentParentFrame->GetClosestView(aPresContext); + nsIView* zParentView = aContentParentFrame->GetClosestView(); if (zParentView != parentView) { viewManager->InsertZPlaceholder(zParentView, view, nsnull, PR_TRUE); } @@ -610,7 +601,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, } // Remember our view - aFrame->SetView(aPresContext, view); + aFrame->SetView(view); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsHTMLContainerFrame::CreateViewForFrame: frame=%p view=%p", diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index dcc3dbade3a..a1fec30f7d6 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -227,9 +227,7 @@ CanvasFrame::Init(nsIPresContext* aPresContext, { nsresult rv = nsHTMLContainerFrame::Init(aPresContext,aContent,aParent,aContext,aPrevInFlow); - nsCOMPtr presShell; - aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->GetViewManager(getter_AddRefs(mViewManager)); + mViewManager = aPresContext->GetViewManager(); nsIScrollableView* scrollingView = nsnull; mViewManager->GetRootScrollableView(&scrollingView); @@ -359,9 +357,7 @@ CanvasFrame::RemoveFrame(nsIPresContext* aPresContext, } else if (aOldFrame == mFrames.FirstChild()) { // It's our one and only child frame // Damage the area occupied by the deleted frame - nsRect damageRect; - aOldFrame->GetRect(damageRect); - Invalidate(aPresContext, damageRect, PR_FALSE); + Invalidate(aPresContext, aOldFrame->GetRect(), PR_FALSE); // Remove the frame and destroy it mFrames.DestroyFrame(aPresContext, aOldFrame); @@ -430,8 +426,7 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, #endif if (mDoPaintFocus) { - nsRect focusRect; - GetRect(focusRect); + nsRect focusRect = GetRect(); ///////////////////// // draw focus // XXX This is only temporary @@ -441,14 +436,13 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, nsCOMPtr stateManager; nsresult rv = aPresContext->GetEventStateManager(getter_AddRefs(stateManager)); if (NS_SUCCEEDED(rv)) { - nsIFrame * parentFrame; - GetParent(&parentFrame); + nsIFrame * parentFrame = GetParent(); nsIScrollableFrame* scrollableFrame; if (NS_SUCCEEDED(parentFrame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollableFrame))) { nscoord width, height; scrollableFrame->GetClipSize(aPresContext, &width, &height); } - nsIView* parentView = parentFrame->GetView(aPresContext); + nsIView* parentView = parentFrame->GetView(); nsIScrollableView* scrollableView; if (NS_SUCCEEDED(CallQueryInterface(parentView, &scrollableView))) { @@ -456,8 +450,7 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, scrollableView->GetContainerSize(&width, &height); const nsIView* clippedView; scrollableView->GetClipView(&clippedView); - nsRect vcr; - clippedView->GetBounds(vcr); + nsRect vcr = clippedView->GetBounds(); focusRect.width = vcr.width; focusRect.height = vcr.height; nscoord x,y; @@ -573,11 +566,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext, if (eReflowReason_Incremental == aReflowState.reason) { // Restore original kid desired dimensions in case it decides to // reuse them during incremental reflow. - nsRect r; - kidFrame->GetRect(r); - r.width = mSavedChildWidth; - r.height = mSavedChildHeight; - kidFrame->SetRect(aPresContext, r); + kidFrame->SetSize(nsSize(mSavedChildWidth, mSavedChildHeight)); } // Reflow the frame @@ -592,15 +581,13 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext, // take into account the combined area and any space taken up by // absolutely positioned elements nsMargin border; - nsFrameState kidState; if (!kidReflowState.mStyleBorder->GetBorder(border)) { NS_NOTYETIMPLEMENTED("percentage border"); } - kidFrame->GetFrameState(&kidState); // First check the combined area - if (NS_FRAME_OUTSIDE_CHILDREN & kidState) { + if (NS_FRAME_OUTSIDE_CHILDREN & kidFrame->GetStateBits()) { // The background covers the content area and padding area, so check // for children sticking outside the child frame's padding edge nscoord paddingEdgeX = kidDesiredSize.width - border.right; diff --git a/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp b/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp index 8833d2d9479..f4d7ad032bd 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp @@ -233,7 +233,7 @@ nsHTMLReflowCommand::List(FILE* out) const // state at this point. if (mTargetFrame) { PRBool didOne = PR_FALSE; - for (nsIFrame* f = mTargetFrame; nsnull != f; f->GetParent(&f)) { + for (nsIFrame* f = mTargetFrame; f; f = f->GetParent()) { if (f != mTargetFrame) { fprintf(out, " "); nsFrame::ListTag(out, f); diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index f35318c695d..2bbc42614c4 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -389,15 +389,11 @@ nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame, { nsCSSFrameType frameType; - // Get the frame state - nsFrameState frameState; - aFrame->GetFrameState(&frameState); - // Section 9.7 of the CSS2 spec indicates that absolute position // takes precedence over float which takes precedence over display. // Make sure the frame was actually moved out of the flow, and don't // just assume what the style says - if (frameState & NS_FRAME_OUT_OF_FLOW) { + if (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) { if (aDisplay->IsAbsolutelyPositioned()) { frameType = NS_CSS_FRAME_TYPE_ABSOLUTE; } @@ -448,7 +444,7 @@ nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame, } // See if the frame is replaced - if (frameState & NS_FRAME_REPLACED_ELEMENT) { + if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) { frameType = NS_FRAME_REPLACED(frameType); } @@ -589,7 +585,7 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs, static nsIFrame* GetNearestContainingBlock(nsIFrame* aFrame, nsMargin& aContentArea) { - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); while (aFrame) { nsIAtom* frameType; PRBool isBlock; @@ -602,13 +598,12 @@ GetNearestContainingBlock(nsIFrame* aFrame, nsMargin& aContentArea) if (isBlock) { break; } - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); } if (aFrame) { - nsSize size; - - aFrame->GetSize(size); + nsSize size = aFrame->GetSize(); + aContentArea.left = 0; aContentArea.top = 0; aContentArea.right = size.width; @@ -738,18 +733,14 @@ GetPlaceholderOffset(nsIFrame* aPlaceholderFrame, nsIFrame* aBlockFrame, nsPoint& aOffset) { - aPlaceholderFrame->GetOrigin(aOffset); + aOffset = aPlaceholderFrame->GetPosition(); // Convert the placeholder position to the coordinate space of the block // frame that contains it - nsIFrame* parent; - aPlaceholderFrame->GetParent(&parent); + nsIFrame* parent = aPlaceholderFrame->GetParent(); while (parent && (parent != aBlockFrame)) { - nsPoint origin; - - parent->GetOrigin(origin); - aOffset += origin; - parent->GetParent(&parent); + aOffset += parent->GetPosition(); + parent = parent->GetParent(); } } @@ -759,9 +750,7 @@ FindImmediateChildOf(nsIFrame* aParent, nsIFrame* aDescendantFrame) nsIFrame* result = aDescendantFrame; while (result) { - nsIFrame* parent; - - result->GetParent(&parent); + nsIFrame* parent = result->GetParent(); if (parent == aParent) { break; } @@ -928,15 +917,14 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext, if (aBlockFrame != aAbsoluteContainingBlockFrame) { nsIFrame* parent = aBlockFrame; do { - nsPoint origin; + nsPoint origin = parent->GetPosition(); - parent->GetOrigin(origin); aHypotheticalBox.mLeft += origin.x; aHypotheticalBox.mRight += origin.x; aHypotheticalBox.mTop += origin.y; // Move up the tree one level - parent->GetParent(&parent); + parent = parent->GetParent(); } while (parent && (parent != aAbsoluteContainingBlockFrame)); } @@ -1335,10 +1323,8 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext, static PRBool IsInitialContainingBlock(nsIFrame* aFrame) { - nsCOMPtr content; - PRBool result = PR_FALSE; + nsIContent* content = aFrame->GetContent(); - aFrame->GetContent(getter_AddRefs(content)); if (content) { nsCOMPtr parentContent; @@ -1346,10 +1332,10 @@ IsInitialContainingBlock(nsIFrame* aFrame) if (!parentContent) { // The containing block corresponds to the document element so it's // the initial containing block - result = PR_TRUE; + return PR_TRUE; } } - return result; + return PR_FALSE; } nscoord @@ -1457,18 +1443,18 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState, #ifdef DEBUG // make sure the Area is the HTML and the Block is the BODY - nsCOMPtr frameContent; - nsCOMPtr contentTag; - if(firstBlockRS) { - firstBlockRS->frame->GetContent(getter_AddRefs(frameContent)); + if (firstBlockRS) { + nsIContent* frameContent = firstBlockRS->frame->GetContent(); if (frameContent) { + nsCOMPtr contentTag; frameContent->GetTag(getter_AddRefs(contentTag)); NS_ASSERTION(contentTag.get() == nsHTMLAtoms::body, "block is not BODY"); } } - if(firstAreaRS) { - firstAreaRS->frame->GetContent(getter_AddRefs(frameContent)); + if (firstAreaRS) { + nsIContent* frameContent = firstAreaRS->frame->GetContent(); if (frameContent) { + nsCOMPtr contentTag; frameContent->GetTag(getter_AddRefs(contentTag)); NS_ASSERTION(contentTag.get() == nsHTMLAtoms::html, "Area frame is not HTML element"); } @@ -2785,11 +2771,7 @@ nsHTMLReflowState::IsBidiFormControl(nsIPresContext* aPresContext) return PR_FALSE; } - nsCOMPtr content, parent; - nsresult rv = frame->GetContent(getter_AddRefs(content) ); - if (NS_FAILED(rv)) { - return PR_FALSE; - } + nsIContent* content = frame->GetContent(); if (!content) { return PR_FALSE; } @@ -2799,9 +2781,10 @@ nsHTMLReflowState::IsBidiFormControl(nsIPresContext* aPresContext) // Otherwise, just test this content node if (mReflowDepth == 0) { while (content) { - if (content->IsContentOfType(nsIContent::eHTML_FORM_CONTROL)) { + if (content->IsContentOfType(nsIContent::eHTML_FORM_CONTROL)) { return PR_TRUE; } + nsCOMPtr parent; content->GetParent(getter_AddRefs(parent)); content = parent; } diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 8c33ad5b38b..7517ed96c08 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -678,8 +678,7 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest, mParent->ReflowDirtyChild(presShell, NS_STATIC_CAST(nsIFrame*, this)); } } else { - nsSize s; - GetSize(s); + nsSize s = GetSize(); nsRect r(0, 0, s.width, s.height); if (!r.IsEmpty()) { Invalidate(mPresContext, r, PR_FALSE); @@ -864,8 +863,7 @@ nsImageFrame::GetContinuationOffset(nscoord* aWidth) const if (mPrevInFlow) { for (nsIFrame* prevInFlow = mPrevInFlow ; prevInFlow; prevInFlow->GetPrevInFlow(&prevInFlow)) { - nsRect rect; - prevInFlow->GetRect(rect); + nsRect rect = prevInFlow->GetRect(); if (aWidth) { *aWidth = rect.width; } @@ -1211,14 +1209,12 @@ nsImageFrame::DisplayAltFeedback(nsIPresContext* aPresContext, // If there's still room, display the alt-text if (!inner.IsEmpty()) { - nsCOMPtr content; - nsCOMPtr tag; - nsAutoString altText; - - GetContent(getter_AddRefs(content)); + nsIContent* content = GetContent(); if (content) { + nsCOMPtr tag; content->GetTag(getter_AddRefs(tag)); if (tag) { + nsAutoString altText; nsCSSFrameConstructor::GetAlternateTextFor(content, tag, altText); DisplayAltText(aPresContext, aRenderingContext, altText, inner); } @@ -1659,7 +1655,9 @@ nsImageFrame::GetContentForEvent(nsIPresContext* aPresContext, } } - return GetContent(aContent); + *aContent = GetContent(); + NS_IF_ADDREF(*aContent); + return NS_OK; } // XXX what should clicks on transparent pixels do? @@ -1819,7 +1817,7 @@ nsImageFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con fprintf(out, " [parent=%p]", mParent); #endif if (HasView()) { - fprintf(out, " [view=%p]", GetView(aPresContext)); + fprintf(out, " [view=%p]", GetView()); } fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); diff --git a/mozilla/layout/html/base/src/nsImageMap.cpp b/mozilla/layout/html/base/src/nsImageMap.cpp index 52e97e71e67..0b205b8d139 100644 --- a/mozilla/layout/html/base/src/nsImageMap.cpp +++ b/mozilla/layout/html/base/src/nsImageMap.cpp @@ -1189,22 +1189,20 @@ nsImageMap::HandleEvent(nsIDOMEvent* aEvent) nsresult nsImageMap::Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect) { - nsCOMPtr viewManager; PRUint32 flags = NS_VMREFRESH_IMMEDIATE; nsIView* view; nsRect damageRect(aRect); if (aFrame->HasView()) { - view = aFrame->GetView(aPresContext); + view = aFrame->GetView(); } else { nsPoint offset; aFrame->GetOffsetFromView(aPresContext, offset, &view); - NS_ASSERTION(nsnull != view, "no view"); + NS_ASSERTION(view, "no view"); damageRect += offset; } - view->GetViewManager(*getter_AddRefs(viewManager)); - viewManager->UpdateView(view, damageRect, flags); + view->GetViewManager()->UpdateView(view, damageRect, flags); return NS_OK;