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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user