diff --git a/calendar/modules/ui/canvas/src/nsCalCommandCanvas.cpp b/calendar/modules/ui/canvas/src/nsCalCommandCanvas.cpp index 8e80e707bb8..5aba0da44fe 100644 --- a/calendar/modules/ui/canvas/src/nsCalCommandCanvas.cpp +++ b/calendar/modules/ui/canvas/src/nsCalCommandCanvas.cpp @@ -133,7 +133,13 @@ nsresult nsCalCommandCanvas :: Init() nscoord width ; - fm->GetWidth(text,width); + nsIRenderingContext * aRC; + + ctx->CreateRenderingContext(mStaticTextField, aRC); + + aRC->GetWidth(text,width); + + NS_RELEASE(aRC); rect.width = width ; @@ -231,9 +237,14 @@ nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds) ctx->GetMetricsFor(font,fm); - NS_RELEASE(ctx); + nsIRenderingContext * aRC; - fm->GetWidth(text,width); + ctx->CreateRenderingContext(mStaticTextField, aRC); + + aRC->GetWidth(text,width); + + NS_RELEASE(aRC); + NS_RELEASE(ctx); rect.width = width ; diff --git a/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp b/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp index 3d523e46d02..3150f9e861a 100644 --- a/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp +++ b/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp @@ -432,7 +432,7 @@ nsEventStatus nsCalMonthViewCanvas :: PaintCellBackground( PRUint32& aCellRow, P nscoord text_width ; aRenderingContext.GetFontMetrics()->GetHeight(text_height); - aRenderingContext.GetFontMetrics()->GetWidth(strDate, text_width); + aRenderingContext.GetWidth(strDate, text_width); x = x + w - text_width; y = y + h - text_height; diff --git a/calendar/modules/ui/canvas/src/nsCalTimebarScale.cpp b/calendar/modules/ui/canvas/src/nsCalTimebarScale.cpp index 79d636f73a4..109d233e24f 100644 --- a/calendar/modules/ui/canvas/src/nsCalTimebarScale.cpp +++ b/calendar/modules/ui/canvas/src/nsCalTimebarScale.cpp @@ -196,7 +196,7 @@ nsresult nsCalTimebarScale :: DrawTime(nsIRenderingContext& aContext, */ aContext.GetFontMetrics()->GetHeight(height); - aContext.GetFontMetrics()->GetWidth(text,width); + aContext.GetWidth(text,width); /* * center the text in our rect and draw it diff --git a/calendar/modules/ui/canvas/src/nsCalTimebarTimeHeading.cpp b/calendar/modules/ui/canvas/src/nsCalTimebarTimeHeading.cpp index 19686ddc242..370ab435d71 100644 --- a/calendar/modules/ui/canvas/src/nsCalTimebarTimeHeading.cpp +++ b/calendar/modules/ui/canvas/src/nsCalTimebarTimeHeading.cpp @@ -94,7 +94,7 @@ nsEventStatus nsCalTimebarTimeHeading :: PaintForeground(nsIRenderingContext& aR */ aRenderingContext.GetFontMetrics()->GetHeight(height); - aRenderingContext.GetFontMetrics()->GetWidth(*string,width); + aRenderingContext.GetWidth(*string,width); /* * XXX: If we are too big, remove the Day of the week. Need a better algorithm @@ -105,7 +105,7 @@ nsEventStatus nsCalTimebarTimeHeading :: PaintForeground(nsIRenderingContext& aR { pattern = "MMM dd\n"; GetTimeContext()->GetDTFirstVisible()->strftime(pattern, &string); - aRenderingContext.GetFontMetrics()->GetWidth(*string,width); + aRenderingContext.GetWidth(*string,width); } /* diff --git a/calendar/modules/ui/canvas/src/nsCalTimebarUserHeading.cpp b/calendar/modules/ui/canvas/src/nsCalTimebarUserHeading.cpp index 2747252acec..02facae0a5b 100644 --- a/calendar/modules/ui/canvas/src/nsCalTimebarUserHeading.cpp +++ b/calendar/modules/ui/canvas/src/nsCalTimebarUserHeading.cpp @@ -89,7 +89,7 @@ nsEventStatus nsCalTimebarUserHeading :: PaintForeground(nsIRenderingContext& aR */ aRenderingContext.GetFontMetrics()->GetHeight(height); - aRenderingContext.GetFontMetrics()->GetWidth(mUserName,width); + aRenderingContext.GetWidth(mUserName,width); /* * center the text in our rect and draw it diff --git a/calendar/modules/ui/controller/src/nsCalMonthContextController.cpp b/calendar/modules/ui/controller/src/nsCalMonthContextController.cpp index 14b6ef8c355..45597c90f10 100644 --- a/calendar/modules/ui/controller/src/nsCalMonthContextController.cpp +++ b/calendar/modules/ui/controller/src/nsCalMonthContextController.cpp @@ -1675,7 +1675,7 @@ void nsCalMonthContextController::GetTextExtent(char *p, int iChars, int& iWidth fm = mRenderingContext->GetFontMetrics(); - fm->GetWidth(p,(nscoord)iWidth); + mRenderingContext->GetWidth(p,(nscoord)iWidth); fm->GetHeight((nscoord)iHeight); } @@ -1731,7 +1731,7 @@ void nsCalMonthContextController::GetFontInfo( nsIFontMetrics * fm = ctx->GetFontMetrics(); - fm->GetWidth("0",m_iDigitWidth); + ctx->GetWidth("0",m_iDigitWidth); fm->GetHeight(m_iDigitHeight); /* @@ -1742,7 +1742,7 @@ void nsCalMonthContextController::GetFontInfo( strcpy(sBuf,"Wednesday"); sBuf[GetDOWColHdrChars() ] = 0; - fm->GetWidth(sBuf,m_iMaxDOWColHdrWidth); + ctx->GetWidth(sBuf,m_iMaxDOWColHdrWidth); } diff --git a/xpfc/canvas/src/nsXPFCCanvas.cpp b/xpfc/canvas/src/nsXPFCCanvas.cpp index 2007fdfb13a..fa190e62738 100644 --- a/xpfc/canvas/src/nsXPFCCanvas.cpp +++ b/xpfc/canvas/src/nsXPFCCanvas.cpp @@ -387,7 +387,7 @@ nsresult nsXPFCCanvas :: CreateImageGroup() gXPFCToolkit->GetViewManager()->GetDeviceContext(deviceCtx); - mImageGroup->Init(deviceCtx); + mImageGroup->Init(deviceCtx,nsnull); NS_IF_RELEASE(deviceCtx); } diff --git a/xpfc/widget/src/nsXPButton.cpp b/xpfc/widget/src/nsXPButton.cpp index 7374eac73c7..c47c0906708 100644 --- a/xpfc/widget/src/nsXPButton.cpp +++ b/xpfc/widget/src/nsXPButton.cpp @@ -270,7 +270,7 @@ nsEventStatus nsXPButton :: PaintForeground(nsIRenderingContext& aRenderingConte */ aRenderingContext.GetFontMetrics()->GetHeight(string_height); - aRenderingContext.GetFontMetrics()->GetWidth(string,string_width); + aRenderingContext.GetWidth(string,string_width); switch(mVerticalJustification) { diff --git a/xpfc/widget/src/nsXPItem.cpp b/xpfc/widget/src/nsXPItem.cpp index f1ca47c9b7b..898bb0b34d1 100644 --- a/xpfc/widget/src/nsXPItem.cpp +++ b/xpfc/widget/src/nsXPItem.cpp @@ -253,7 +253,7 @@ nsEventStatus nsXPItem :: PaintForeground(nsIRenderingContext& aRenderingContext */ aRenderingContext.GetFontMetrics()->GetHeight(string_height); - aRenderingContext.GetFontMetrics()->GetWidth(string,string_width); + aRenderingContext.GetWidth(string,string_width); switch(mVerticalJustification) {