Remove duplication of code between implementations of nsILookAndFeel and nsIDeviceContext by removing system color and metric implementations from nsIDeviceContext implementations and changing nsIDeviceContext::GetSystemAttribute to nsIDeviceContext::GetSystemFont. b=96971 r=bryner sr=waterson

git-svn-id: svn://10.0.0.236/trunk@104391 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu
2001-10-02 03:10:56 +00:00
parent 14547cec57
commit f19aafd138
34 changed files with 448 additions and 1034 deletions

View File

@@ -1352,19 +1352,16 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIDeviceContext> dx;
aPresContext->GetDeviceContext(getter_AddRefs(dx));
if (dx) {
// Get the width in Device pixels (in this case screen)
SystemAttrStruct info;
dx->GetSystemAttribute(eSystemAttr_Size_ScrollbarWidth, &info);
// Get the pixels to twips conversion for the current device (screen or printer)
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
float w, h;
// Get the width in Device pixels times p2t
dx->GetScrollBarDimensions(w, h);
// Get the scale factor for mapping from one device (screen)
// to another device (screen or printer)
// Typically when it is a screen the scale 1.0
// when it is a printer is could be anything
float scale;
dx->GetCanonicalPixelScale(scale);
mCachedScrollbarWidth = NSIntPixelsToTwips(info.mSize, p2t*scale);
mCachedScrollbarWidth = NSToCoordRound(w * scale);
}
}