Guarantee that the pres context's device context will be non-null by returning failure from Init() if it's null. Rename inline getter GetDeviceContext() to DeviceContext(), convert all callers to use the inline getter, and remove the virtual/refcounting getter. Bug 229371, r+sr=dbaron.

git-svn-id: svn://10.0.0.236/trunk@152182 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%brianryner.com
2004-02-02 22:17:21 +00:00
parent 1933a43e01
commit 5b5cd321a4
42 changed files with 544 additions and 750 deletions

View File

@@ -146,11 +146,8 @@ nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext,
const nsFont * font = nsnull;
// Get frame font
if (NS_SUCCEEDED(aFrame->GetFont(aPresContext, font))) {
nsCOMPtr<nsIDeviceContext> deviceContext;
aPresContext->GetDeviceContext(getter_AddRefs(deviceContext));
NS_ASSERTION(deviceContext, "Couldn't get the device context");
if (font != nsnull) { // Get font metrics
return deviceContext->GetMetricsFor(*font, *aFontMet);
if (font) { // Get font metrics
return aPresContext->DeviceContext()->GetMetricsFor(*font, *aFontMet);
}
}
return NS_ERROR_FAILURE;