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

@@ -805,11 +805,8 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext,
{
//printf("*****************\n");
const nsStyleFont* dspFont = mDisplayFrame->GetStyleFont();
nsCOMPtr<nsIDeviceContext> deviceContext;
aPresContext->GetDeviceContext(getter_AddRefs(deviceContext));
NS_ASSERTION(deviceContext, "Couldn't get the device context");
nsIFontMetrics * fontMet;
deviceContext->GetMetricsFor(dspFont->mFont, fontMet);
aPresContext->DeviceContext()->GetMetricsFor(dspFont->mFont, fontMet);
nscoord visibleHeight;
//nsCOMPtr<nsIFontMetrics> fontMet;
@@ -1242,15 +1239,10 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
// the default size of the of scrollbar
// that will be the default width of the dropdown button
// the height will be the height of the text
nscoord scrollbarWidth = 0;
nsCOMPtr<nsIDeviceContext> dx;
aPresContext->GetDeviceContext(getter_AddRefs(dx));
if (dx) {
float w, h;
// Get the width in Device pixels times p2t
dx->GetScrollBarDimensions(w, h);
scrollbarWidth = NSToCoordRound(w);
}
float w, h;
// Get the width in Device pixels times p2t
aPresContext->DeviceContext()->GetScrollBarDimensions(w, h);
nscoord scrollbarWidth = NSToCoordRound(w);
// set up a new reflow state for use throughout
nsHTMLReflowState firstPassState(aReflowState);