Remove the GetScrollBarDimensions API from device contexts. Bug 364345, r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@217224 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2006-12-20 02:04:00 +00:00
parent 9332796f42
commit e457732aea
25 changed files with 2 additions and 232 deletions

View File

@@ -174,8 +174,8 @@ const PRUint8 kUseAltDCFor_SURFACE_DIM = 0x08; // Use it for getting the Sur
#endif
#define NS_IDEVICE_CONTEXT_IID \
{ 0xb31ad9ce, 0x40cb, 0x43c4, \
{ 0x90, 0xf8, 0x0f, 0x30, 0x53, 0xf6, 0xb8, 0xea } }
{ 0xb05ae6b9, 0x280c, 0x4b16, \
{ 0xb1, 0x36, 0x86, 0x7c, 0x48, 0xd2, 0x15, 0x54 } }
//a cross platform way of specifying a native palette handle
typedef void * nsPalette;
@@ -361,15 +361,6 @@ public:
*/
NS_IMETHOD SetCanonicalPixelScale(float aScale) = 0;
/**
* Get the width of a vertical scroll bar and the height
* of a horizontal scrollbar in application units.
* @param aWidth out parameter for width
* @param aHeight out parameter for height
* @return error status
*/
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const = 0;
/**
* Fill in an nsFont based on the ID of a system font. This function
* may or may not fill in the size, so the size should be set to a

View File

@@ -155,9 +155,6 @@ NS_IMETHODIMP nsDeviceContextBeOS::Init(nsNativeWidget aNativeWidget)
SetDPI(mDpi);
mScrollbarHeight = PRInt16(B_H_SCROLL_BAR_HEIGHT);
mScrollbarWidth = PRInt16(B_V_SCROLL_BAR_WIDTH);
menu_info info;
get_menu_info(&info);
mMenuFont.SetFamilyAndStyle(info.f_family,info.f_style);
@@ -230,16 +227,6 @@ NS_IMETHODIMP nsDeviceContextBeOS::SupportsNativeWidgets(PRBool &aSupportsWidget
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextBeOS::GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
float scale;
GetCanonicalPixelScale(scale);
aWidth = mScrollbarWidth * mPixelsToTwips * scale;
aHeight = mScrollbarHeight * mPixelsToTwips * scale;
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextBeOS::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
{
nsresult status = NS_OK;

View File

@@ -60,7 +60,6 @@ public:
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
@@ -87,8 +86,6 @@ private:
PRUint32 mDepth;
PRBool mWriteable;
PRUint32 mNumCells;
PRInt16 mScrollbarHeight;
PRInt16 mScrollbarWidth;
BFont mMenuFont;
static nscoord mDpi;

View File

@@ -248,30 +248,6 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
SetDPI(mDpi); // to setup p2t and t2p
}
sb = gtk_vscrollbar_new(NULL);
gtk_widget_ref(sb);
gtk_object_sink(GTK_OBJECT(sb));
#ifdef MOZ_WIDGET_GTK2
gtk_widget_ensure_style(sb);
gtk_widget_queue_resize(sb);
#endif /* MOZ_WIDGET_GTK2 */
gtk_widget_size_request(sb,&req);
mScrollbarWidth = req.width;
gtk_widget_destroy(sb);
gtk_widget_unref(sb);
sb = gtk_hscrollbar_new(NULL);
gtk_widget_ref(sb);
gtk_object_sink(GTK_OBJECT(sb));
#ifdef MOZ_WIDGET_GTK2
gtk_widget_ensure_style(sb);
gtk_widget_queue_resize(sb);
#endif /* MOZ_WIDGET_GTK2 */
gtk_widget_size_request(sb,&req);
mScrollbarHeight = req.height;
gtk_widget_destroy(sb);
gtk_widget_unref(sb);
#ifdef DEBUG
static PRBool once = PR_TRUE;
if (once) {
@@ -376,16 +352,6 @@ NS_IMETHODIMP nsDeviceContextGTK::SupportsNativeWidgets(PRBool &aSupportsWidgets
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextGTK::GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
float scale;
GetCanonicalPixelScale(scale);
aWidth = mScrollbarWidth * mPixelsToTwips * scale;
aHeight = mScrollbarHeight * mPixelsToTwips * scale;
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextGTK::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
{
nsresult status = NS_OK;

View File

@@ -65,7 +65,6 @@ public:
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
@@ -97,8 +96,6 @@ private:
PRUint32 mDepth;
PRBool mWriteable;
PRUint32 mNumCells;
PRInt16 mScrollbarHeight;
PRInt16 mScrollbarWidth;
static nscoord mDpi;
float mWidthFloat;

View File

@@ -187,20 +187,6 @@ NS_IMETHODIMP nsDeviceContextMac :: SupportsNativeWidgets(PRBool &aSupportsWidge
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/9/98 dwc
*/
NS_IMETHODIMP nsDeviceContextMac :: GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
// XXX Should we push this to widget library
float scale;
GetCanonicalPixelScale(scale);
aWidth = 16 * mDevUnitsToAppUnits * scale;
aHeight = 16 * mDevUnitsToAppUnits * scale;
return NS_OK;
}
// helper function to get the system font for a specific script
#define FONTNAME_MAX_UNICHRS sizeof(fontName255) * 2
nsresult

View File

@@ -64,7 +64,6 @@ public:
NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext);
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);

View File

@@ -351,14 +351,6 @@ NS_IMETHODIMP nsDeviceContextOS2 :: SupportsNativeWidgets(PRBool &aSupportsWidge
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextOS2 :: GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
float scale = mCPixelScale;
aWidth = ::WinQuerySysValue( HWND_DESKTOP, SV_CXVSCROLL) * mDevUnitsToAppUnits * scale;
aHeight = ::WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL) * mDevUnitsToAppUnits * scale;
return NS_OK;
}
nscolor GetSysColorInfo(int iSysColor)
{
long lColor = ::WinQuerySysColor( HWND_DESKTOP, iSysColor, 0);

View File

@@ -58,7 +58,6 @@ public:
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);

View File

@@ -205,10 +205,6 @@ void nsDeviceContextPh :: CommonInit( nsNativeDeviceContext aDC ) {
/* Turn off virtual console support... */
mWidthFloat = (float) aWidth;
mHeightFloat = (float) aHeight;
/* Revisit: the scroll bar sizes is a gross guess based on Phab */
mScrollbarHeight = 17;
mScrollbarWidth = 17;
}
NS_IMETHODIMP nsDeviceContextPh :: CreateRenderingContext( nsIRenderingContext *&aContext ) {

View File

@@ -70,17 +70,6 @@ public:
return NS_OK;
}
inline
NS_IMETHODIMP GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
/* Revisit: the scroll bar sizes is a gross guess based on Phab */
float scale;
GetCanonicalPixelScale(scale);
aWidth = mScrollbarWidth * mPixelsToTwips * scale;
aHeight = mScrollbarHeight * mPixelsToTwips * scale;
return NS_OK;
}
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
//get a low level drawing surface for rendering. the rendering context
@@ -133,8 +122,6 @@ protected:
nsIDrawingSurface* mSurface;
PRUint32 mDepth; // bit depth of device
float mPixelScale;
PRInt16 mScrollbarHeight;
PRInt16 mScrollbarWidth;
float mWidthFloat;
float mHeightFloat;

View File

@@ -319,22 +319,6 @@ NS_IMETHODIMP nsDeviceContextPS::PrepareNativeWidget(nsIWidget* aWidget, void **
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/21/98 dwc
*/
NS_IMETHODIMP nsDeviceContextPS::GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
PR_LOG(nsDeviceContextPSLM, PR_LOG_DEBUG, ("nsDeviceContextPS::GetScrollBarDimensions()\n"));
//XXX: Hardcoded values for Postscript
float scale;
GetCanonicalPixelScale(scale);
aWidth = 20.f * scale;
aHeight = 20.f * scale;
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/21/98 dwc

View File

@@ -78,8 +78,6 @@ public:
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD PrepareNativeWidget(nsIWidget* aWidget, void ** aOut);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
NS_IMETHOD GetDepth(PRUint32& aDepth);

View File

@@ -105,17 +105,9 @@ nsDeviceContextQt::~nsDeviceContextQt()
NS_IMETHODIMP nsDeviceContextQt::Init(nsNativeWidget aNativeWidget)
{
PRBool bCleanUp = PR_FALSE;
QWidget *pWidget = nsnull;
mWidget = (QWidget*)aNativeWidget;
if (mWidget != nsnull)
pWidget = mWidget;
else {
pWidget = new QWidget();
bCleanUp = PR_TRUE;
}
nsresult ignore;
nsCOMPtr<nsIScreenManager> sm(do_GetService("@mozilla.org/gfx/screenmanager;1",
&ignore));
@@ -165,13 +157,8 @@ NS_IMETHODIMP nsDeviceContextQt::Init(nsNativeWidget aNativeWidget)
}
#endif
QStyle &style = pWidget->style();
mScrollbarWidth = mScrollbarHeight = style.pixelMetric(QStyle::PM_ScrollBarExtent);
DeviceContextImpl::CommonInit();
if (bCleanUp)
delete pWidget;
return NS_OK;
}
@@ -234,17 +221,6 @@ nsDeviceContextQt::SupportsNativeWidgets(PRBool &aSupportsWidgets)
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextQt::GetScrollBarDimensions(float &aWidth,
float &aHeight) const
{
float scale;
GetCanonicalPixelScale(scale);
aWidth = mScrollbarWidth * mPixelsToTwips * scale;
aHeight = mScrollbarHeight * mPixelsToTwips * scale;
return NS_OK;
}
NS_IMETHODIMP
nsDeviceContextQt::GetSystemFont(nsSystemFontID anID, nsFont *aFont) const
{

View File

@@ -67,7 +67,6 @@ public:
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth,float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString &aFontName);
@@ -96,8 +95,6 @@ public:
private:
PRUint32 mDepth;
PRInt16 mScrollbarHeight;
PRInt16 mScrollbarWidth;
QWidget *mWidget;
PRInt32 mWidth;
PRInt32 mHeight;

View File

@@ -376,28 +376,6 @@ nsThebesDeviceContext::SupportsNativeWidgets(PRBool &aSupportsWidgets)
return NS_OK;
}
NS_IMETHODIMP
nsThebesDeviceContext::GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
float scale;
GetCanonicalPixelScale(scale);
//XXXispiked initialize these to something in case nsILookAndFeel barfs
PRInt32 tmpWidth = 16;
PRInt32 tmpHeight = 16;
// Get the scrollbar width and height from nsILookAndFeel
nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService("@mozilla.org/widget/lookandfeel;1");
if(lookAndFeel) {
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollbarWidth, tmpWidth);
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollbarHeight, tmpHeight);
}
aWidth = tmpWidth * mDevUnitsToAppUnits * scale;
aHeight = tmpHeight * mDevUnitsToAppUnits * scale;
return NS_OK;
}
NS_IMETHODIMP
nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
{

View File

@@ -78,8 +78,6 @@ public:
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD PrepareNativeWidget(nsIWidget* aWidget, void** aOut);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID aID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString& aFaceName);

View File

@@ -309,17 +309,6 @@ NS_IMETHODIMP nsDeviceContextWin :: SetCanonicalPixelScale(float aScale)
}
NS_IMETHODIMP nsDeviceContextWin :: GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
float scale;
GetCanonicalPixelScale(scale);
aWidth = ::GetSystemMetrics(SM_CXVSCROLL) * mDevUnitsToAppUnits * scale;
aHeight = ::GetSystemMetrics(SM_CXHSCROLL) * mDevUnitsToAppUnits * scale;
return NS_OK;
}
nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
nsFont* aFont, PRBool aIsWide) const
{

View File

@@ -59,7 +59,6 @@ public:
NS_IMETHOD GetCanonicalPixelScale(float &aScale) const;
NS_IMETHOD SetCanonicalPixelScale(float aScale);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
//get a low level drawing surface for rendering. the rendering context

View File

@@ -281,18 +281,6 @@ NS_IMETHODIMP nsDeviceContextXlib::SupportsNativeWidgets(PRBool &aSupportsWidget
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextXlib::GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::GetScrollBarDimensions()\n"));
float scale;
GetCanonicalPixelScale(scale);
// XXX Oh, yeah. These are hard coded.
aWidth = 15 * mPixelsToTwips * scale;
aHeight = 15 * mPixelsToTwips * scale;
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextXlib::GetSystemFont(nsSystemFontID anID, nsFont *aFont) const
{
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::GetSystemFont()\n"));

View File

@@ -61,7 +61,6 @@ public:
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);

View File

@@ -212,21 +212,6 @@ NS_IMETHODIMP nsDeviceContextXp :: SupportsNativeWidgets(PRBool &aSupportsWidget
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp :: GetScrollBarDimensions(float &aWidth,
float &aHeight) const
{
// XXX Oh, yeah. These are hard coded.
float scale;
GetCanonicalPixelScale(scale);
aWidth = 15.f * mPixelsToTwips * scale;
aHeight = 15.f * mPixelsToTwips * scale;
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/21/98 dwc

View File

@@ -74,8 +74,6 @@ public:
NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext);
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
NS_IMETHOD GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight);

View File

@@ -189,21 +189,6 @@ NS_IMETHODIMP nsDeviceContextMac :: SupportsNativeWidgets(PRBool &aSupportsWidge
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/9/98 dwc
*/
NS_IMETHODIMP nsDeviceContextMac :: GetScrollBarDimensions(float &aWidth, float &aHeight) const
{
// XXX Should we push this to widget library
float scale;
GetCanonicalPixelScale(scale);
aWidth = 16 * mDevUnitsToAppUnits * scale;
aHeight = 16 * mDevUnitsToAppUnits * scale;
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/9/98 dwc

View File

@@ -64,7 +64,6 @@ public:
NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext);
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
NS_IMETHOD CheckFontExistence(const nsString& aFontName);