diff --git a/layout/inspector/src/inFlasher.cpp b/layout/inspector/src/inFlasher.cpp index ba6f2d9933d..5d9532e80cf 100644 --- a/layout/inspector/src/inFlasher.cpp +++ b/layout/inspector/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/layout/inspector/src/inLayoutUtils.cpp b/layout/inspector/src/inLayoutUtils.cpp index a041c88bf78..2f526a893ad 100644 --- a/layout/inspector/src/inLayoutUtils.cpp +++ b/layout/inspector/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) {