Bug 489485. nsRect::ToNearest/Inner/OuterPixels should be nonstatic. r+sr=roc

--HG--
extra : rebase_source : 13778709270ab926e951a7782fce3632370ef7c7
This commit is contained in:
Ryo Onodera 2009-05-08 14:31:04 +12:00
parent 1bc6593cf3
commit dff270d1be
20 changed files with 65 additions and 68 deletions

View File

@ -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());

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -5407,7 +5407,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* 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();

View File

@ -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

View File

@ -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<nsIPluginWidget> 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

View File

@ -680,7 +680,7 @@ nsSVGForeignObjectFrame::InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter,
nsCOMPtr<nsIDOMSVGMatrix> 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);

View File

@ -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<nsIDOMSVGMatrix> 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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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),

View File

@ -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;

View File

@ -648,7 +648,7 @@ nsTreeBodyFrame::GetSelectionRegion(nsIScriptableRegion **aRegion)
region->Init();
nsRefPtr<nsPresContext> presContext = PresContext();
nsIntRect rect = nsRect::ToOutsidePixels(mRect, presContext->AppUnitsPerCSSPixel());
nsIntRect rect = mRect.ToOutsidePixels(presContext->AppUnitsPerCSSPixel());
nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame();
nsPoint origin = GetOffsetTo(rootFrame);

View File

@ -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);
}

View File

@ -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;

View File

@ -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)

View File

@ -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,