From e9d6a45b46b4fdeb3830907aee61d625c643cdeb Mon Sep 17 00:00:00 2001 From: uid502 Date: Tue, 23 Sep 2003 17:05:29 +0000 Subject: [PATCH] Bug 190735. Final patch for deCOMtamination of core nsIFrame methods! rs=dbaron git-svn-id: svn://10.0.0.236/trunk@147169 18797224-902f-48f8-a5cc-f745e15eee43 --- .../src/atk/nsAccessibleHyperText.cpp | 11 +- .../accessible/src/atk/nsAccessibleText.cpp | 21 ++-- .../src/base/nsAccessibilityService.cpp | 3 +- mozilla/accessible/src/base/nsAccessible.cpp | 52 +++----- .../accessible/src/base/nsCaretAccessible.cpp | 6 +- .../accessible/src/base/nsDocAccessible.cpp | 24 ++-- .../src/html/nsHTMLSelectAccessible.cpp | 25 ++-- .../src/msaa/nsTextAccessibleWrap.cpp | 8 +- mozilla/docshell/base/nsDocShell.cpp | 60 +++------ mozilla/dom/src/base/nsGlobalWindow.cpp | 44 +++---- mozilla/editor/libeditor/base/nsEditor.cpp | 33 ++--- .../editor/libeditor/html/nsHTMLEditor.cpp | 21 +--- .../libeditor/text/nsEditorEventListeners.cpp | 6 +- .../browser/webBrowser/nsContextMenuInfo.cpp | 12 +- .../inspector/base/src/inFlasher.cpp | 18 +-- .../inspector/base/src/inLayoutUtils.cpp | 27 ++--- .../src/nsLayoutDebuggingTools.cpp | 4 +- .../typeaheadfind/src/nsTypeAheadFind.cpp | 19 ++- .../xmlterm/base/mozXMLTermUtils.cpp | 15 +-- mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp | 41 ++----- mozilla/gfx/src/mac/nsNativeThemeMac.cpp | 8 +- mozilla/gfx/src/nsDeviceContext.cpp | 4 +- mozilla/gfx/src/shared/nsNativeTheme.cpp | 40 ++---- mozilla/gfx/src/windows/nsNativeThemeWin.cpp | 83 ++++--------- mozilla/layout/base/nsPresShell.cpp | 2 +- mozilla/layout/base/public/nsIFrame.h | 61 ---------- mozilla/layout/generic/nsBulletFrame.cpp | 3 +- mozilla/layout/generic/nsFrameSetFrame.cpp | 4 +- mozilla/layout/generic/nsIFrame.h | 61 ---------- .../layout/html/base/src/nsBulletFrame.cpp | 3 +- mozilla/layout/html/base/src/nsPresShell.cpp | 2 +- .../html/document/src/nsFrameSetFrame.cpp | 4 +- .../html/table/src/nsTableRowGroupFrame.h | 2 +- mozilla/layout/tables/nsTableRowGroupFrame.h | 2 +- mozilla/layout/xul/base/src/nsBox.cpp | 2 - mozilla/view/public/nsIView.h | 15 --- mozilla/view/src/nsView.cpp | 114 ------------------ mozilla/view/src/nsView.h | 33 ----- mozilla/widget/src/mac/nsDragService.cpp | 7 +- mozilla/widget/src/photon/nsWindow.cpp | 3 +- .../widget/src/xpwidgets/nsBaseFilePicker.cpp | 22 +--- 41 files changed, 204 insertions(+), 721 deletions(-) diff --git a/mozilla/accessible/src/atk/nsAccessibleHyperText.cpp b/mozilla/accessible/src/atk/nsAccessibleHyperText.cpp index 07813af135e..88852ecaafc 100644 --- a/mozilla/accessible/src/atk/nsAccessibleHyperText.cpp +++ b/mozilla/accessible/src/atk/nsAccessibleHyperText.cpp @@ -101,13 +101,9 @@ PRBool nsAccessibleHyperText::GetAllTextChildren(nsIPresContext *aPresContext, n } else { if (frameType == nsAccessibilityAtoms::textFrame) { - nsRect frameRect; - aCurFrame->GetRect(frameRect); // Skip the empty text frames that usually only consist of "\n" - if (! frameRect.IsEmpty()) { - nsCOMPtr content; - aCurFrame->GetContent(getter_AddRefs(content)); - nsCOMPtr node(do_QueryInterface(content)); + if (! aCurFrame->GetRect().IsEmpty()) { + nsCOMPtr node(do_QueryInterface(aCurFrame->GetContent())); if (bSave || node == aNode) { #ifdef DEBUG nsAutoString text; @@ -133,8 +129,7 @@ PRBool nsAccessibleHyperText::GetAllTextChildren(nsIPresContext *aPresContext, n return PR_TRUE; } - nsIFrame* siblingFrame = nsnull; - aCurFrame->GetNextSibling(&siblingFrame); + nsIFrame* siblingFrame = aCurFrame->GetNextSibling(); return GetAllTextChildren(aPresContext, siblingFrame, aNode, bSave); } diff --git a/mozilla/accessible/src/atk/nsAccessibleText.cpp b/mozilla/accessible/src/atk/nsAccessibleText.cpp index c04805f0059..89ae98dc2ac 100644 --- a/mozilla/accessible/src/atk/nsAccessibleText.cpp +++ b/mozilla/accessible/src/atk/nsAccessibleText.cpp @@ -659,10 +659,7 @@ NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset, shell->GetPrimaryFrameFor(content, &frame); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - nsRect frameRect; - if (NS_FAILED(frame->GetRect(frameRect))) { - return NS_ERROR_FAILURE; - } + nsRect frameRect = frame->GetRect(); nsCOMPtr rc; shell->CreateRenderingContext(frame, getter_AddRefs(rc)); @@ -720,16 +717,14 @@ NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset, } //find the topest frame, add the offset recursively - nsRect tmpRect; - nsIFrame *parentFrame = nsnull, *tmpFrame = frame; - nsresult rv = tmpFrame->GetParent(&parentFrame); - while (NS_SUCCEEDED(rv) && parentFrame) { - if (NS_SUCCEEDED(parentFrame->GetRect(tmpRect))) { - tmpX += tmpRect.x; - tmpY += tmpRect.y; - } + nsIFrame* tmpFrame = frame; + nsIFrame* parentFrame = tmpFrame->GetParent(); + while (parentFrame) { + nsPoint origin = parentFrame->GetPosition(); + tmpX += origin.x; + tmpY += origin.y; tmpFrame = parentFrame; - rv = tmpFrame->GetParent(&parentFrame); + parentFrame = tmpFrame->GetParent(); } tmpX = NSTwipsToIntPixels(tmpX, t2p); diff --git a/mozilla/accessible/src/base/nsAccessibilityService.cpp b/mozilla/accessible/src/base/nsAccessibilityService.cpp index feecbde6cd8..bce6a4969f1 100644 --- a/mozilla/accessible/src/base/nsAccessibilityService.cpp +++ b/mozilla/accessible/src/base/nsAccessibilityService.cpp @@ -217,8 +217,7 @@ nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIW { NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!"); *aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame); - nsCOMPtr content; - (*aRealFrame)->GetContent(getter_AddRefs(content)); + nsCOMPtr content = (*aRealFrame)->GetContent(); nsCOMPtr node(do_QueryInterface(content)); if (!content || !node) return NS_ERROR_FAILURE; diff --git a/mozilla/accessible/src/base/nsAccessible.cpp b/mozilla/accessible/src/base/nsAccessible.cpp index 8b36cd7d266..c535aaccb88 100644 --- a/mozilla/accessible/src/base/nsAccessible.cpp +++ b/mozilla/accessible/src/base/nsAccessible.cpp @@ -444,8 +444,7 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen) if (!shell) return PR_FALSE; - nsCOMPtr viewManager; - shell->GetViewManager(getter_AddRefs(viewManager)); + nsIViewManager* viewManager = shell->GetViewManager(); if (!viewManager) return PR_FALSE; @@ -473,10 +472,9 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen) // We don't use the more accurate GetBoundsRect, because that is more expensive // and the STATE_OFFSCREEN flag that this is used for only needs to be a rough indicator - nsRect relFrameRect; + nsRect relFrameRect = frame->GetRect(); nsPoint frameOffset; - frame->GetRect(relFrameRect); - nsIView *containingView = frame->GetViewExternal(presContext); + nsIView *containingView = frame->GetViewExternal(); if (!containingView) { frame->GetOffsetFromView(presContext, frameOffset, &containingView); if (!containingView) @@ -665,23 +663,22 @@ void nsAccessible::GetScreenOrigin(nsIPresContext *aPresContext, nsIFrame *aFram if (aPresContext) { PRInt32 offsetX = 0; PRInt32 offsetY = 0; - nsCOMPtr widget; + nsIWidget* widget = nsnull; while (aFrame) { // Look for a widget so we can get screen coordinates - nsIView* view = aFrame->GetViewExternal(aPresContext); - nsPoint origin; + nsIView* view = aFrame->GetViewExternal(); if (view) { - view->GetWidget(*getter_AddRefs(widget)); + widget = view->GetWidget(); if (widget) break; } // No widget yet, so count up the coordinates of the frame - aFrame->GetOrigin(origin); + nsPoint origin = aFrame->GetPosition(); offsetX += origin.x; offsetY += origin.y; - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); } if (widget) { @@ -755,20 +752,19 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame if (!IsCorrectFrameType(ancestorFrame, nsAccessibilityAtoms::inlineFrame) && !IsCorrectFrameType(ancestorFrame, nsAccessibilityAtoms::textFrame)) break; - ancestorFrame->GetParent(&ancestorFrame); + ancestorFrame = ancestorFrame->GetParent(); } nsIFrame *iterFrame = firstFrame; nsCOMPtr firstContent(do_QueryInterface(mDOMNode)); - nsCOMPtr iterContent(firstContent); + nsIContent* iterContent = firstContent; PRInt32 depth = 0; // Look only at frames below this depth, or at this depth (if we're still on the content node we started with) while (iterContent == firstContent || depth > 0) { // Coordinates will come back relative to parent frame nsIFrame *parentFrame = iterFrame; - nsRect currFrameBounds; - iterFrame->GetRect(currFrameBounds); + nsRect currFrameBounds = iterFrame->GetRect(); // We just want the width and height - only get relative coordinates if we're not already // at the bounding frame @@ -776,13 +772,9 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame // Make this frame's bounds relative to common parent frame while (parentFrame && parentFrame != *aBoundingFrame) { - nsRect parentFrameBounds; - parentFrame->GetRect(parentFrameBounds); // Add this frame's bounds to our total rectangle - currFrameBounds.x += parentFrameBounds.x; - currFrameBounds.y += parentFrameBounds.y; - - parentFrame->GetParent(&parentFrame); + currFrameBounds += parentFrame->GetPosition(); + parentFrame = parentFrame->GetParent(); } // Add this frame's bounds to total @@ -805,10 +797,10 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame while (iterFrame) { iterFrame->GetNextInFlow(&iterNextFrame); if (!iterNextFrame) - iterFrame->GetNextSibling(&iterNextFrame); + iterNextFrame = iterFrame->GetNextSibling(); if (iterNextFrame || --depth < 0) break; - iterFrame->GetParent(&iterFrame); + iterFrame = iterFrame->GetParent(); } } @@ -818,7 +810,7 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame break; iterContent = nsnull; if (depth == 0) - iterFrame->GetContent(getter_AddRefs(iterContent)); + iterContent = iterFrame->GetContent(); } } @@ -1493,8 +1485,7 @@ nsresult nsAccessible::GetParentBlockNode(nsIPresShell *aPresShell, nsIDOMNode * nsIFrame *firstTextFrame = nsnull; FindTextFrame(index, presContext, childFrame, &firstTextFrame, frame); if (firstTextFrame) { - firstTextFrame->GetContent(getter_AddRefs(content)); - nsCOMPtr domNode(do_QueryInterface(content)); + nsCOMPtr domNode(do_QueryInterface(firstTextFrame->GetContent())); NS_IF_ADDREF(*aBlockNode = domNode); return NS_OK; } @@ -1513,8 +1504,7 @@ nsIFrame* nsAccessible::GetParentBlockFrame(nsIFrame *aFrame) nsCOMPtr frameType; frame->GetFrameType(getter_AddRefs(frameType)); while (frame && frameType != nsAccessibilityAtoms::blockFrame) { - nsIFrame* parentFrame = nsnull; - frame->GetParent(&parentFrame); + nsIFrame* parentFrame = frame->GetParent(); if (parentFrame) parentFrame->GetFrameType(getter_AddRefs(frameType)); frame = parentFrame; @@ -1553,8 +1543,7 @@ PRBool nsAccessible::FindTextFrame(PRInt32 &index, nsIPresContext *aPresContext, } else { if (frameType == nsAccessibilityAtoms::textFrame) { - nsRect frameRect; - aCurFrame->GetRect(frameRect); + nsRect frameRect = aCurFrame->GetRect(); // skip the empty frame if (! frameRect.IsEmpty()) { if (index == 0) @@ -1570,8 +1559,7 @@ PRBool nsAccessible::FindTextFrame(PRInt32 &index, nsIPresContext *aPresContext, return PR_TRUE; } - nsIFrame* siblingFrame = nsnull; - aCurFrame->GetNextSibling(&siblingFrame); + nsIFrame* siblingFrame = aCurFrame->GetNextSibling(); return FindTextFrame(index, aPresContext, siblingFrame, aFirstTextFrame, aTextFrame); } #endif //MOZ_ACCESSIBILITY_ATK diff --git a/mozilla/accessible/src/base/nsCaretAccessible.cpp b/mozilla/accessible/src/base/nsCaretAccessible.cpp index 7f7fa553b93..816c809ff26 100644 --- a/mozilla/accessible/src/base/nsCaretAccessible.cpp +++ b/mozilla/accessible/src/base/nsCaretAccessible.cpp @@ -162,16 +162,14 @@ NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, ns nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); - nsCOMPtr viewManager; - presShell->GetViewManager(getter_AddRefs(viewManager)); + nsIViewManager* viewManager = presShell->GetViewManager(); if (!presContext || !viewManager) return NS_OK; nsIView *view = nsnull; viewManager->GetRootView(view); if (!view) return NS_OK; - nsCOMPtr widget; - view->GetWidget(*getter_AddRefs(widget)); + nsIWidget* widget = view->GetWidget(); if (!widget) return NS_OK; diff --git a/mozilla/accessible/src/base/nsDocAccessible.cpp b/mozilla/accessible/src/base/nsDocAccessible.cpp index 8a4a07593b5..98cfddb2ac8 100644 --- a/mozilla/accessible/src/base/nsDocAccessible.cpp +++ b/mozilla/accessible/src/base/nsDocAccessible.cpp @@ -93,10 +93,9 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell) nsCOMPtr shell(do_QueryReferent(mWeakShell)); if (shell) { shell->GetDocument(getter_AddRefs(mDocument)); - nsCOMPtr vm; - shell->GetViewManager(getter_AddRefs(vm)); - nsCOMPtr widget; + nsIViewManager* vm = shell->GetViewManager(); if (vm) { + nsCOMPtr widget; vm->GetWidget(getter_AddRefs(widget)); if (widget) { mWnd = widget->GetNativeData(NS_NATIVE_WINDOW); @@ -417,8 +416,6 @@ void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame) *aRelativeFrame = GetFrame(); nsCOMPtr document(mDocument); - nsRect viewBounds; - nsCOMPtr vm; nsCOMPtr parentDoc; while (document) { @@ -427,24 +424,25 @@ void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame) if (!presShell) { return; } - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = presShell->GetViewManager(); nsIScrollableView* scrollableView = nsnull; if (vm) vm->GetRootScrollableView(&scrollableView); + nsRect viewBounds(0, 0, 0, 0); if (scrollableView) { const nsIView *view = nsnull; scrollableView->GetClipView(&view); if (view) { - view->GetBounds(viewBounds); + viewBounds = view->GetBounds(); } } else { nsIView *view; vm->GetRootView(view); if (view) { - view->GetBounds(viewBounds); + viewBounds = view->GetBounds(); } } @@ -666,10 +664,9 @@ void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure) void nsDocAccessible::AddScrollListener(nsIPresShell *aPresShell) { - nsCOMPtr vm; - + nsIViewManager* vm = nsnull; if (aPresShell) - aPresShell->GetViewManager(getter_AddRefs(vm)); + vm = aPresShell->GetViewManager(); nsIScrollableView* scrollableView = nsnull; if (vm) @@ -681,10 +678,9 @@ void nsDocAccessible::AddScrollListener(nsIPresShell *aPresShell) void nsDocAccessible::RemoveScrollListener(nsIPresShell *aPresShell) { - nsCOMPtr vm; - + nsIViewManager* vm = nsnull; if (aPresShell) - aPresShell->GetViewManager(getter_AddRefs(vm)); + vm = aPresShell->GetViewManager(); nsIScrollableView* scrollableView = nsnull; if (vm) diff --git a/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp b/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp index 9caf785342b..b959b940fa7 100644 --- a/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp @@ -991,8 +991,7 @@ NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetValue(nsAString& _retval) frame->FirstChild(context, nsnull, &frame); frame->FirstChild(context, nsnull, &frame); - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); + nsIContent* content = frame->GetContent(); if (!content) return NS_ERROR_FAILURE; @@ -1024,7 +1023,7 @@ void nsHTMLComboboxTextFieldAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame* frame->FirstChild(context, nsnull, aBoundingFrame); frame->FirstChild(context, nsnull, &frame); - frame->GetRect(aBounds); + aBounds = frame->GetRect(); } /** Return our cached parent */ @@ -1104,14 +1103,12 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::DoAction(PRUint8 aIndex) return NS_ERROR_FAILURE; frame->FirstChild(context, nsnull, &frame); - frame->GetNextSibling(&frame); - - nsCOMPtr content; - frame->GetContent(getter_AddRefs(content)); + frame = frame->GetNextSibling(); // We only have one action, click. Any other index is meaningless(wrong) if (aIndex == eAction_Click) { - nsCOMPtr element(do_QueryInterface(content)); + nsCOMPtr + element(do_QueryInterface(frame->GetContent())); if (element) { element->Click(); @@ -1167,10 +1164,7 @@ void nsHTMLComboboxButtonAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** a return; frame->FirstChild(context, nsnull, &frame); // first frame is for the textfield - - frame->GetNextSibling(&frame); // sibling frame is for the button - - frame->GetRect(aBounds); + aBounds = frame->GetNextSibling()->GetRect(); // sibling frame is for the button } /** We are a button. */ @@ -1335,9 +1329,6 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo return; } - frame->GetParent(aBoundingFrame); - frame->GetParent(&frame); - - frame->GetRect(aBounds); + *aBoundingFrame = frame->GetParent(); + aBounds = (*aBoundingFrame)->GetRect(); } - diff --git a/mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp b/mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp index 90f38f1ee94..d9bf6577ce5 100755 --- a/mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp +++ b/mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp @@ -239,8 +239,7 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32 presShell->GetPrimaryFrameFor(content, &frame); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - nsCOMPtr viewManager; - presShell->GetViewManager(getter_AddRefs(viewManager)); + nsIViewManager* viewManager = presShell->GetViewManager(); NS_ASSERTION(viewManager, "No view manager for pres shell"); nsCOMPtr widget; @@ -258,9 +257,8 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32 return E_FAIL; } - nsRect startRect, endRect; - startFrame->GetRect(startRect); - endFrame->GetRect(endRect); + nsRect startRect = startFrame->GetRect(); + nsRect endRect = endFrame->GetRect(); *aX = NSTwipsToIntPixels(startPoint.x + startRect.x, t2p); *aY = NSTwipsToIntPixels(startPoint.y, t2p); diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 79841c1ad3b..fd8224cb9df 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -1564,9 +1564,7 @@ nsDocShell::SetZoom(float zoom) NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); // get the view manager - nsCOMPtr vm; - NS_ENSURE_SUCCESS(presShell->GetViewManager(getter_AddRefs(vm)), - NS_ERROR_FAILURE); + nsIViewManager* vm = presShell->GetViewManager(); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); // get the root scrollable view @@ -1891,8 +1889,7 @@ PrintDocTree(nsIDocShellTreeNode * aParentNode, int aLevel) nsCOMPtr domwin(do_QueryInterface(sgo)); nsCOMPtr widget; - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = presShell->GetViewManager(); if (vm) { vm->GetWidget(getter_AddRefs(widget)); } @@ -3150,12 +3147,7 @@ nsDocShell::Repaint(PRBool aForce) docViewer->GetPresContext(getter_AddRefs(context)); NS_ENSURE_TRUE(context, NS_ERROR_FAILURE); - nsCOMPtr shell; - context->GetShell(getter_AddRefs(shell)); - NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); - - nsCOMPtr viewManager; - shell->GetViewManager(getter_AddRefs(viewManager)); + nsIViewManager* viewManager = context->GetViewManager(); NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE); // what about aForce ? @@ -3226,9 +3218,7 @@ nsDocShell::GetVisibility(PRBool * aVisibility) NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); // get the view manager - nsCOMPtr vm; - NS_ENSURE_SUCCESS(presShell->GetViewManager(getter_AddRefs(vm)), - NS_ERROR_FAILURE); + nsIViewManager* vm = presShell->GetViewManager(); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); // get the root view @@ -3237,9 +3227,7 @@ nsDocShell::GetVisibility(PRBool * aVisibility) NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); // if our root view is hidden, we are not visible - nsViewVisibility vis; - NS_ENSURE_SUCCESS(view->GetVisibility(vis), NS_ERROR_FAILURE); - if (vis == nsViewVisibility_kHide) { + if (view->GetVisibility() == nsViewVisibility_kHide) { *aVisibility = PR_FALSE; return NS_OK; } @@ -3271,14 +3259,9 @@ nsDocShell::GetVisibility(PRBool * aVisibility) nsIFrame* frame; pPresShell->GetPrimaryFrameFor(shellContent, &frame); - if (frame) { - nsCOMPtr pc; - pPresShell->GetPresContext(getter_AddRefs(pc)); - - if (!frame->AreAncestorViewsVisible(pc)) { - *aVisibility = PR_FALSE; - return NS_OK; - } + if (frame && !frame->AreAncestorViewsVisible()) { + *aVisibility = PR_FALSE; + return NS_OK; } treeItem = parentItem; @@ -4785,8 +4768,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) docviewer->GetPresShell(getter_AddRefs(shell)); if (shell) { - nsCOMPtr vm; - shell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = shell->GetViewManager(); if (vm) { vm->GetDefaultBackgroundColor(&bgcolor); @@ -4863,8 +4845,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) docviewer->GetPresShell(getter_AddRefs(shell)); if (shell) { - nsCOMPtr vm; - shell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = shell->GetViewManager(); if (vm) { vm->SetDefaultBackgroundColor(bgcolor); @@ -6710,11 +6691,7 @@ nsDocShell::GetRootScrollableView(nsIScrollableView ** aOutScrollView) NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(shell)), NS_ERROR_FAILURE); NS_ENSURE_TRUE(shell, NS_ERROR_NULL_POINTER); - nsCOMPtr viewManager; - NS_ENSURE_SUCCESS(shell->GetViewManager(getter_AddRefs(viewManager)), - NS_ERROR_FAILURE); - - NS_ENSURE_SUCCESS(viewManager->GetRootScrollableView(aOutScrollView), + NS_ENSURE_SUCCESS(shell->GetViewManager()->GetRootScrollableView(aOutScrollView), NS_ERROR_FAILURE); if (*aOutScrollView == nsnull) { @@ -6906,21 +6883,16 @@ nsDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus) nsIFrame* frame; presShell->GetPrimaryFrameFor(rootContent, &frame); - if (frame != nsnull) { - frame->GetParent(&frame); - if (frame != nsnull) { + if (frame) { + frame = frame->GetParent(); + if (frame) { nsICanvasFrame* canvasFrame; if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsICanvasFrame), (void**)&canvasFrame))) { canvasFrame->SetHasFocus(aCanvasHasFocus); - nsCOMPtr presContext; - GetPresContext(getter_AddRefs(presContext)); - - nsIView* canvasView = frame->GetViewExternal(presContext); + nsIView* canvasView = frame->GetViewExternal(); - nsCOMPtr viewManager; - canvasView->GetViewManager(*getter_AddRefs(viewManager)); - viewManager->UpdateView(canvasView, NS_VMREFRESH_NO_SYNC); + canvasView->GetViewManager()->UpdateView(canvasView, NS_VMREFRESH_NO_SYNC); return NS_OK; } diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 2b501bd9054..88553505d8a 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -1945,8 +1945,7 @@ GlobalWindowImpl::GetScrollMaxXY(PRInt32* aScrollMaxX, PRInt32* aScrollMaxY) rv = CallQueryInterface(view, &portView); NS_ENSURE_SUCCESS(rv, rv); - nsRect portRect; - portView->GetBounds(portRect); + nsRect portRect = portView->GetBounds(); if (aScrollMaxX) *aScrollMaxX = PR_MAX(0, @@ -2476,8 +2475,7 @@ GlobalWindowImpl::Focus() nsresult result = NS_OK; if (presShell) { - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = presShell->GetViewManager(); if (vm) { nsCOMPtr widget; vm->GetWidget(getter_AddRefs(widget)); @@ -4276,16 +4274,14 @@ GlobalWindowImpl::Activate() mDocShell->GetPresShell(getter_AddRefs(presShell)); NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = presShell->GetViewManager(); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); nsIView* rootView; vm->GetRootView(rootView); NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE); - nsCOMPtr widget; - rootView->GetWidget(*getter_AddRefs(widget)); + nsIWidget* widget = rootView->GetWidget(); NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); return widget->SetFocus(); @@ -4310,16 +4306,16 @@ GlobalWindowImpl::Activate() return NS_ERROR_FAILURE; } - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = presShell->GetViewManager(); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); nsIView *rootView; vm->GetRootView(rootView); NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE); - nsCOMPtr widget; - rootView->GetWidget(*getter_AddRefs(widget)); + // We're holding a STRONG REF to the widget to ensure it doesn't go away + // during event processing + nsCOMPtr widget = rootView->GetWidget(); NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); nsEventStatus status; @@ -4345,16 +4341,15 @@ GlobalWindowImpl::Deactivate() mDocShell->GetPresShell(getter_AddRefs(presShell)); NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = presShell->GetViewManager(); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); nsIView *rootView; vm->GetRootView(rootView); NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE); - nsCOMPtr widget; - rootView->GetWidget(*getter_AddRefs(widget)); + // Hold a STRONG REF to keep the widget around during event processing + nsCOMPtr widget = rootView->GetWidget(); NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); nsEventStatus status; @@ -5444,14 +5439,9 @@ GlobalWindowImpl::GetScrollInfo(nsIScrollableView **aScrollableView, presContext->GetPixelsToTwips(aP2T); presContext->GetTwipsToPixels(aT2P); - nsCOMPtr presShell; - presContext->GetShell(getter_AddRefs(presShell)); - if (presShell) { - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); - if (vm) - return vm->GetRootScrollableView(aScrollableView); - } + nsIViewManager* vm = presContext->GetViewManager(); + if (vm) + return vm->GetRootScrollableView(aScrollableView); } return NS_OK; } @@ -5722,16 +5712,14 @@ nsGlobalChromeWindow::SetCursor(const nsAString& aCursor) mDocShell->GetPresShell(getter_AddRefs(presShell)); NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - nsCOMPtr vm; - presShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = presShell->GetViewManager(); NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); nsIView *rootView; vm->GetRootView(rootView); NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE); - nsCOMPtr widget; - rootView->GetWidget(*getter_AddRefs(widget)); + nsIWidget* widget = rootView->GetWidget(); NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); // Call esm and set cursor. diff --git a/mozilla/editor/libeditor/base/nsEditor.cpp b/mozilla/editor/libeditor/base/nsEditor.cpp index 1259e415e91..31ca475f3d9 100644 --- a/mozilla/editor/libeditor/base/nsEditor.cpp +++ b/mozilla/editor/libeditor/base/nsEditor.cpp @@ -275,8 +275,9 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot // is no way to do that right now. So we leave it null here and set // up a nav html dtd in nsHTMLEditor::Init - ps->GetViewManager(&mViewManager); + mViewManager = ps->GetViewManager(); if (!mViewManager) {return NS_ERROR_NULL_POINTER;} + NS_ADDREF(mViewManager); mUpdateCount=0; InsertTextTxn::ClassInit(); @@ -1979,29 +1980,17 @@ GetEditorContentWindow(nsIPresShell *aPresShell, nsIDOMElement *aRoot, nsIWidget if (!frame) return NS_ERROR_FAILURE; - nsCOMPtr presContext; - - result = aPresShell->GetPresContext(getter_AddRefs(presContext)); - - if (NS_FAILED(result)) - return result; - - if (!presContext) - return NS_ERROR_FAILURE; - // Check first to see if this frame contains a view with a native widget. - - nsIView *view = frame->GetViewExternal(presContext); + nsIView *view = frame->GetViewExternal(); if (view) { - result = view->GetWidget(*aResult); + *aResult = view->GetWidget(); - if (NS_FAILED(result)) - return result; - - if (*aResult) + if (*aResult) { + NS_ADDREF(*aResult); return NS_OK; + } } // frame doesn't have a view with a widget, so call GetWindow() @@ -3663,9 +3652,7 @@ nsEditor::IsEditable(nsIDOMNode *aNode) nsCOMPtr text(do_QueryInterface(content)); if (!text) return PR_TRUE; // not a text node; has a frame - nsFrameState fs; - resultFrame->GetFrameState(&fs); - if ((fs & NS_FRAME_IS_DIRTY)) // we can only trust width data for undirty frames + if (resultFrame->GetStateBits() & NS_FRAME_IS_DIRTY) // we can only trust width data for undirty frames { // In the past a comment said: // "assume all text nodes with dirty frames are editable" @@ -3674,9 +3661,7 @@ nsEditor::IsEditable(nsIDOMNode *aNode) // and uses enhanced logic to find out in the HTML world. return IsTextInDirtyFrameVisible(aNode); } - nsRect rect; - resultFrame->GetRect(rect); - if (rect.width > 0) + if (resultFrame->GetSize().width > 0) return PR_TRUE; // text node has width } return PR_FALSE; // didn't pass any editability test diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 1c44eca7b5e..9a3af5e0b3c 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -6011,30 +6011,21 @@ nsHTMLEditor::GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 & if (nsHTMLEditUtils::IsHR(aElement)) { - nsIFrame* childFrame; - //frame->FirstChild(pcontext, nsnull, &childFrame); - frame->GetNextSibling(&childFrame); - frame = childFrame; + frame = frame->GetNextSibling(); } PRInt32 offsetX = 0, offsetY = 0; - nsCOMPtr widget; - nsresult rv; while (frame) { // Look for a widget so we can get screen coordinates - nsIView* view = frame->GetViewExternal(pcontext); - if (view) { - rv = view->GetWidget(*getter_AddRefs(widget)); - if (widget) - break; - } + nsIView* view = frame->GetViewExternal(); + if (view && view->HasWidget()) + break; // No widget yet, so count up the coordinates of the frame - nsPoint origin; - frame->GetOrigin(origin); + nsPoint origin = frame->GetPosition(); offsetX += origin.x; offsetY += origin.y; - frame->GetParent(&frame); + frame = frame->GetParent(); } aX = NSTwipsToIntPixels(offsetX , t2p); diff --git a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp index 6da05e2e7ae..b10035f6c4a 100644 --- a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp @@ -1051,8 +1051,7 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent) selCon->SetDisplaySelection(nsISelectionController::SELECTION_ON); #ifdef USE_HACK_REPAINT // begin hack repaint - nsCOMPtr viewmgr; - ps->GetViewManager(getter_AddRefs(viewmgr)); + nsIViewManager* viewmgr = ps->GetViewManager(); if (viewmgr) { nsIView* view; viewmgr->GetRootView(view); // views are not refCounted @@ -1114,8 +1113,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent) #ifdef USE_HACK_REPAINT // begin hack repaint - nsCOMPtr viewmgr; - ps->GetViewManager(getter_AddRefs(viewmgr)); + nsIViewManager* viewmgr = ps->GetViewManager(); if (viewmgr) { nsIView* view; diff --git a/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp b/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp index cd70074e59f..3fbc8753ae2 100644 --- a/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp +++ b/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp @@ -269,7 +269,7 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest // look for a background image on the element do { bg = frame->GetStyleBackground(); - frame->GetParent(&frame); + frame = frame->GetParent(); } while (bg && bg->mBackgroundImage.IsEmpty() && frame); if (bg && !bg->mBackgroundImage.IsEmpty()) @@ -297,7 +297,7 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest presShell->GetPrimaryFrameFor(rootContent, &frame); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - frame->GetParent(&frame); + frame = frame->GetParent(); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); nsICanvasFrame* canvasFrame; @@ -347,8 +347,7 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon if (aFrame && aBGFrame) { *aBGFrame = aFrame; // default to the frame passed in - nsCOMPtr pContent; - aFrame->GetContent(getter_AddRefs(pContent)); + nsIContent* pContent = aFrame->GetContent(); if (pContent) { // make sure that this is the HTML or BODY element nsCOMPtr tag; @@ -359,8 +358,7 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon tag.get() == mTag_html || tag.get() == mTag_body) { // the frame is the body frame, so we provide the canvas frame - nsIFrame *pCanvasFrame = nsnull; - aFrame->GetParent(&pCanvasFrame); + nsIFrame *pCanvasFrame = aFrame->GetParent(); while (pCanvasFrame) { nsCOMPtr parentType; pCanvasFrame->GetFrameType(getter_AddRefs(parentType)); @@ -369,7 +367,7 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon *aBGFrame = pCanvasFrame; break; } - pCanvasFrame->GetParent(&pCanvasFrame); + pCanvasFrame = pCanvasFrame->GetParent(); } }// if tag == html or body } diff --git a/mozilla/extensions/inspector/base/src/inFlasher.cpp b/mozilla/extensions/inspector/base/src/inFlasher.cpp index ba6f2d9933d..5d9532e80cf 100644 --- a/mozilla/extensions/inspector/base/src/inFlasher.cpp +++ b/mozilla/extensions/inspector/base/src/inFlasher.cpp @@ -145,20 +145,13 @@ inFlasher::RepaintElement(nsIDOMElement* aElement) nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell); if (!frame) return NS_OK; - nsCOMPtr pcontext; - presShell->GetPresContext(getter_AddRefs(pcontext)); - - nsIFrame* parentWithView = nsnull; - frame->GetParentWithView(pcontext, &parentWithView); + nsIFrame* parentWithView = frame->GetAncestorWithView(); if (parentWithView) { - nsIView* view = parentWithView->GetViewExternal(pcontext); + nsIView* view = parentWithView->GetViewExternal(); if (view) { - nsCOMPtr viewManager; - view->GetViewManager(*getter_AddRefs(viewManager)); + nsIViewManager* viewManager = view->GetViewManager(); if (viewManager) { - nsRect rect; - parentWithView->GetRect(rect); - + nsRect rect = parentWithView->GetRect(); viewManager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC); } } @@ -182,8 +175,7 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement) presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext)); // get view bounds in case this frame is being scrolled - nsRect rect; - frame->GetRect(rect); + nsRect rect = frame->GetRect(); nsPoint origin = inLayoutUtils::GetClientOrigin(presContext, frame); rect.x = origin.x; rect.y = origin.y; diff --git a/mozilla/extensions/inspector/base/src/inLayoutUtils.cpp b/mozilla/extensions/inspector/base/src/inLayoutUtils.cpp index a041c88bf78..2f526a893ad 100644 --- a/mozilla/extensions/inspector/base/src/inLayoutUtils.cpp +++ b/mozilla/extensions/inspector/base/src/inLayoutUtils.cpp @@ -106,10 +106,8 @@ inLayoutUtils::GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell) already_AddRefed inLayoutUtils::GetRenderingContextFor(nsIPresShell* aShell) { - nsCOMPtr viewman; - aShell->GetViewManager(getter_AddRefs(viewman)); nsCOMPtr widget; - viewman->GetWidget(getter_AddRefs(widget)); + aShell->GetViewManager()->GetWidget(getter_AddRefs(widget)); return widget->GetRenderingContext(); // AddRefs } @@ -150,20 +148,16 @@ inLayoutUtils::GetClientOrigin(nsIPresContext* aPresContext, aFrame->GetOffsetFromView(aPresContext, result, &view); nsIView* rootView = nsnull; if (view) { - nsCOMPtr viewManager; - view->GetViewManager(*getter_AddRefs(viewManager)); + nsIViewManager* viewManager = view->GetViewManager(); NS_ASSERTION(viewManager, "View must have a viewmanager"); viewManager->GetRootView(rootView); } while (view) { - nscoord x, y; - view->GetPosition(&x, &y); - result.x += x; - result.y += y; + result += view->GetPosition(); if (view == rootView) { break; } - view->GetParent(view); + view = view->GetParent(); } return result; } @@ -190,28 +184,27 @@ inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement) if (presContext) { nsIFrame* frame = nsnull; - nsresult rv = presShell->GetPrimaryFrameFor(content, &frame); + presShell->GetPrimaryFrameFor(content, &frame); PRInt32 offsetX = 0; PRInt32 offsetY = 0; - nsCOMPtr widget; + nsIWidget* widget = nsnull; while (frame) { // Look for a widget so we can get screen coordinates - nsIView* view = frame->GetViewExternal(presContext); + nsIView* view = frame->GetViewExternal(); if (view) { - rv = view->GetWidget(*getter_AddRefs(widget)); + widget = view->GetWidget(); if (widget) break; } // No widget yet, so count up the coordinates of the frame - nsPoint origin; - frame->GetOrigin(origin); + nsPoint origin = frame->GetPosition(); offsetX += origin.x; offsetY += origin.y; - frame->GetParent(&frame); + frame = frame->GetParent(); } if (widget) { diff --git a/mozilla/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp b/mozilla/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp index 3acc37e1368..734a191b57b 100644 --- a/mozilla/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp +++ b/mozilla/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp @@ -109,9 +109,7 @@ view_manager(nsIDocShell *aDocShell) nsCOMPtr shell(pres_shell(aDocShell)); if (!shell) return nsnull; - nsIViewManager *result = nsnull; - shell->GetViewManager(&result); - return result; + return shell->GetViewManager(); } static already_AddRefed diff --git a/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp b/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp index 042e994a984..d7d15d7c3be 100644 --- a/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp +++ b/mozilla/extensions/typeaheadfind/src/nsTypeAheadFind.cpp @@ -2228,10 +2228,10 @@ void nsTypeAheadFind::RemoveDocListeners() { nsCOMPtr presShell(do_QueryReferent(mFocusedWeakShell)); - nsCOMPtr vm; + nsIViewManager* vm = nsnull; if (presShell) { - presShell->GetViewManager(getter_AddRefs(vm)); + vm = presShell->GetViewManager(); } nsIScrollableView* scrollableView = nsnull; @@ -2265,8 +2265,7 @@ nsTypeAheadFind::AttachDocListeners(nsIPresShell *aPresShell) return; } - nsCOMPtr vm; - aPresShell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = aPresShell->GetViewManager(); if (!vm) { return; } @@ -2634,8 +2633,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell, // Set up the variables we need, return true if we can't get at them all const PRUint16 kMinPixels = 12; - nsCOMPtr viewManager; - aPresShell->GetViewManager(getter_AddRefs(viewManager)); + nsIViewManager* viewManager = aPresShell->GetViewManager(); if (!viewManager) { return PR_TRUE; } @@ -2644,7 +2642,6 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell, // We don't use the more accurate AccGetBounds, because that is // more expensive and the STATE_OFFSCREEN flag that this is used // for only needs to be a rough indicator - nsRect relFrameRect; nsIView *containingView = nsnull; nsPoint frameOffset; float p2t; @@ -2652,7 +2649,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell, nsRectVisibility rectVisibility = nsRectVisibility_kAboveViewport; if (!aGetTopVisibleLeaf) { - frame->GetRect(relFrameRect); + nsRect relFrameRect = frame->GetRect(); frame->GetOffsetFromView(aPresContext, frameOffset, &containingView); if (!containingView) { // no view -- not visible @@ -2697,7 +2694,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell, return PR_FALSE; } - frame->GetRect(relFrameRect); + nsRect relFrameRect = frame->GetRect(); frame->GetOffsetFromView(aPresContext, frameOffset, &containingView); if (containingView) { relFrameRect.x = frameOffset.x; @@ -2710,10 +2707,8 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell, } if (frame) { - nsCOMPtr firstVisibleContent; - frame->GetContent(getter_AddRefs(firstVisibleContent)); nsCOMPtr firstVisibleNode = - do_QueryInterface(firstVisibleContent); + do_QueryInterface(frame->GetContent()); if (firstVisibleNode) { (*aFirstVisibleRange)->SelectNode(firstVisibleNode); diff --git a/mozilla/extensions/xmlterm/base/mozXMLTermUtils.cpp b/mozilla/extensions/xmlterm/base/mozXMLTermUtils.cpp index 8988c7a8cce..89f1992be67 100644 --- a/mozilla/extensions/xmlterm/base/mozXMLTermUtils.cpp +++ b/mozilla/extensions/xmlterm/base/mozXMLTermUtils.cpp @@ -156,9 +156,8 @@ mozXMLTermUtils::GetPresContextScrollableView(nsIPresContext* aPresContext, if (NS_FAILED(result) || !presShell) return NS_ERROR_FAILURE; - nsCOMPtr viewManager; - result = presShell->GetViewManager(getter_AddRefs(viewManager)); - if (NS_FAILED(result) || !viewManager) + nsIViewManager* viewManager = presShell->GetViewManager(); + if (!viewManager) return NS_ERROR_FAILURE; return viewManager->GetRootScrollableView(aScrollableView); @@ -183,14 +182,8 @@ mozXMLTermUtils::GetPresContextDeviceContext(nsIPresContext* aPresContext, *aDeviceContext = nsnull; - nsCOMPtr presShell; - result = aPresContext->GetShell(getter_AddRefs(presShell)); - if (NS_FAILED(result) || !presShell) - return NS_ERROR_FAILURE; - - nsCOMPtr viewManager; - result = presShell->GetViewManager(getter_AddRefs(viewManager)); - if (NS_FAILED(result) || !viewManager) + nsIViewManager* viewManager = aPresContext->GetViewManager(); + if (!viewManager) return NS_ERROR_FAILURE; nsCOMPtr deviceContext; diff --git a/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp b/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp index d652fe4b63e..b1f3e6dc4bf 100644 --- a/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp +++ b/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp @@ -100,9 +100,7 @@ static void GetPrimaryPresShell(nsIFrame* aFrame, nsIPresShell** aResult) if (!aFrame) return; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - nsIDocument* doc = content->GetDocument(); + nsIDocument* doc = aFrame->GetContent()->GetDocument(); if (doc) doc->GetShellAt(0, aResult); // Addref happens here. } @@ -115,8 +113,7 @@ static void RefreshWidgetWindow(nsIFrame* aFrame) if (!shell) return; - nsCOMPtr vm; - shell->GetViewManager(getter_AddRefs(vm)); + nsIViewManager* vm = shell->GetViewManager(); if (!vm) return; @@ -136,11 +133,9 @@ static PRInt32 GetContentState(nsIFrame* aFrame) nsCOMPtr context; shell->GetPresContext(getter_AddRefs(context)); nsCOMPtr esm; - context->GetEventStateManager(getter_AddRefs(esm)); + shell->GetPresContext()->GetEventStateManager(getter_AddRefs(esm)); PRInt32 flags = 0; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - esm->GetContentState(content, flags); + esm->GetContentState(aFrame->GetContent(), flags); return flags; } @@ -148,10 +143,8 @@ static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom) { if (!aFrame) return PR_FALSE; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); nsAutoString attr; - nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attr); + nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr); if (res == NS_CONTENT_ATTR_NO_VALUE || (res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty())) return PR_TRUE; // This handles the HTML case (an attr with no value is like a true val) @@ -163,8 +156,7 @@ static PRInt32 CheckIntegerAttr(nsIFrame *aFrame, nsIAtom *aAtom) if (!aFrame) return 0; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); if (!content) return 0; @@ -205,7 +197,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, } else { // for dropdown textfields, look at the parent frame (the textbox) if (aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD) - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); PRInt32 eventState = GetContentState(aFrame); @@ -222,9 +214,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL) { // for scrollbars we need to go up two to go from the thumb to // the slider to the actual scrollbar object - nsIFrame *tmpFrame = aFrame; - tmpFrame->GetParent(&tmpFrame); - tmpFrame->GetParent(&tmpFrame); + nsIFrame *tmpFrame = aFrame->GetParent()->GetParent(); aState->curpos = CheckIntegerAttr(tmpFrame, mCurPosAtom); aState->maxpos = CheckIntegerAttr(tmpFrame, mMaxPosAtom); @@ -252,10 +242,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, if (aFrame) { // For XUL checkboxes and radio buttons, the state of the parent // determines our state. - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); if (content->IsContentOfType(nsIContent::eXUL)) - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); else { nsCOMPtr tag; content->GetTag(getter_AddRefs(tag)); @@ -340,10 +329,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, else if (aWidgetType == NS_THEME_TAB_LEFT_EDGE) *aWidgetFlags |= MOZ_GTK_TAB_BEFORE_SELECTED; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - if (content->HasAttr(kNameSpaceID_None, mFirstTabAtom)) - *aWidgetFlags |= MOZ_GTK_TAB_FIRST; + if (aFrame->GetContent()->HasAttr(kNameSpaceID_None, mFirstTabAtom)) + *aWidgetFlags |= MOZ_GTK_TAB_FIRST; } aGtkWidgetType = MOZ_GTK_TAB; @@ -581,9 +568,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext, // Check for specific widgets to see if HTML has overridden the style. if (aFrame) { // For now don't support HTML. - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - if (content->IsContentOfType(nsIContent::eHTML)) + if (aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) return PR_FALSE; } diff --git a/mozilla/gfx/src/mac/nsNativeThemeMac.cpp b/mozilla/gfx/src/mac/nsNativeThemeMac.cpp index 7c7b7d138b4..0b47aea0a14 100644 --- a/mozilla/gfx/src/mac/nsNativeThemeMac.cpp +++ b/mozilla/gfx/src/mac/nsNativeThemeMac.cpp @@ -752,12 +752,8 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext, nsIFrame* aF { #ifndef MOZ_WIDGET_COCOA // Only support HTML widgets for Cocoa - if (aFrame) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - if (content->IsContentOfType(nsIContent::eHTML)) - return PR_FALSE; - } + if (aFrame && aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) + return PR_FALSE; #endif if (aPresContext) { diff --git a/mozilla/gfx/src/nsDeviceContext.cpp b/mozilla/gfx/src/nsDeviceContext.cpp index 9e74bee6869..b3db1993c58 100644 --- a/mozilla/gfx/src/nsDeviceContext.cpp +++ b/mozilla/gfx/src/nsDeviceContext.cpp @@ -171,14 +171,12 @@ NS_IMETHODIMP DeviceContextImpl::CreateRenderingContext(nsIView *aView, nsIRende #endif nsresult rv; - nsCOMPtr win; - aView->GetWidget(*getter_AddRefs(win)); aContext = nsnull; nsCOMPtr pContext; rv = CreateRenderingContextInstance(*getter_AddRefs(pContext)); if (NS_SUCCEEDED(rv)) { - rv = InitRenderingContext(pContext, win.get()); + rv = InitRenderingContext(pContext, aView->GetWidget()); if (NS_SUCCEEDED(rv)) { aContext = pContext; NS_ADDREF(aContext); diff --git a/mozilla/gfx/src/shared/nsNativeTheme.cpp b/mozilla/gfx/src/shared/nsNativeTheme.cpp index 746ff3ff80d..24836a34859 100644 --- a/mozilla/gfx/src/shared/nsNativeTheme.cpp +++ b/mozilla/gfx/src/shared/nsNativeTheme.cpp @@ -76,10 +76,7 @@ nsNativeTheme::GetPrimaryPresShell(nsIFrame* aFrame, nsIPresShell** aResult) if (!aFrame) return; - nsCOMPtr doc; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - doc = content->GetDocument(); + nsIDocument* doc = aFrame->GetContent()->GetDocument(); if (doc) doc->GetShellAt(0, aResult); // addrefs } @@ -91,13 +88,9 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType) return 0; PRBool isXULCheckboxRadio = PR_FALSE; - if (aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) { - nsCOMPtr checkboxRadioContent; - aFrame->GetContent(getter_AddRefs(checkboxRadioContent)); - isXULCheckboxRadio = checkboxRadioContent->IsContentOfType(nsIContent::eXUL); - if (isXULCheckboxRadio) - aFrame->GetParent(&aFrame); - } + if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) + && aFrame->GetContent()->IsContentOfType(nsIContent::eXUL)) + aFrame = aFrame->GetParent(); nsCOMPtr shell; GetPrimaryPresShell(aFrame, getter_AddRefs(shell)); @@ -109,9 +102,7 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType) nsCOMPtr esm; context->GetEventStateManager(getter_AddRefs(esm)); PRInt32 flags = 0; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - esm->GetContentState(content, flags); + esm->GetContentState(aFrame->GetContent(), flags); if (isXULCheckboxRadio && aWidgetType == NS_THEME_RADIO) { if (IsFocused(aFrame)) @@ -127,8 +118,7 @@ nsNativeTheme::CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom) if (!aFrame) return PR_FALSE; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); nsAutoString attr; nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attr); @@ -154,10 +144,8 @@ nsNativeTheme::CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom) if (!aFrame) return 0; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); nsAutoString attr; - content->GetAttr(kNameSpaceID_None, aAtom, attr); + aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr); PRInt32 err, value = attr.ToInteger(&err); if (NS_FAILED(err)) return 0; @@ -171,9 +159,7 @@ nsNativeTheme::GetAttr(nsIFrame* aFrame, nsIAtom* aAtom, nsAString& attrValue) if (!aFrame) return PR_FALSE; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attrValue); + nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attrValue); return ((res != NS_CONTENT_ATTR_NOT_THERE) && !(res != NS_CONTENT_ATTR_NO_VALUE && attrValue.IsEmpty())); } @@ -184,13 +170,12 @@ nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, PRBool aCheckSelected) if (!aFrame) return PR_FALSE; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); if (content->IsContentOfType(nsIContent::eXUL)) { // For a XUL checkbox or radio button, the state of the parent determines // the checked state - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); } else { // Check for an HTML input element nsCOMPtr inputElt = do_QueryInterface(content); @@ -221,10 +206,7 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame, if (aFrame && (aWidgetType == NS_THEME_BUTTON || aWidgetType == NS_THEME_TEXTFIELD)) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - if (content->IsContentOfType(nsIContent::eHTML)) { - + if (aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) { nscolor defaultBGColor, defaultBorderColor; PRUint8 defaultBorderStyle; nsMargin defaultBorderSize; diff --git a/mozilla/gfx/src/windows/nsNativeThemeWin.cpp b/mozilla/gfx/src/windows/nsNativeThemeWin.cpp index 8d30d8cebd3..6e8ae9ace7b 100644 --- a/mozilla/gfx/src/windows/nsNativeThemeWin.cpp +++ b/mozilla/gfx/src/windows/nsNativeThemeWin.cpp @@ -307,9 +307,7 @@ static void GetPrimaryPresShell(nsIFrame* aFrame, nsIPresShell** aResult) if (!aFrame) return; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - nsIDocument* doc = content->GetDocument(); + nsIDocument* doc = aFrame->GetContent()->GetDocument(); if (doc) doc->GetShellAt(0, aResult); // Addref happens here. } @@ -329,9 +327,7 @@ static PRInt32 GetContentState(nsIFrame* aFrame) nsCOMPtr esm; context->GetEventStateManager(getter_AddRefs(esm)); PRInt32 flags = 0; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - esm->GetContentState(content, flags); + esm->GetContentState(aFrame->GetContent(), flags); return flags; } @@ -339,10 +335,8 @@ static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom) { if (!aFrame) return PR_FALSE; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); nsAutoString attr; - nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attr); + nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr); if (res == NS_CONTENT_ATTR_NO_VALUE || (res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty())) return PR_TRUE; // This handles the HTML case (an attr with no value is like a true val) @@ -356,10 +350,8 @@ GetAttribute(nsIFrame* aFrame, nsIAtom* inAttribute, nsCString& outValue) if (!aFrame) return PR_FALSE; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); nsAutoString attr; - nsresult res = content->GetAttr(kNameSpaceID_None, inAttribute, attr); + nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, inAttribute, attr); outValue = NS_LossyConvertUCS2toASCII(attr).get(); return ( res != NS_CONTENT_ATTR_NO_VALUE && !(res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty())); @@ -379,10 +371,8 @@ PRBool nsNativeThemeWin::IsChecked(nsIFrame* aFrame) { if (!aFrame) return NS_OK; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); nsAutoString checked; - nsresult res = content->GetAttr(kNameSpaceID_None, mCheckedAtom, checked); + nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, mCheckedAtom, checked); if (res == NS_CONTENT_ATTR_NO_VALUE) return PR_TRUE; // XXXdwh Can the HTML form control's checked property differ // from the checked attribute? If so, will need an IsContentofType @@ -455,10 +445,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, else { // For XUL checkboxes and radio buttons, the state of the parent // determines our state. - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); if (content->IsContentOfType(nsIContent::eXUL)) - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); else { // Attempt a QI. nsCOMPtr inputElt(do_QueryInterface(content)); @@ -726,11 +715,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, case NS_THEME_DROPDOWN_BUTTON: { aPart = CBP_DROPMARKER; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); - nsIFrame* parentFrame; - aFrame->GetParent(&parentFrame); + nsIFrame* parentFrame = aFrame->GetParent(); nsCOMPtr menuFrame(do_QueryInterface(parentFrame)); if (menuFrame || (content && content->IsContentOfType(nsIContent::eHTML)) ) // XUL menu lists and HTML selects get state from parent @@ -813,11 +800,8 @@ nsNativeThemeWin::DrawWidgetBackground(nsIRenderingContext* aContext, // Draw focus rectangles for XP HTML checkboxes and radio buttons // XXX it'd be nice to draw these outside of the frame - if (aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - - if (content->IsContentOfType(nsIContent::eHTML)) { + if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) + && aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) { PRInt32 contentState ; contentState = GetContentState(aFrame); @@ -830,7 +814,6 @@ nsNativeThemeWin::DrawWidgetBackground(nsIRenderingContext* aContext, ::DrawFocusRect(hdc, &widgetRect); ::SetTextColor(hdc, oldColor); } - } } return NS_OK; } @@ -887,8 +870,7 @@ nsNativeThemeWin::GetWidgetBorder(nsIDeviceContext* aContext, aResult->left = 0; if (aFrame && aWidgetType == NS_THEME_TEXTFIELD) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); if (content && content->IsContentOfType(nsIContent::eHTML)) { // We need to pad textfields by 1 pixel, since the caret will draw // flush against the edge by default if we don't. @@ -1066,9 +1048,7 @@ nsNativeThemeWin::ThemeChanged() PRBool nsNativeThemeWin::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType) { if (aFrame && (aWidgetType == NS_THEME_BUTTON || aWidgetType == NS_THEME_TEXTFIELD)) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - if (content->IsContentOfType(nsIContent::eHTML)) { + if (aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) { // Get default CSS style values for widget // (these need to match the values in forms.css) @@ -1281,8 +1261,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext, break; case NS_THEME_TEXTFIELD: { (*aResult).top = (*aResult).bottom = 2; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); if (content && content->IsContentOfType(nsIContent::eHTML)) // HTML text-fields need extra padding (*aResult).left = (*aResult).right = 3; @@ -1295,12 +1274,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext, (*aResult).top = 1; (*aResult).left = 1; (*aResult).bottom = 1; - nsIFrame* hasSibling = nsnull; - aFrame->GetNextSibling(&hasSibling); - if (hasSibling) - (*aResult).right = 3; - else - (*aResult).right = 1; + (*aResult).right = aFrame->GetNextSibling() ? 3 : 1; break; } case NS_THEME_TOOLTIP: @@ -1418,9 +1392,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface(); // The down state is flat if the button is focusable if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) { - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - if (!content->IsContentOfType(nsIContent::eHTML)) + if (!aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) aState |= DFCS_FLAT; aFocused = PR_TRUE; } @@ -1439,15 +1411,14 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 PRInt32 contentState ; PRBool isDisabled = PR_FALSE; aFocused = PR_FALSE; - nsCOMPtr content; aPart = DFC_BUTTON; aState = (aWidgetType == NS_THEME_CHECKBOX) ? DFCS_BUTTONCHECK : DFCS_BUTTONRADIO; - aFrame->GetContent(getter_AddRefs(content)); + nsIContent* content = aFrame->GetContent(); if (content->IsContentOfType(nsIContent::eXUL)) { // XUL - aFrame->GetParent(&aFrame); + aFrame = aFrame->GetParent(); if (aWidgetType == NS_THEME_CHECKBOX) { if (IsChecked(aFrame)) aState |= DFCS_CHECKED; @@ -1508,11 +1479,8 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 aPart = DFC_SCROLL; aState = DFCS_SCROLLCOMBOBOX; - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - - nsIFrame* parentFrame; - aFrame->GetParent(&parentFrame); + nsIContent* content = aFrame->GetContent(); + nsIFrame* parentFrame = aFrame->GetParent(); nsCOMPtr menuFrame(do_QueryInterface(parentFrame)); if (menuFrame || (content && content->IsContentOfType(nsIContent::eHTML)) ) // XUL menu lists and HTML selects get state from parent @@ -1757,11 +1725,10 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground(nsIRenderingContext* aCon // Draw inset edge ::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); - nsCOMPtr content; - aFrame->GetContent(getter_AddRefs(content)); - // Fill in background - if (IsDisabled(aFrame) || (content->IsContentOfType(nsIContent::eXUL) && IsReadOnly(aFrame))) + if (IsDisabled(aFrame) || + (aFrame->GetContent()->IsContentOfType(nsIContent::eXUL) && + IsReadOnly(aFrame))) ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1)); else ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_WINDOW+1)); @@ -1797,9 +1764,7 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground(nsIRenderingContext* aCon } // Draw 3D inset statusbar panel case NS_THEME_STATUSBAR_PANEL: { - nsIFrame* hasSibling = nsnull; - aFrame->GetNextSibling(&hasSibling); - if (hasSibling) + if (aFrame->GetNextSibling()) widgetRect.right -= 2; // space between sibling status panels ::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE); diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 90c4127476e..0b99475ec97 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -3009,7 +3009,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) rootFrame->WillReflow(mPresContext); nsContainerFrame::PositionFrameView(mPresContext, rootFrame); rootFrame->Reflow(mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); + rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height)); mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height)); nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(), diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 5ba1ed89891..137ea9b4888 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -1218,67 +1218,6 @@ public: */ virtual PRBool SupportsVisibilityHidden() { return PR_TRUE; } - // DEPRECATED COMPATIBILITY METHODS - nsresult GetContent(nsIContent** aContent) const { *aContent = mContent; NS_IF_ADDREF(*aContent); return NS_OK; } - nsresult GetParent(nsIFrame** aParent) const { *aParent = mParent; return NS_OK; } - nsresult GetRect(nsRect& aRect) const { - aRect = mRect; - return NS_OK; - } - nsresult GetOrigin(nsPoint& aPoint) const { - aPoint.x = mRect.x; - aPoint.y = mRect.y; - return NS_OK; - } - nsresult GetSize(nsSize& aSize) const { - aSize.width = mRect.width; - aSize.height = mRect.height; - return NS_OK; - } - nsresult SetRect(nsIPresContext* aPresContext, - const nsRect& aRect) { - MoveTo(aPresContext, aRect.x, aRect.y); - SizeTo(aPresContext, aRect.width, aRect.height); - return NS_OK; - } - nsresult MoveTo(nsIPresContext* aPresContext, - nscoord aX, - nscoord aY) { - mRect.x = aX; - mRect.y = aY; - return NS_OK; - } - nsresult SizeTo(nsIPresContext* aPresContext, - nscoord aWidth, - nscoord aHeight) { - mRect.width = aWidth; - mRect.height = aHeight; - return NS_OK; - } - nsresult GetNextSibling(nsIFrame** aNextSibling) const { - *aNextSibling = mNextSibling; - return NS_OK; - } - nsresult GetFrameState(nsFrameState* aResult) { - *aResult = mState; - return NS_OK; - } - nsresult SetFrameState(nsFrameState aState) { - mState = aState; - return NS_OK; - } - nsIView* GetView(nsIPresContext* aPresContext) const { return GetView(); } - nsIView* GetViewExternal(nsIPresContext* aPresContext) const { return GetViewExternal(); } - nsresult SetView(nsIPresContext* aPresContext, nsIView* aView) { return SetView(aView); } - nsIView* GetClosestView(nsIPresContext* aPresContext) const { return GetClosestView(); } - nsresult GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const { - *aParent = GetAncestorWithViewExternal(); - return NS_OK; - } - PRBool AreAncestorViewsVisible(nsIPresContext* aPresContext) const { - return AreAncestorViewsVisible(); - } - protected: // Members nsRect mRect; diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp index 3ebfeba9671..9924747acdb 100644 --- a/mozilla/layout/generic/nsBulletFrame.cpp +++ b/mozilla/layout/generic/nsBulletFrame.cpp @@ -407,8 +407,7 @@ nsBulletFrame::SetListItemOrdinal(PRInt32 aNextOrdinal, // value attribute. Note: we do this with our parent's content // because our parent is the list-item. nsHTMLValue value; - nsCOMPtr parentContent; - mParent->GetContent(getter_AddRefs(parentContent)); + nsIContent* parentContent = mParent->GetContent(); if (parentContent) { nsCOMPtr hc = do_QueryInterface(parentContent); if (hc) { diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index 21fec92dd62..61408b217e8 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -342,9 +342,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, nsresult result = CallCreateInstance(kViewCID, &view); nsIViewManager* viewMan = aPresContext->GetViewManager(); - nsIFrame* parWithView; - GetParentWithView(aPresContext, &parWithView); - nsIView *parView = parWithView->GetView(); + nsIView *parView = GetAncestorWithView()->GetView(); nsRect boundBox(0, 0, 0, 0); result = view->Init(viewMan, boundBox, parView); // XXX Put it last in document order until we can do better diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 5ba1ed89891..137ea9b4888 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -1218,67 +1218,6 @@ public: */ virtual PRBool SupportsVisibilityHidden() { return PR_TRUE; } - // DEPRECATED COMPATIBILITY METHODS - nsresult GetContent(nsIContent** aContent) const { *aContent = mContent; NS_IF_ADDREF(*aContent); return NS_OK; } - nsresult GetParent(nsIFrame** aParent) const { *aParent = mParent; return NS_OK; } - nsresult GetRect(nsRect& aRect) const { - aRect = mRect; - return NS_OK; - } - nsresult GetOrigin(nsPoint& aPoint) const { - aPoint.x = mRect.x; - aPoint.y = mRect.y; - return NS_OK; - } - nsresult GetSize(nsSize& aSize) const { - aSize.width = mRect.width; - aSize.height = mRect.height; - return NS_OK; - } - nsresult SetRect(nsIPresContext* aPresContext, - const nsRect& aRect) { - MoveTo(aPresContext, aRect.x, aRect.y); - SizeTo(aPresContext, aRect.width, aRect.height); - return NS_OK; - } - nsresult MoveTo(nsIPresContext* aPresContext, - nscoord aX, - nscoord aY) { - mRect.x = aX; - mRect.y = aY; - return NS_OK; - } - nsresult SizeTo(nsIPresContext* aPresContext, - nscoord aWidth, - nscoord aHeight) { - mRect.width = aWidth; - mRect.height = aHeight; - return NS_OK; - } - nsresult GetNextSibling(nsIFrame** aNextSibling) const { - *aNextSibling = mNextSibling; - return NS_OK; - } - nsresult GetFrameState(nsFrameState* aResult) { - *aResult = mState; - return NS_OK; - } - nsresult SetFrameState(nsFrameState aState) { - mState = aState; - return NS_OK; - } - nsIView* GetView(nsIPresContext* aPresContext) const { return GetView(); } - nsIView* GetViewExternal(nsIPresContext* aPresContext) const { return GetViewExternal(); } - nsresult SetView(nsIPresContext* aPresContext, nsIView* aView) { return SetView(aView); } - nsIView* GetClosestView(nsIPresContext* aPresContext) const { return GetClosestView(); } - nsresult GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const { - *aParent = GetAncestorWithViewExternal(); - return NS_OK; - } - PRBool AreAncestorViewsVisible(nsIPresContext* aPresContext) const { - return AreAncestorViewsVisible(); - } - protected: // Members nsRect mRect; diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp index 3ebfeba9671..9924747acdb 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.cpp +++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp @@ -407,8 +407,7 @@ nsBulletFrame::SetListItemOrdinal(PRInt32 aNextOrdinal, // value attribute. Note: we do this with our parent's content // because our parent is the list-item. nsHTMLValue value; - nsCOMPtr parentContent; - mParent->GetContent(getter_AddRefs(parentContent)); + nsIContent* parentContent = mParent->GetContent(); if (parentContent) { nsCOMPtr hc = do_QueryInterface(parentContent); if (hc) { diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 90c4127476e..0b99475ec97 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -3009,7 +3009,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) rootFrame->WillReflow(mPresContext); nsContainerFrame::PositionFrameView(mPresContext, rootFrame); rootFrame->Reflow(mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); + rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height)); mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height)); nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(), diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index 21fec92dd62..61408b217e8 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -342,9 +342,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, nsresult result = CallCreateInstance(kViewCID, &view); nsIViewManager* viewMan = aPresContext->GetViewManager(); - nsIFrame* parWithView; - GetParentWithView(aPresContext, &parWithView); - nsIView *parView = parWithView->GetView(); + nsIView *parView = GetAncestorWithView()->GetView(); nsRect boundBox(0, 0, 0, 0); result = view->Init(viewMan, boundBox, parView); // XXX Put it last in document order until we can do better diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h index 1cb44d2fdb3..8489b9d2f57 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h @@ -362,7 +362,7 @@ public: virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); }; virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); }; virtual void GetNextFrame(nsIFrame* aFrame, - nsIFrame** aResult) { aFrame->GetNextSibling(aResult); }; + nsIFrame** aResult) { *aResult = aFrame->GetNextSibling(); }; PRBool IsRepeatable() const; void SetRepeatable(PRBool aRepeatable); PRBool HasStyleHeight() const; diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.h b/mozilla/layout/tables/nsTableRowGroupFrame.h index 1cb44d2fdb3..8489b9d2f57 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.h +++ b/mozilla/layout/tables/nsTableRowGroupFrame.h @@ -362,7 +362,7 @@ public: virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); }; virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); }; virtual void GetNextFrame(nsIFrame* aFrame, - nsIFrame** aResult) { aFrame->GetNextSibling(aResult); }; + nsIFrame** aResult) { *aResult = aFrame->GetNextSibling(); }; PRBool IsRepeatable() const; void SetRepeatable(PRBool aRepeatable); PRBool HasStyleHeight() const; diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index 0c31f3583b6..e1c25f2a037 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -445,10 +445,8 @@ nsBox::RelayoutStyleChange(nsBoxLayoutState& aState, nsIBox* aChild) NS_IMETHODIMP nsBox::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild) { - nsFrameState state; nsIFrame* frame; GetFrame(&frame); - frame->GetFrameState(&state); if (aChild != nsnull) { nsCOMPtr layout; diff --git a/mozilla/view/public/nsIView.h b/mozilla/view/public/nsIView.h index 2f413d00379..053bd662965 100644 --- a/mozilla/view/public/nsIView.h +++ b/mozilla/view/public/nsIView.h @@ -317,21 +317,6 @@ public: */ virtual PRBool IsRoot() const = 0; - // DEPRECATED METHODS to be removed by roc - NS_IMETHOD HasWidget(PRBool *aHasWidget) const = 0; - NS_IMETHOD GetWidget(nsIWidget *&aWidget) const = 0; - NS_IMETHOD GetFloating(PRBool &aFloatingView) const = 0; - NS_IMETHOD GetParent(nsIView *&aParent) const = 0; - NS_IMETHOD GetFirstChild(nsIView* &aChild) const = 0; - NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const = 0; - NS_IMETHOD GetOpacity(float &aOpacity) const = 0; - NS_IMETHOD GetClientData(void *&aData) const = 0; - NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const = 0; - NS_IMETHOD GetViewManager(nsIViewManager *&aViewMgr) const = 0; - NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const = 0; - NS_IMETHOD GetPosition(nscoord *aX, nscoord *aY) const = 0; - NS_IMETHOD GetBounds(nsRect &aBounds) const = 0; - private: NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; NS_IMETHOD_(nsrefcnt) Release(void) = 0; diff --git a/mozilla/view/src/nsView.cpp b/mozilla/view/src/nsView.cpp index e3f013ed00e..04d0f4720a1 100644 --- a/mozilla/view/src/nsView.cpp +++ b/mozilla/view/src/nsView.cpp @@ -260,13 +260,6 @@ NS_IMETHODIMP nsView::Destroy() return NS_OK; } -NS_IMETHODIMP nsView::GetViewManager(nsIViewManager *&aViewMgr) const -{ - NS_IF_ADDREF(mViewManager); - aViewMgr = mViewManager; - return NS_OK; -} - NS_IMETHODIMP nsView::Paint(nsIRenderingContext& rc, const nsRect& rect, PRUint32 aPaintFlags, PRBool &aResult) { @@ -452,22 +445,6 @@ NS_IMETHODIMP nsView::SynchWidgetSizePosition() return NS_OK; } -NS_IMETHODIMP nsView::GetPosition(nscoord *x, nscoord *y) const -{ - - nsView *rootView = mViewManager->GetRootView(); - - if (this == rootView) - *x = *y = 0; - else - { - *x = mPosX; - *y = mPosY; - } - - return NS_OK; -} - void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint) { nsRect dims = aRect; @@ -517,23 +494,6 @@ void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint) } } -NS_IMETHODIMP nsView::GetBounds(nsRect &aBounds) const -{ - NS_ASSERTION(mViewManager, "mViewManager is null!"); - if (!mViewManager) { - aBounds.x = aBounds.y = 0; - return NS_ERROR_FAILURE; - } - - nsView *rootView = mViewManager->GetRootView(); - aBounds = mDimBounds; - - if (this == rootView) - aBounds.x = aBounds.y = 0; - - return NS_OK; -} - NS_IMETHODIMP nsView::SetVisibility(nsViewVisibility aVisibility) { @@ -557,20 +517,6 @@ NS_IMETHODIMP nsView::SetVisibility(nsViewVisibility aVisibility) return NS_OK; } -NS_IMETHODIMP nsView::GetVisibility(nsViewVisibility &aVisibility) const -{ - aVisibility = mVis; - return NS_OK; -} - -NS_IMETHODIMP nsView::GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const -{ - aAuto = (mVFlags & NS_VIEW_FLAG_AUTO_ZINDEX) != 0; - aZIndex = mZIndex; - aTopMost = (mVFlags & NS_VIEW_FLAG_TOPMOST) != 0; - return NS_OK; -} - NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView) { if (aFloatingView) @@ -588,30 +534,6 @@ NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView) return NS_OK; } -NS_IMETHODIMP nsView::GetFloating(PRBool &aFloatingView) const -{ - aFloatingView = ((mVFlags & NS_VIEW_FLAG_FLOATING) != 0); - return NS_OK; -} - -NS_IMETHODIMP nsView::GetParent(nsIView *&aParent) const -{ - aParent = mParent; - return NS_OK; -} - -NS_IMETHODIMP nsView::GetFirstChild(nsIView *&aChild) const -{ - aChild = mFirstChild; - return NS_OK; -} - -NS_IMETHODIMP nsView::GetNextSibling(nsIView *&aNextSibling) const -{ - aNextSibling = mNextSibling; - return NS_OK; -} - void nsView::InsertChild(nsView *aChild, nsView *aSibling) { NS_PRECONDITION(nsnull != aChild, "null ptr"); @@ -664,29 +586,12 @@ void nsView::RemoveChild(nsView *child) } } -nsView* nsView::GetChild(PRInt32 aIndex) const -{ - for (nsView* child = GetFirstChild(); child; child = child->GetNextSibling()) { - if (aIndex == 0) { - return child; - } - --aIndex; - } - return nsnull; -} - NS_IMETHODIMP nsView::SetOpacity(float opacity) { mOpacity = opacity; return NS_OK; } -NS_IMETHODIMP nsView::GetOpacity(float &aOpacity) const -{ - aOpacity = mOpacity; - return NS_OK; -} - NS_IMETHODIMP nsView::HasTransparency(PRBool &aTransparent) const { aTransparent = (mVFlags & NS_VIEW_FLAG_TRANSPARENT) ? PR_TRUE : PR_FALSE; @@ -709,12 +614,6 @@ NS_IMETHODIMP nsView::SetClientData(void *aData) return NS_OK; } -NS_IMETHODIMP nsView::GetClientData(void *&aData) const -{ - aData = mClientData; - return NS_OK; -} - NS_IMETHODIMP nsView::CreateWidget(const nsIID &aWindowIID, nsWidgetInitData *aWidgetInitData, nsNativeWidget aNative, @@ -811,19 +710,6 @@ NS_IMETHODIMP nsView::SetWidget(nsIWidget *aWidget) return NS_OK; } -NS_IMETHODIMP nsView::GetWidget(nsIWidget *&aWidget) const -{ - NS_IF_ADDREF(mWindow); - aWidget = mWindow; - return NS_OK; -} - -NS_IMETHODIMP nsView::HasWidget(PRBool *aHasWidget) const -{ - *aHasWidget = (mWindow != nsnull); - return NS_OK; -} - // // internal window creation functions // diff --git a/mozilla/view/src/nsView.h b/mozilla/view/src/nsView.h index 4c27cd8628d..d47196c70dc 100644 --- a/mozilla/view/src/nsView.h +++ b/mozilla/view/src/nsView.h @@ -82,16 +82,6 @@ public: const nsRect &aBounds, const nsIView *aParent, nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow); - NS_IMETHOD GetViewManager(nsIViewManager *&aViewMgr) const; - NS_IMETHOD GetPosition(nscoord *x, nscoord *y) const; - NS_IMETHOD GetBounds(nsRect &aBounds) const; - NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const; - NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const; - NS_IMETHOD GetFloating(PRBool &aFloatingView) const; - NS_IMETHOD GetParent(nsIView *&aParent) const; - NS_IMETHOD GetFirstChild(nsIView* &aChild) const; - NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const; - NS_IMETHOD GetOpacity(float &aOpacity) const; /** * Used to ask a view if it has any areas within its bounding box * that are transparent. This is not the same as opacity - opacity can @@ -100,7 +90,6 @@ public: */ NS_IMETHOD HasTransparency(PRBool &aTransparent) const; NS_IMETHOD SetClientData(void *aData); - NS_IMETHOD GetClientData(void *&aData) const; NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget); NS_IMETHOD CreateWidget(const nsIID &aWindowIID, nsWidgetInitData *aWidgetInitData = nsnull, @@ -108,8 +97,6 @@ public: PRBool aEnableDragDrop = PR_TRUE, PRBool aResetVisibility = PR_TRUE, nsContentType aContentType = eContentTypeInherit); - NS_IMETHOD GetWidget(nsIWidget *&aWidget) const; - NS_IMETHOD HasWidget(PRBool *aHasWidget) const; NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; NS_IMETHOD Destroy(); @@ -290,26 +277,6 @@ public: nsRect GetDimensions() const { nsRect r = mDimBounds; r.MoveBy(-mPosX, -mPosY); return r; } // These are defined exactly the same in nsIView, but for now they have to be redeclared // here because of stupid C++ method hiding rules - PRBool GetFloating() const { return (mVFlags & NS_VIEW_FLAG_FLOATING) != 0; } - float GetOpacity() const { return mOpacity; } - void* GetClientData() const { return mClientData; } - nsViewVisibility GetVisibility() const { return mVis; } - nsRect GetBounds() const { - // this assertion should go away once we're confident that it's not needed - NS_ASSERTION(!IsRoot() || (mDimBounds.x == 0 && mDimBounds.y == 0), - "root views should always have explicit position of (0,0)"); - return mDimBounds; - } - nsPoint GetPosition() const { - // this assertion should go away once we're confident that it's not needed - NS_ASSERTION(!IsRoot() || (mPosX == 0 && mPosY == 0), - "root views should always have explicit position of (0,0)"); - return nsPoint(mPosX, mPosY); - } - nsIWidget* GetWidget() const { return mWindow; } - PRBool HasWidget() const { return mWindow != nsnull; } - - nsView* GetChild(PRInt32 aIndex) const; void InsertChild(nsView *aChild, nsView *aSibling); void RemoveChild(nsView *aChild); diff --git a/mozilla/widget/src/mac/nsDragService.cpp b/mozilla/widget/src/mac/nsDragService.cpp index 5b51bf66998..e49cb79a28b 100644 --- a/mozilla/widget/src/mac/nsDragService.cpp +++ b/mozilla/widget/src/mac/nsDragService.cpp @@ -172,8 +172,7 @@ nsDragService::ComputeGlobalRectFromFrame ( nsIDOMNode* aDOMNode, Rect & outScre // coordinates. // - nsRect aRect(0,0,0,0); - aFrame->GetRect(aRect); + nsRect rect = aFrame->GetRect(); // Find offset from our view nsIView *containingView = nsnull; @@ -208,8 +207,8 @@ nsDragService::ComputeGlobalRectFromFrame ( nsIDOMNode* aDOMNode, Rect & outScre // stash it all in a mac rect outScreenRect.left = screenOffset.x; outScreenRect.top = screenOffset.y; - outScreenRect.right = outScreenRect.left + NSTwipsToIntPixels(aRect.width, t2p); - outScreenRect.bottom = outScreenRect.top + NSTwipsToIntPixels(aRect.height, t2p); + outScreenRect.right = outScreenRect.left + NSTwipsToIntPixels(rect.width, t2p); + outScreenRect.bottom = outScreenRect.top + NSTwipsToIntPixels(rect.height, t2p); haveRectFlag = PR_TRUE; } diff --git a/mozilla/widget/src/photon/nsWindow.cpp b/mozilla/widget/src/photon/nsWindow.cpp index 78a3ce11711..9652aa82e41 100644 --- a/mozilla/widget/src/photon/nsWindow.cpp +++ b/mozilla/widget/src/photon/nsWindow.cpp @@ -812,8 +812,7 @@ int nsWindow::EvInfo( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) nsCOMPtr presShell; docShell->GetPresShell( getter_AddRefs(presShell) ); - nsCOMPtr viewManager; - presShell->GetViewManager(getter_AddRefs(viewManager)); + nsIViewManager* viewManager = presShell->GetViewManager(); NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE); windowEnumerator->HasMoreElements(&more); diff --git a/mozilla/widget/src/xpwidgets/nsBaseFilePicker.cpp b/mozilla/widget/src/xpwidgets/nsBaseFilePicker.cpp index 521325d440c..ebfeaf66e25 100644 --- a/mozilla/widget/src/xpwidgets/nsBaseFilePicker.cpp +++ b/mozilla/widget/src/xpwidgets/nsBaseFilePicker.cpp @@ -74,24 +74,12 @@ NS_IMETHODIMP nsBaseFilePicker::DOMWindowToWidget(nsIDOMWindowInternal *dw, nsIW rv = docShell->GetPresShell(getter_AddRefs(presShell)); if (NS_SUCCEEDED(rv) && presShell) { - nsCOMPtr viewManager; - rv = presShell->GetViewManager(getter_AddRefs(viewManager)); - - if (NS_SUCCEEDED(rv)) { - nsIView *view; - rv = viewManager->GetRootView(view); + nsIView *view; + rv = presShell->GetViewManager()->GetRootView(view); - if (NS_SUCCEEDED(rv)) { - nsCOMPtr widget; - rv = view->GetWidget(*getter_AddRefs(widget)); - - if (NS_SUCCEEDED(rv)) { - *aResult = widget; - NS_ADDREF(*aResult); - return NS_OK; - } - - } + if (NS_SUCCEEDED(rv)) { + *aResult = view->GetWidget(); + NS_IF_ADDREF(*aResult); } } }