diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 85ce19dc707..5316c36c620 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -563,8 +563,12 @@ nsWebShell::Init(nsNativeWidget aNativeParent, goto done; } mDeviceContext->Init(aNativeParent); - mDeviceContext->SetDevUnitsToAppUnits(mDeviceContext->GetDevUnitsToTwips()); - mDeviceContext->SetAppUnitsToDevUnits(mDeviceContext->GetTwipsToDevUnits()); + float dev2twip; + mDeviceContext->GetDevUnitsToTwips(dev2twip); + mDeviceContext->SetDevUnitsToAppUnits(dev2twip); + float twip2dev; + mDeviceContext->GetTwipsToDevUnits(twip2dev); + mDeviceContext->SetAppUnitsToDevUnits(twip2dev); // mDeviceContext->SetGamma(1.7f); mDeviceContext->SetGamma(1.0f); diff --git a/mozilla/gfx/src/motif/nsDeviceContextUnix.cpp b/mozilla/gfx/src/motif/nsDeviceContextUnix.cpp index 6e635e8d473..7136b2a7479 100644 --- a/mozilla/gfx/src/motif/nsDeviceContextUnix.cpp +++ b/mozilla/gfx/src/motif/nsDeviceContextUnix.cpp @@ -66,7 +66,7 @@ NS_IMPL_QUERY_INTERFACE(nsDeviceContextUnix, kDeviceContextIID) NS_IMPL_ADDREF(nsDeviceContextUnix) NS_IMPL_RELEASE(nsDeviceContextUnix) -nsresult nsDeviceContextUnix :: Init(nsNativeWidget aNativeWidget) +NS_IMETHODIMP nsDeviceContextUnix :: Init(nsNativeWidget aNativeWidget) { NS_ASSERTION(!(aNativeWidget == nsnull), "attempt to init devicecontext with null widget"); @@ -91,16 +91,18 @@ nsresult nsDeviceContextUnix :: Init(nsNativeWidget aNativeWidget) } -float nsDeviceContextUnix :: GetScrollBarWidth() const +NS_IMETHODIMP nsDeviceContextUnix :: GetScrollBarWidth(float &aWidth) const { // XXX Should we push this to widget library - return 240.0; + aWidth = 240.0; + return NS_OK; } -float nsDeviceContextUnix :: GetScrollBarHeight() const +NS_IMETHODIMP nsDeviceContextUnix :: GetScrollBarHeight(float &aHeight) const { // XXX Should we push this to widget library - return 240.0; + aHeight = 240.0; + return NS_OK; } diff --git a/mozilla/gfx/src/motif/nsDeviceContextUnix.h b/mozilla/gfx/src/motif/nsDeviceContextUnix.h index 333e4a1db52..e81861ab09b 100644 --- a/mozilla/gfx/src/motif/nsDeviceContextUnix.h +++ b/mozilla/gfx/src/motif/nsDeviceContextUnix.h @@ -65,10 +65,10 @@ public: // NS_IMETHOD CreateILColorSpace(IL_ColorSpace*& aColorSpace); - virtual nsresult Init(nsNativeWidget aNativeWidget); + NS_IMETHOD Init(nsNativeWidget aNativeWidget); - virtual float GetScrollBarWidth() const; - virtual float GetScrollBarHeight() const; + NS_IMETHOD GetScrollBarWidth(float &aWidth) const; + NS_IMETHOD GetScrollBarHeight(float &aHeight) const; virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext); diff --git a/mozilla/gfx/src/nsDeviceContext.cpp b/mozilla/gfx/src/nsDeviceContext.cpp index a0754a151c7..63a65cc647f 100644 --- a/mozilla/gfx/src/nsDeviceContext.cpp +++ b/mozilla/gfx/src/nsDeviceContext.cpp @@ -83,7 +83,7 @@ DeviceContextImpl :: ~DeviceContextImpl() } } -nsresult DeviceContextImpl :: Init(nsNativeWidget aWidget) +NS_IMETHODIMP DeviceContextImpl :: Init(nsNativeWidget aWidget) { for (PRInt32 cnt = 0; cnt < 256; cnt++) mGammaTable[cnt] = cnt; @@ -93,14 +93,16 @@ nsresult DeviceContextImpl :: Init(nsNativeWidget aWidget) return NS_OK; } -float DeviceContextImpl :: GetTwipsToDevUnits() const +NS_IMETHODIMP DeviceContextImpl :: GetTwipsToDevUnits(float &aTwipsToDevUnits) const { - return mTwipsToPixels; + aTwipsToDevUnits = mTwipsToPixels; + return NS_OK; } -float DeviceContextImpl :: GetDevUnitsToTwips() const +NS_IMETHODIMP DeviceContextImpl :: GetDevUnitsToTwips(float &aDevUnitsToTwips) const { - return mPixelsToTwips; + aDevUnitsToTwips = mPixelsToTwips; + return NS_OK; } void DeviceContextImpl :: SetAppUnitsToDevUnits(float aAppUnits) @@ -123,15 +125,16 @@ float DeviceContextImpl :: GetDevUnitsToAppUnits() const return mDevUnitsToAppUnits; } -nsIRenderingContext * DeviceContextImpl :: CreateRenderingContext(nsIView *aView) +NS_IMETHODIMP DeviceContextImpl :: CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext) { - nsIRenderingContext *pContext = nsnull; + nsIRenderingContext *pContext; nsIWidget *win = aView->GetWidget(); - nsresult rv; + nsresult rv; static NS_DEFINE_IID(kRCCID, NS_RENDERING_CONTEXT_CID); static NS_DEFINE_IID(kRCIID, NS_IRENDERING_CONTEXT_IID); + aContext = nsnull; rv = NSRepository::CreateInstance(kRCCID, nsnull, kRCIID, (void **)&pContext); if (NS_OK == rv) { @@ -142,10 +145,11 @@ nsIRenderingContext * DeviceContextImpl :: CreateRenderingContext(nsIView *aView } NS_IF_RELEASE(win); - return pContext; + aContext = pContext; + return rv; } -nsresult DeviceContextImpl :: InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWin) +NS_IMETHODIMP DeviceContextImpl :: InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWin) { return (aContext->Init(this, aWin)); } diff --git a/mozilla/gfx/src/nsDeviceContext.h b/mozilla/gfx/src/nsDeviceContext.h index d217992124c..455e908679b 100644 --- a/mozilla/gfx/src/nsDeviceContext.h +++ b/mozilla/gfx/src/nsDeviceContext.h @@ -32,13 +32,13 @@ public: NS_DECL_ISUPPORTS - virtual nsresult Init(nsNativeWidget aWidget); + NS_IMETHOD Init(nsNativeWidget aWidget); - virtual nsIRenderingContext * CreateRenderingContext(nsIView *aView); - virtual nsresult InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow); + NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext); + NS_IMETHOD InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow); - virtual float GetDevUnitsToTwips() const; - virtual float GetTwipsToDevUnits() const; + NS_IMETHOD GetDevUnitsToTwips(float &aDevUnitsToTwips) const; + NS_IMETHOD GetTwipsToDevUnits(float &aTwipsToDevUnits) const; virtual void SetAppUnitsToDevUnits(float aAppUnits); virtual void SetDevUnitsToAppUnits(float aDevUnits); diff --git a/mozilla/gfx/src/nsIDeviceContext.h b/mozilla/gfx/src/nsIDeviceContext.h index a8207c20058..34dcdf7e10c 100644 --- a/mozilla/gfx/src/nsIDeviceContext.h +++ b/mozilla/gfx/src/nsIDeviceContext.h @@ -66,15 +66,15 @@ typedef NI_ColorSpace IL_ColorSpace; class nsIDeviceContext : public nsISupports { public: - virtual nsresult Init(nsNativeWidget aWidget) = 0; + NS_IMETHOD Init(nsNativeWidget aWidget) = 0; - virtual nsIRenderingContext * CreateRenderingContext(nsIView *aView) = 0; - virtual nsresult InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow) = 0; + NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext) = 0; + NS_IMETHOD InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow) = 0; //these are queries to figure out how large an output unit //(i.e. pixel) is in terms of twips (1/20 of a point) - virtual float GetDevUnitsToTwips() const = 0; - virtual float GetTwipsToDevUnits() const = 0; + NS_IMETHOD GetDevUnitsToTwips(float &aDevUnitsToTwips) const = 0; + NS_IMETHOD GetTwipsToDevUnits(float &aTwipsToDevUnits) const = 0; //these are set by the object that created this //device context to define what the scale is @@ -88,8 +88,8 @@ public: virtual float GetAppUnitsToDevUnits() const = 0; virtual float GetDevUnitsToAppUnits() const = 0; - virtual float GetScrollBarWidth() const = 0; - virtual float GetScrollBarHeight() const = 0; + NS_IMETHOD GetScrollBarWidth(float &aWidth) const = 0; + NS_IMETHOD GetScrollBarHeight(float &aHeight) const = 0; //be sure to Relase() after you are done with the Get() virtual nsIFontCache * GetFontCache() = 0; diff --git a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp index 72341fa87e1..6465118b9c8 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp +++ b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp @@ -52,7 +52,7 @@ nsDeviceContextWin :: ~nsDeviceContextWin() } } -nsresult nsDeviceContextWin::Init(nsNativeWidget aWidget) +NS_IMETHODIMP nsDeviceContextWin::Init(nsNativeWidget aWidget) { HWND hwnd = (HWND)aWidget; HDC hdc = ::GetDC(hwnd); @@ -67,14 +67,16 @@ nsresult nsDeviceContextWin::Init(nsNativeWidget aWidget) return DeviceContextImpl::Init(aWidget); } -float nsDeviceContextWin :: GetScrollBarWidth() const +NS_IMETHODIMP nsDeviceContextWin :: GetScrollBarWidth(float &aWidth) const { - return ::GetSystemMetrics(SM_CXVSCROLL) * mDevUnitsToAppUnits; + aWidth = ::GetSystemMetrics(SM_CXVSCROLL) * mDevUnitsToAppUnits; + return NS_OK; } -float nsDeviceContextWin :: GetScrollBarHeight() const +NS_IMETHODIMP nsDeviceContextWin :: GetScrollBarHeight(float &aHeight) const { - return ::GetSystemMetrics(SM_CXHSCROLL) * mDevUnitsToAppUnits; + aHeight = ::GetSystemMetrics(SM_CXHSCROLL) * mDevUnitsToAppUnits; + return NS_OK; } nsDrawingSurface nsDeviceContextWin :: GetDrawingSurface(nsIRenderingContext &aContext) diff --git a/mozilla/gfx/src/windows/nsDeviceContextWin.h b/mozilla/gfx/src/windows/nsDeviceContextWin.h index bba73d8856f..0a6ee3b8819 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextWin.h +++ b/mozilla/gfx/src/windows/nsDeviceContextWin.h @@ -27,10 +27,10 @@ class nsDeviceContextWin : public DeviceContextImpl public: nsDeviceContextWin(); - virtual nsresult Init(nsNativeWidget aWidget); + NS_IMETHOD Init(nsNativeWidget aWidget); - virtual float GetScrollBarWidth() const; - virtual float GetScrollBarHeight() const; + NS_IMETHOD GetScrollBarWidth(float &aWidth) const; + NS_IMETHOD GetScrollBarHeight(float &aHeight) const; //get a low level drawing surface for rendering. the rendering context //that is passed in is used to create the drawing surface if there isn't diff --git a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp index 121b322b011..6002df4d5a8 100644 --- a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp +++ b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp @@ -175,7 +175,9 @@ void nsFontMetricsWin::RealizeFont(nsIDeviceContext *aContext) logFont.lfItalic = (mFont->style & NS_FONT_STYLE_ITALIC) ? TRUE : FALSE; float app2dev = aContext->GetAppUnitsToDevUnits(); - float app2twip = app2dev * aContext->GetDevUnitsToTwips(); + float app2twip; + aContext->GetDevUnitsToTwips(app2twip); + app2twip *= app2dev; float rounded = ((float)NSIntPointsToTwips(NSTwipsToFloorIntPoints(nscoord(mFont->size * app2twip)))) / app2twip; // round font size off to floor point size to be windows compatible @@ -280,11 +282,13 @@ nscoord nsFontMetricsWin :: GetWidth(nsIDeviceContext *aContext, const nsString& float app2dev = aContext->GetAppUnitsToDevUnits(); - float app2twip = app2dev * aContext->GetDevUnitsToTwips(); + float dev2twip; + aContext->GetDevUnitsToTwips(dev2twip); + float app2twip = dev2twip * app2dev; //printf("[%s] %d %d = %d\n", str, size.cx, nscoord(((float)size.cx)*aContext->GetDevUnitsToTwips()), GetWidth(str)); delete[] str; - return nscoord(((float)size.cx)*aContext->GetDevUnitsToTwips()); + return nscoord(float(size.cx) * dev2twip); } nscoord nsFontMetricsWin :: GetWidth(const PRUnichar *aString, PRUint32 aLength) diff --git a/mozilla/layout/base/src/nsPrintPreviewContext.cpp b/mozilla/layout/base/src/nsPrintPreviewContext.cpp index 0ed1467b0d5..74a59856b2b 100644 --- a/mozilla/layout/base/src/nsPrintPreviewContext.cpp +++ b/mozilla/layout/base/src/nsPrintPreviewContext.cpp @@ -55,7 +55,9 @@ nscoord PrintPreviewContext::GetPageWidth() #else // For testing purposes make the page width smaller than the visible // area - nscoord sbar = NSToCoordRound(mDeviceContext->GetScrollBarWidth()); + float sbWidth; + mDeviceContext->GetScrollBarWidth(sbWidth); + nscoord sbar = NSToCoordRound(sbWidth); return mVisibleArea.width - sbar - 2*100; #endif } diff --git a/mozilla/layout/html/base/src/nsBodyFrame.cpp b/mozilla/layout/html/base/src/nsBodyFrame.cpp index 6cf60b36dde..9e80c5f5548 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.cpp +++ b/mozilla/layout/html/base/src/nsBodyFrame.cpp @@ -498,7 +498,10 @@ nsSize nsBodyFrame::GetColumnAvailSpace(nsIPresContext* aPresContext, aBorderPadding.right; if (! aPresContext->IsPaginated()) { nsIDeviceContext* dc = aPresContext->GetDeviceContext(); - result.width -= NSToCoordRound(dc->GetScrollBarWidth()); + float sbWidth; + + dc->GetScrollBarWidth(sbWidth); + result.width -= NSToCoordRound(sbWidth); NS_RELEASE(dc); } } diff --git a/mozilla/layout/html/base/src/nsRootPart.cpp b/mozilla/layout/html/base/src/nsRootPart.cpp index addba8127b8..350176f1406 100644 --- a/mozilla/layout/html/base/src/nsRootPart.cpp +++ b/mozilla/layout/html/base/src/nsRootPart.cpp @@ -353,8 +353,10 @@ NS_METHOD RootContentFrame::Reflow(nsIPresContext& aPresContext, nsSize pageSize(aPresContext.GetPageWidth(), aPresContext.GetPageHeight()); nsIDeviceContext *dx = aPresContext.GetDeviceContext(); + float sbWidth; + dx->GetScrollBarWidth(sbWidth); PRInt32 extra = aReflowState.maxSize.width - PAGE_SPACING_TWIPS*2 - - pageSize.width - NSToCoordRound(dx->GetScrollBarWidth()); + pageSize.width - NSToCoordRound(sbWidth); NS_RELEASE(dx); // Note: nscoord is an unsigned type so don't combine these diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index 25c71bfea9c..3a4720dc83d 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -167,8 +167,10 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext, // Place and size the page. If the page is narrower than our // max width then center it horizontally nsIDeviceContext *dx = aPresContext.GetDeviceContext(); + float sbWidth; + dx->GetScrollBarWidth(sbWidth); nscoord extra = aReflowState.maxSize.width - kidSize.width - - NSToCoordRound(dx->GetScrollBarWidth()); + NSToCoordRound(sbWidth); NS_RELEASE(dx); nscoord x = extra > 0 ? extra / 2 : 0; @@ -378,8 +380,9 @@ nsScrollInnerFrame::Reflow(nsIPresContext& aPresContext, // scroll bar width), and as high as it wants to be. nsSize maxSize; nsIDeviceContext* dc = aPresContext.GetDeviceContext(); - maxSize.width = aReflowState.maxSize.width - - NSToCoordRound(dc->GetScrollBarWidth()); + float sbWidth; + dc->GetScrollBarWidth(sbWidth); + maxSize.width = aReflowState.maxSize.width - NSToCoordRound(sbWidth); NS_RELEASE(dc); maxSize.height = NS_UNCONSTRAINEDSIZE; diff --git a/mozilla/view/src/nsScrollingView.cpp b/mozilla/view/src/nsScrollingView.cpp index 5de22c3ac61..c1fc286c1c4 100644 --- a/mozilla/view/src/nsScrollingView.cpp +++ b/mozilla/view/src/nsScrollingView.cpp @@ -406,10 +406,13 @@ nsresult nsScrollingView :: Init(nsIViewManager* aManager, if (nsnull != mCornerView) { nsRect trect; + float sbWidth, sbHeight; - trect.width = NSToCoordRound(dx->GetScrollBarWidth()); + dx->GetScrollBarWidth(sbWidth); + dx->GetScrollBarHeight(sbHeight); + trect.width = NSToCoordRound(sbWidth); trect.x = aBounds.x + aBounds.XMost() - trect.width; - trect.height = NSToCoordRound(dx->GetScrollBarHeight()); + trect.height = NSToCoordRound(sbHeight); trect.y = aBounds.y + aBounds.YMost() - trect.height; rv = mCornerView->Init(mViewManager, trect, this, nsnull, nsnull, nsnull, -1, nsnull, 1.0f, nsViewVisibility_kHide); @@ -423,11 +426,14 @@ nsresult nsScrollingView :: Init(nsIViewManager* aManager, if (nsnull != mVScrollBarView) { - nsRect trect = aBounds; + nsRect trect = aBounds; + float sbWidth, sbHeight; - trect.width = NSToCoordRound(dx->GetScrollBarWidth()); + dx->GetScrollBarWidth(sbWidth); + dx->GetScrollBarHeight(sbHeight); + trect.width = NSToCoordRound(sbWidth); trect.x += aBounds.XMost() - trect.width; - trect.height -= NSToCoordRound(dx->GetScrollBarHeight()); + trect.height -= NSToCoordRound(sbHeight); static NS_DEFINE_IID(kCScrollbarIID, NS_VERTSCROLLBAR_CID); @@ -442,11 +448,14 @@ nsresult nsScrollingView :: Init(nsIViewManager* aManager, if (nsnull != mHScrollBarView) { - nsRect trect = aBounds; + nsRect trect = aBounds; + float sbWidth, sbHeight; - trect.height = NSToCoordRound(dx->GetScrollBarHeight()); + dx->GetScrollBarWidth(sbWidth); + dx->GetScrollBarHeight(sbHeight); + trect.height = NSToCoordRound(sbHeight); trect.y += aBounds.YMost() - trect.height; - trect.width -= NSToCoordRound(dx->GetScrollBarWidth()); + trect.width -= NSToCoordRound(sbWidth); static NS_DEFINE_IID(kCHScrollbarIID, NS_HORZSCROLLBAR_CID); @@ -468,8 +477,11 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPai nsIPresContext *cx = mViewManager->GetPresContext(); nsIDeviceContext *dx = cx->GetDeviceContext(); nscoord showHorz = 0, showVert = 0; - nscoord scrollWidth = NSToCoordRound(dx->GetScrollBarWidth()); - nscoord scrollHeight = NSToCoordRound(dx->GetScrollBarHeight()); + float scrollWidthFloat, scrollHeightFloat; + dx->GetScrollBarWidth(scrollWidthFloat); + dx->GetScrollBarHeight(scrollHeightFloat); + nscoord scrollWidth = NSToCoordRound(scrollWidthFloat); + nscoord scrollHeight = NSToCoordRound(scrollHeightFloat); if (nsnull != mCornerView) { diff --git a/mozilla/view/src/nsViewManager.cpp b/mozilla/view/src/nsViewManager.cpp index 70128a04a2c..037d1c25fc7 100644 --- a/mozilla/view/src/nsViewManager.cpp +++ b/mozilla/view/src/nsViewManager.cpp @@ -1115,7 +1115,7 @@ nsIRenderingContext * nsViewManager :: CreateRenderingContext(nsIView &aView) if (nsnull != win) { dx = mContext->GetDeviceContext(); - cx = dx->CreateRenderingContext(&aView); + dx->CreateRenderingContext(&aView, cx); if (nsnull != cx) cx->Translate(ax, ay); diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index 85ce19dc707..5316c36c620 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -563,8 +563,12 @@ nsWebShell::Init(nsNativeWidget aNativeParent, goto done; } mDeviceContext->Init(aNativeParent); - mDeviceContext->SetDevUnitsToAppUnits(mDeviceContext->GetDevUnitsToTwips()); - mDeviceContext->SetAppUnitsToDevUnits(mDeviceContext->GetTwipsToDevUnits()); + float dev2twip; + mDeviceContext->GetDevUnitsToTwips(dev2twip); + mDeviceContext->SetDevUnitsToAppUnits(dev2twip); + float twip2dev; + mDeviceContext->GetTwipsToDevUnits(twip2dev); + mDeviceContext->SetAppUnitsToDevUnits(twip2dev); // mDeviceContext->SetGamma(1.7f); mDeviceContext->SetGamma(1.0f); diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index ee306b762b9..2054fb163f5 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -605,7 +605,8 @@ nsBrowserWindow::CreateToolBar(PRInt32 aWidth) nsresult rv; nsIDeviceContext* dc = mWindow->GetDeviceContext(); - float t2d = dc->GetTwipsToDevUnits(); + float t2d; + dc->GetTwipsToDevUnits(t2d); nsFont font(TOOL_BAR_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL, NS_FONT_WEIGHT_NORMAL, 0, nscoord(t2d * NSIntPointsToTwips(TOOL_BAR_FONT_SIZE))); @@ -671,7 +672,8 @@ nsBrowserWindow::CreateStatusBar(PRInt32 aWidth) nsresult rv; nsIDeviceContext* dc = mWindow->GetDeviceContext(); - float t2d = dc->GetTwipsToDevUnits(); + float t2d; + dc->GetTwipsToDevUnits(t2d); nsFont font(STATUS_BAR_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL, NS_FONT_WEIGHT_NORMAL, 0, nscoord(t2d * NSIntPointsToTwips(STATUS_BAR_FONT_SIZE)));