diff --git a/accessible/src/base/nsCaretAccessible.cpp b/accessible/src/base/nsCaretAccessible.cpp index 3aa147e4ddb0..7053f6106bd4 100644 --- a/accessible/src/base/nsCaretAccessible.cpp +++ b/accessible/src/base/nsCaretAccessible.cpp @@ -343,7 +343,7 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget) NS_ENSURE_TRUE(presContext, nsIntRect()); rect += offsetFromWidget; - caretRect = nsRect::ToOutsidePixels(rect, presContext->AppUnitsPerDevPixel()); + caretRect = rect.ToOutsidePixels(presContext->AppUnitsPerDevPixel()); caretRect.MoveBy((*aOutWidget)->WidgetToScreenOffset()); diff --git a/content/events/src/nsContentEventHandler.cpp b/content/events/src/nsContentEventHandler.cpp index 480978d8b0b4..9fa13a29356f 100644 --- a/content/events/src/nsContentEventHandler.cpp +++ b/content/events/src/nsContentEventHandler.cpp @@ -595,7 +595,7 @@ nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent) rect.UnionRect(rect, frameRect); } aEvent->mReply.mRect = - nsRect::ToOutsidePixels(rect, mPresContext->AppUnitsPerDevPixel()); + rect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()); aEvent->mSucceeded = PR_TRUE; return NS_OK; } @@ -624,7 +624,7 @@ nsContentEventHandler::OnQueryEditorRect(nsQueryContentEvent* aEvent) } aEvent->mReply.mRect = - nsRect::ToOutsidePixels(resultRect, mPresContext->AppUnitsPerDevPixel()); + resultRect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()); aEvent->mSucceeded = PR_TRUE; return NS_OK; } @@ -658,7 +658,7 @@ nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent) mSelection, &rect, &isCollapsed, nsnull); aEvent->mReply.mRect = - nsRect::ToOutsidePixels(rect, mPresContext->AppUnitsPerDevPixel()); + rect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()); NS_ENSURE_SUCCESS(rv, rv); aEvent->mSucceeded = PR_TRUE; return NS_OK; @@ -690,7 +690,7 @@ nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent) NS_ENSURE_SUCCESS(rv, rv); aEvent->mReply.mRect = - nsRect::ToOutsidePixels(rect, mPresContext->AppUnitsPerDevPixel()); + rect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()); aEvent->mSucceeded = PR_TRUE; return NS_OK; } diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index b0615d13f55c..255e093b1d72 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -2001,8 +2001,7 @@ nsEditor::QueryComposition(nsTextEventReply* aReply) &(aReply->mCursorIsCollapsed), &view); aReply->mCursorPosition = - nsRect::ToOutsidePixels(rect, - ps->GetPresContext()->AppUnitsPerDevPixel()); + rect.ToOutsidePixels(ps->GetPresContext()->AppUnitsPerDevPixel()); if (NS_SUCCEEDED(result) && view) aReply->mReferenceWidget = view->GetWidget(); } diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index b25148e7f70e..7270afad9e60 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -1735,8 +1735,7 @@ nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsI &(aReply->mCursorIsCollapsed), &view); aReply->mCursorPosition = - nsRect::ToOutsidePixels(rect, - ps->GetPresContext()->AppUnitsPerDevPixel()); + rect.ToOutsidePixels(ps->GetPresContext()->AppUnitsPerDevPixel()); NS_ASSERTION(NS_SUCCEEDED(result), "cannot get caret position"); if (NS_SUCCEEDED(result) && view) aReply->mReferenceWidget = view->GetWidget(); diff --git a/gfx/public/nsRect.h b/gfx/public/nsRect.h index c903fdfbb395..14fce5d3bf3a 100644 --- a/gfx/public/nsRect.h +++ b/gfx/public/nsRect.h @@ -186,9 +186,9 @@ struct NS_GFX nsRect { nscoord XMost() const {return x + width;} nscoord YMost() const {return y + height;} - static inline nsIntRect ToNearestPixels(const nsRect &aRect, nscoord aAppUnitsPerPixel); - static inline nsIntRect ToOutsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel); - static inline nsIntRect ToInsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel); + inline nsIntRect ToNearestPixels(nscoord aAppUnitsPerPixel) const; + inline nsIntRect ToOutsidePixels(nscoord aAppUnitsPerPixel) const; + inline nsIntRect ToInsidePixels(nscoord aAppUnitsPerPixel) const; }; struct NS_GFX nsIntRect { @@ -305,7 +305,7 @@ struct NS_GFX nsIntRect { PRInt32 XMost() const {return x + width;} PRInt32 YMost() const {return y + height;} - static inline nsRect ToAppUnits(const nsIntRect &aRect, nscoord aAppUnitsPerPixel); + inline nsRect ToAppUnits(nscoord aAppUnitsPerPixel) const; }; /* @@ -313,54 +313,54 @@ struct NS_GFX nsIntRect { */ // scale the rect but round to preserve centers inline nsIntRect -nsRect::ToNearestPixels(const nsRect &aRect, nscoord aAppUnitsPerPixel) +nsRect::ToNearestPixels(nscoord aAppUnitsPerPixel) const { nsIntRect rect; - rect.x = NSToIntRound(NSAppUnitsToFloatPixels(aRect.x, float(aAppUnitsPerPixel))); - rect.y = NSToIntRound(NSAppUnitsToFloatPixels(aRect.y, float(aAppUnitsPerPixel))); - rect.width = NSToIntRound(NSAppUnitsToFloatPixels(aRect.XMost(), + rect.x = NSToIntRound(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel))); + rect.y = NSToIntRound(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel))); + rect.width = NSToIntRound(NSAppUnitsToFloatPixels(XMost(), float(aAppUnitsPerPixel))) - rect.x; - rect.height = NSToIntRound(NSAppUnitsToFloatPixels(aRect.YMost(), + rect.height = NSToIntRound(NSAppUnitsToFloatPixels(YMost(), float(aAppUnitsPerPixel))) - rect.y; return rect; } // scale the rect but round to smallest containing rect inline nsIntRect -nsRect::ToOutsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel) +nsRect::ToOutsidePixels(nscoord aAppUnitsPerPixel) const { nsIntRect rect; - rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.x, float(aAppUnitsPerPixel))); - rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.y, float(aAppUnitsPerPixel))); - rect.width = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.XMost(), + rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel))); + rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel))); + rect.width = NSToIntCeil(NSAppUnitsToFloatPixels(XMost(), float(aAppUnitsPerPixel))) - rect.x; - rect.height = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.YMost(), + rect.height = NSToIntCeil(NSAppUnitsToFloatPixels(YMost(), float(aAppUnitsPerPixel))) - rect.y; return rect; } // scale the rect but round to largest contained rect inline nsIntRect -nsRect::ToInsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel) +nsRect::ToInsidePixels(nscoord aAppUnitsPerPixel) const { nsIntRect rect; - rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.x, float(aAppUnitsPerPixel))); - rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.y, float(aAppUnitsPerPixel))); - rect.width = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.XMost(), + rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel))); + rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel))); + rect.width = NSToIntFloor(NSAppUnitsToFloatPixels(XMost(), float(aAppUnitsPerPixel))) - rect.x; - rect.height = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.YMost(), + rect.height = NSToIntFloor(NSAppUnitsToFloatPixels(YMost(), float(aAppUnitsPerPixel))) - rect.y; return rect; } // app units are integer multiples of pixels, so no rounding needed inline nsRect -nsIntRect::ToAppUnits(const nsIntRect &aRect, nscoord aAppUnitsPerPixel) +nsIntRect::ToAppUnits(nscoord aAppUnitsPerPixel) const { - return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(aRect.width, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(aRect.height, aAppUnitsPerPixel)); + return nsRect(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(y, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(width, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(height, aAppUnitsPerPixel)); } #ifdef DEBUG diff --git a/layout/base/nsImageLoader.cpp b/layout/base/nsImageLoader.cpp index 994ae66175cc..249082094cb1 100644 --- a/layout/base/nsImageLoader.cpp +++ b/layout/base/nsImageLoader.cpp @@ -193,7 +193,7 @@ NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer, return NS_OK; } - nsRect r = nsIntRect::ToAppUnits(*dirtyRect, nsPresContext::AppUnitsPerCSSPixel()); + nsRect r = dirtyRect->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()); RedrawDirtyFrame(&r); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 3eeb0036f445..219f892fa8b3 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5407,7 +5407,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, nsIDeviceContext* deviceContext = pc->DeviceContext(); // use the rectangle to create the surface - nsIntRect pixelArea = nsRect::ToOutsidePixels(aArea, pc->AppUnitsPerDevPixel()); + nsIntRect pixelArea = aArea.ToOutsidePixels(pc->AppUnitsPerDevPixel()); // if the area of the image is larger than the maximum area, scale it down float scale = 0.0; @@ -5541,7 +5541,7 @@ PresShell::RenderNode(nsIDOMNode* aNode, aRegion->GetBoundingBox(&rrectPixels.x, &rrectPixels.y, &rrectPixels.width, &rrectPixels.height); - nsRect rrect = nsIntRect::ToAppUnits(rrectPixels, nsPresContext::AppUnitsPerCSSPixel()); + nsRect rrect = rrectPixels.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()); area.IntersectRect(area, rrect); nsPresContext* pc = GetPresContext(); diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 4e9c3f02a0e4..936766a43379 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -870,7 +870,7 @@ void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder, nsRect rect(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize()); rect.IntersectRect(rect, aDirtyRect); - nsIntRect pxRect = nsRect::ToOutsidePixels(rect, mFrame->PresContext()->AppUnitsPerDevPixel()); + nsIntRect pxRect = rect.ToOutsidePixels(mFrame->PresContext()->AppUnitsPerDevPixel()); ctx->NewPath(); ctx->Rectangle(gfxRect(pxRect.x, pxRect.y, pxRect.width, pxRect.height), PR_TRUE); ctx->Fill(); @@ -3608,7 +3608,7 @@ nsIntRect nsIFrame::GetScreenRectExternal() const nsIntRect nsIFrame::GetScreenRect() const { - return nsRect::ToNearestPixels(GetScreenRectInAppUnits(), PresContext()->AppUnitsPerDevPixel()); + return GetScreenRectInAppUnits().ToNearestPixels(PresContext()->AppUnitsPerDevPixel()); } // virtual diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index b3178cb67a04..7d03971a2281 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -4325,7 +4325,7 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect) ConvertRelativeToWindowAbsolute(mOwner, rel, abs, *getter_AddRefs(containerWidget)); // Convert to absolute pixel values for the dirty rect - nsIntRect absDirtyRect = nsRect::ToOutsidePixels(nsRect(abs, aDirtyRect.Size()), *mOwner->GetPresContext()->AppUnitsPerDevPixel()); + nsIntRect absDirtyRect = nsRect(abs, aDirtyRect.Size()).ToOutsidePixels(*mOwner->GetPresContext()->AppUnitsPerDevPixel()); #endif nsCOMPtr pluginWidget = do_QueryInterface(mWidget); @@ -4369,7 +4369,7 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS) nsPluginWindow * window; GetWindow(window); - nsIntRect relDirtyRect = nsRect::ToOutsidePixels(aDirtyRect, mOwner->PresContext()->AppUnitsPerDevPixel()); + nsIntRect relDirtyRect = aDirtyRect.ToOutsidePixels(mOwner->PresContext()->AppUnitsPerDevPixel()); // we got dirty rectangle in relative window coordinates, but we // need it in absolute units and in the (left, top, right, bottom) form diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp index 34c86d11f474..c171e8d6e628 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -680,7 +680,7 @@ nsSVGForeignObjectFrame::InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter, nsCOMPtr localTM; ctm->Translate(x, y, getter_AddRefs(localTM)); - nsIntRect r = nsRect::ToOutsidePixels(aRect, presContext->AppUnitsPerDevPixel()); + nsIntRect r = aRect.ToOutsidePixels(presContext->AppUnitsPerDevPixel()); nsRect rect = GetTransformedRegion(r.x, r.y, r.width, r.height, localTM, presContext); diff --git a/layout/svg/base/src/nsSVGIntegrationUtils.cpp b/layout/svg/base/src/nsSVGIntegrationUtils.cpp index 1bf565e19c82..1167441f19b7 100644 --- a/layout/svg/base/src/nsSVGIntegrationUtils.cpp +++ b/layout/svg/base/src/nsSVGIntegrationUtils.cpp @@ -126,9 +126,9 @@ nsSVGIntegrationUtils::ComputeFrameEffectsRect(nsIFrame* aFrame, nsRect r = GetSVGBBox(firstFrame, aFrame, aOverflowRect, userSpaceRect); // r is relative to user space PRUint32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel(); - nsIntRect p = nsRect::ToOutsidePixels(r, appUnitsPerDevPixel); + nsIntRect p = r.ToOutsidePixels(appUnitsPerDevPixel); p = filterFrame->GetFilterBBox(firstFrame, &p); - r = nsIntRect::ToAppUnits(p, appUnitsPerDevPixel); + r = p.ToAppUnits(appUnitsPerDevPixel); // Make it relative to aFrame again return r + userSpaceRect.TopLeft() - aFrame->GetOffsetTo(firstFrame); } @@ -157,9 +157,9 @@ nsSVGIntegrationUtils::GetInvalidAreaForChangedSource(nsIFrame* aFrame, nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame); nsPoint offset = aFrame->GetOffsetTo(firstFrame) - userSpaceRect.TopLeft(); nsRect r = aInvalidRect + offset; - nsIntRect p = nsRect::ToOutsidePixels(r, appUnitsPerDevPixel); + nsIntRect p = r.ToOutsidePixels(appUnitsPerDevPixel); p = filterFrame->GetInvalidationBBox(firstFrame, p); - r = nsIntRect::ToAppUnits(p, appUnitsPerDevPixel); + r = p.ToAppUnits(appUnitsPerDevPixel); return r - offset; } @@ -180,9 +180,9 @@ nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(nsIFrame* aFrame, nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame); nsPoint offset = aFrame->GetOffsetTo(firstFrame) - userSpaceRect.TopLeft(); nsRect r = aDamageRect + offset; - nsIntRect p = nsRect::ToOutsidePixels(r, appUnitsPerDevPixel); + nsIntRect p = r.ToOutsidePixels(appUnitsPerDevPixel); p = filterFrame->GetSourceForInvalidArea(firstFrame, p); - r = nsIntRect::ToAppUnits(p, appUnitsPerDevPixel); + r = p.ToAppUnits(appUnitsPerDevPixel); return r - offset; } @@ -212,7 +212,7 @@ public: nsIRenderingContext::AutoPushTranslation push(ctx, -mOffset.x, -mOffset.y); nsRect dirty; if (aDirtyRect) { - dirty = nsIntRect::ToAppUnits(*aDirtyRect, nsIDeviceContext::AppUnitsPerCSSPixel()); + dirty = aDirtyRect->ToAppUnits(nsIDeviceContext::AppUnitsPerCSSPixel()); dirty += mOffset; } else { dirty = mInnerList->GetBounds(mBuilder); @@ -281,7 +281,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsIRenderingContext* aCtx, nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame) + aBuilder->ToReferenceFrame(firstFrame); PRInt32 appUnitsPerDevPixel = aEffectsFrame->PresContext()->AppUnitsPerDevPixel(); - userSpaceRect = nsIntRect::ToAppUnits(nsRect::ToNearestPixels(userSpaceRect, appUnitsPerDevPixel), appUnitsPerDevPixel); + userSpaceRect = userSpaceRect.ToNearestPixels(appUnitsPerDevPixel).ToAppUnits(appUnitsPerDevPixel); aCtx->Translate(userSpaceRect.x, userSpaceRect.y); nsCOMPtr matrix = GetInitialMatrix(aEffectsFrame); @@ -306,7 +306,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsIRenderingContext* aCtx, /* Paint the child */ if (filterFrame) { RegularFramePaintCallback paint(aBuilder, aInnerList, userSpaceRect.TopLeft()); - nsIntRect r = nsRect::ToOutsidePixels(aDirtyRect - userSpaceRect.TopLeft(), appUnitsPerDevPixel); + nsIntRect r = (aDirtyRect - userSpaceRect.TopLeft()).ToOutsidePixels(appUnitsPerDevPixel); filterFrame->FilterPaint(&svgContext, aEffectsFrame, &paint, &r); } else { gfx->SetMatrix(savedCTM); diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index 137179ab1d46..084ee83e0298 100644 --- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -553,7 +553,7 @@ nsSVGOuterSVGFrame::Paint(nsIRenderingContext& aRenderingContext, PRTime start = PR_Now(); #endif - nsIntRect dirtyPxRect = nsRect::ToOutsidePixels(dirtyRect, PresContext()->AppUnitsPerDevPixel()); + nsIntRect dirtyPxRect = dirtyRect.ToOutsidePixels(PresContext()->AppUnitsPerDevPixel()); nsSVGRenderState ctx(&aRenderingContext); diff --git a/layout/svg/base/src/nsSVGUtils.cpp b/layout/svg/base/src/nsSVGUtils.cpp index 1547cbf3cc42..2750b5569933 100644 --- a/layout/svg/base/src/nsSVGUtils.cpp +++ b/layout/svg/base/src/nsSVGUtils.cpp @@ -512,7 +512,7 @@ nsRect nsSVGUtils::FindFilterInvalidation(nsIFrame *aFrame, const nsRect& aRect) { PRInt32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel(); - nsIntRect rect = nsRect::ToOutsidePixels(aRect, appUnitsPerDevPixel); + nsIntRect rect = aRect.ToOutsidePixels(appUnitsPerDevPixel); while (aFrame) { if (aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG) @@ -565,7 +565,7 @@ nsSVGUtils::FindFilterInvalidation(nsIFrame *aFrame, const nsRect& aRect) aFrame = aFrame->GetParent(); } - return nsIntRect::ToAppUnits(rect, appUnitsPerDevPixel); + return rect.ToAppUnits(appUnitsPerDevPixel); } void @@ -932,7 +932,7 @@ nsSVGUtils::PaintFrameWithEffects(nsSVGRenderState *aContext, if (!aDirtyRect->Intersects(filterFrame->GetFilterBBox(aFrame, nsnull))) return; } else { - nsRect rect = nsIntRect::ToAppUnits(*aDirtyRect, aFrame->PresContext()->AppUnitsPerDevPixel()); + nsRect rect = aDirtyRect->ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel()); if (!rect.Intersects(aFrame->GetRect())) return; } diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 0caa5fd6759f..270bc6a09fae 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -1052,7 +1052,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, PRBool aIsMove) &screenRectPixels.width, &screenRectPixels.height); } } - nsRect screenRect = nsIntRect::ToAppUnits(screenRectPixels, presContext->AppUnitsPerDevPixel()); + nsRect screenRect = screenRectPixels.ToAppUnits(presContext->AppUnitsPerDevPixel()); // keep a 3 pixel margin to the right and bottom of the screen for the WinXP dropshadow screenRect.SizeBy(-nsPresContext::CSSPixelsToAppUnits(3), diff --git a/layout/xul/base/src/nsScrollBoxObject.cpp b/layout/xul/base/src/nsScrollBoxObject.cpp index f3fd087dd237..5520e55069ea 100644 --- a/layout/xul/base/src/nsScrollBoxObject.cpp +++ b/layout/xul/base/src/nsScrollBoxObject.cpp @@ -290,7 +290,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child) nsIntRect prect; GetOffsetRect(prect); - crect = nsIntRect::ToAppUnits(prect, nsPresContext::AppUnitsPerCSSPixel()); + crect = prect.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()); nscoord newx=cp.x, newy=cp.y; // we only scroll in the direction of the scrollbox orientation @@ -390,7 +390,7 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child) scrollableView->GetScrollPosition(cp.x,cp.y); nsIntRect prect; GetOffsetRect(prect); - crect = nsIntRect::ToAppUnits(prect, nsPresContext::AppUnitsPerCSSPixel()); + crect = prect.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()); nscoord newx=cp.x, newy=cp.y; diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index f06ac8ba4fe8..b31b13b6b905 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -648,7 +648,7 @@ nsTreeBodyFrame::GetSelectionRegion(nsIScriptableRegion **aRegion) region->Init(); nsRefPtr presContext = PresContext(); - nsIntRect rect = nsRect::ToOutsidePixels(mRect, presContext->AppUnitsPerCSSPixel()); + nsIntRect rect = mRect.ToOutsidePixels(presContext->AppUnitsPerCSSPixel()); nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame(); nsPoint origin = GetOffsetTo(rootFrame); diff --git a/view/src/nsScrollPortView.cpp b/view/src/nsScrollPortView.cpp index 4faa8970d3ce..9875a757270c 100644 --- a/view/src/nsScrollPortView.cpp +++ b/view/src/nsScrollPortView.cpp @@ -578,8 +578,8 @@ void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsIntP } } toScrollPtr = &toScroll; - toScroll = nsRect::ToInsidePixels(biggestRect, aP2A); - biggestRect = nsIntRect::ToAppUnits(toScroll, aP2A); + toScroll = biggestRect.ToInsidePixels(aP2A); + biggestRect = toScroll.ToAppUnits(aP2A); regionToScroll.Sub(regionToScroll, biggestRect); updateRegion.Or(updateRegion, regionToScroll); } diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index 2bc45cfcf9c5..9142b151993c 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -379,7 +379,7 @@ nsIntRect nsView::CalcWidgetBounds(nsWindowType aType) } } - nsIntRect newBounds = nsRect::ToNearestPixels(viewBounds, p2a); + nsIntRect newBounds = viewBounds.ToNearestPixels(p2a); nsPoint roundedOffset(NSIntPixelsToAppUnits(newBounds.x, p2a), NSIntPixelsToAppUnits(newBounds.y, p2a)); @@ -759,9 +759,9 @@ void nsIView::List(FILE* out, PRInt32 aIndent) const NS_RELEASE(dx); nsIntRect rect; mWindow->GetClientBounds(rect); - nsRect windowBounds = nsIntRect::ToAppUnits(rect, p2a); + nsRect windowBounds = rect.ToAppUnits(p2a); mWindow->GetBounds(rect); - nsRect nonclientBounds = nsIntRect::ToAppUnits(rect, p2a); + nsRect nonclientBounds = rect.ToAppUnits(p2a); nsrefcnt widgetRefCnt = mWindow->AddRef() - 1; mWindow->Release(); PRInt32 Z; diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 61bf2e3181ff..5252dd3508ef 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -1113,7 +1113,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS region->GetBoundingBox(&damIntRect.x, &damIntRect.y, &damIntRect.width, &damIntRect.height); nsRect damRect = - nsIntRect::ToAppUnits(damIntRect, mContext->AppUnitsPerDevPixel()); + damIntRect.ToAppUnits(mContext->AppUnitsPerDevPixel()); nsIWidget* widget = view->GetNearestWidget(nsnull); if (widget && widget->GetTransparencyMode() == eTransparencyOpaque) { @@ -2015,7 +2015,7 @@ nsIntRect nsViewManager::ViewToWidget(nsView *aView, nsView* aWidgetView, const rect += aView->ViewToWidgetOffset(); // finally, convert to device coordinates. - return nsRect::ToOutsidePixels(rect, mContext->AppUnitsPerDevPixel()); + return rect.ToOutsidePixels(mContext->AppUnitsPerDevPixel()); } nsresult nsViewManager::GetVisibleRect(nsRect& aVisibleRect) diff --git a/widget/src/xpwidgets/nsBaseDragService.cpp b/widget/src/xpwidgets/nsBaseDragService.cpp index c7c0dc77a0e3..7884510e97a1 100644 --- a/widget/src/xpwidgets/nsBaseDragService.cpp +++ b/widget/src/xpwidgets/nsBaseDragService.cpp @@ -450,9 +450,8 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode, if (rootFrame && *aPresContext) { nsIntRect dragRect; aRegion->GetBoundingBox(&dragRect.x, &dragRect.y, &dragRect.width, &dragRect.height); - dragRect = nsRect::ToOutsidePixels(nsIntRect::ToAppUnits(dragRect, - nsPresContext::AppUnitsPerCSSPixel()), - (*aPresContext)->AppUnitsPerDevPixel()); + dragRect = dragRect.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()). + ToOutsidePixels((*aPresContext)->AppUnitsPerDevPixel()); nsIntRect screenRect = rootFrame->GetScreenRectExternal(); aScreenDragRect->SetRect(screenRect.x + dragRect.x, screenRect.y + dragRect.y,