зеркало из https://github.com/mozilla/gecko-dev.git
Bug 316839, build fails in nsDeviceContextMac.cpp with gcc >= 4.0 following bug 213702. Correct for C++ signedness paranoia and fix warnings. r=josh sr=pink/irc
This commit is contained in:
Родитель
bd11d3afb7
Коммит
4eec5027f7
|
@ -203,34 +203,6 @@ NS_IMETHODIMP nsDeviceContextMac :: GetScrollBarDimensions(float &aWidth, float
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** ---------------------------------------------------
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static bool HasAppearanceManager()
|
|
||||||
{
|
|
||||||
|
|
||||||
#define APPEARANCE_MIN_VERSION 0x0110 // we require version 1.1
|
|
||||||
|
|
||||||
static bool inited = false;
|
|
||||||
static bool hasAppearanceManager = false;
|
|
||||||
|
|
||||||
if (inited)
|
|
||||||
return hasAppearanceManager;
|
|
||||||
inited = true;
|
|
||||||
|
|
||||||
SInt32 result;
|
|
||||||
if (::Gestalt(gestaltAppearanceAttr, &result) != noErr)
|
|
||||||
return false; // no Appearance Mgr
|
|
||||||
|
|
||||||
if (::Gestalt(gestaltAppearanceVersion, &result) != noErr)
|
|
||||||
return false; // still version 1.0
|
|
||||||
|
|
||||||
hasAppearanceManager = (result >= APPEARANCE_MIN_VERSION);
|
|
||||||
|
|
||||||
return hasAppearanceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** ---------------------------------------------------
|
/** ---------------------------------------------------
|
||||||
* See documentation in nsIDeviceContext.h
|
* See documentation in nsIDeviceContext.h
|
||||||
* @update 12/9/98 dwc
|
* @update 12/9/98 dwc
|
||||||
|
@ -281,7 +253,7 @@ NS_IMETHODIMP nsDeviceContextMac :: GetSystemFont(nsSystemFontID aID, nsFont *aF
|
||||||
aFont->name.AssignLiteral("sans-serif");
|
aFont->name.AssignLiteral("sans-serif");
|
||||||
aFont->size = NSToCoordRound(aFont->size * 0.875f); // quick hack
|
aFont->size = NSToCoordRound(aFont->size * 0.875f); // quick hack
|
||||||
}
|
}
|
||||||
else if (HasAppearanceManager())
|
else
|
||||||
{
|
{
|
||||||
ThemeFontID fontID = kThemeViewsFont;
|
ThemeFontID fontID = kThemeViewsFont;
|
||||||
switch (aID)
|
switch (aID)
|
||||||
|
@ -307,6 +279,7 @@ NS_IMETHODIMP nsDeviceContextMac :: GetSystemFont(nsSystemFontID aID, nsFont *aF
|
||||||
// moz
|
// moz
|
||||||
case eSystemFont_Tooltips: fontID = kThemeSmallSystemFont; break;
|
case eSystemFont_Tooltips: fontID = kThemeSmallSystemFont; break;
|
||||||
case eSystemFont_Widget: fontID = kThemeSmallSystemFont; break;
|
case eSystemFont_Widget: fontID = kThemeSmallSystemFont; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Str255 fontName;
|
Str255 fontName;
|
||||||
|
@ -372,10 +345,6 @@ NS_IMETHODIMP nsDeviceContextMac :: GetSystemFont(nsSystemFontID aID, nsFont *aF
|
||||||
if (fontStyle & underline)
|
if (fontStyle & underline)
|
||||||
aFont->decorations = NS_FONT_DECORATION_UNDERLINE;
|
aFont->decorations = NS_FONT_DECORATION_UNDERLINE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
aFont->name.AssignLiteral("geneva");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -470,7 +439,6 @@ nsDeviceContextMac :: FindScreenForSurface ( nsIScreen** outScreen )
|
||||||
Rect bounds;
|
Rect bounds;
|
||||||
::GetWindowPortBounds ( window, &bounds );
|
::GetWindowPortBounds ( window, &bounds );
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
if ( mScreenManager ) {
|
if ( mScreenManager ) {
|
||||||
if ( !(bounds.top || bounds.left || bounds.bottom || bounds.right) ) {
|
if ( !(bounds.top || bounds.left || bounds.bottom || bounds.right) ) {
|
||||||
NS_WARNING ( "trying to find screen for sizeless window" );
|
NS_WARNING ( "trying to find screen for sizeless window" );
|
||||||
|
@ -514,8 +482,8 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceSurfaceDimensions(PRInt32 & outWidth,
|
||||||
|
|
||||||
if( mSpec ) {
|
if( mSpec ) {
|
||||||
// we have a printer device
|
// we have a printer device
|
||||||
outWidth = (mPageRect.right-mPageRect.left)*mDevUnitsToAppUnits;
|
outWidth = NS_STATIC_CAST(PRInt32, (mPageRect.right-mPageRect.left)*mDevUnitsToAppUnits);
|
||||||
outHeight = (mPageRect.bottom-mPageRect.top)*mDevUnitsToAppUnits;
|
outHeight = NS_STATIC_CAST(PRInt32, (mPageRect.bottom-mPageRect.top)*mDevUnitsToAppUnits);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// we have a screen device. find the screen that the window is on and
|
// we have a screen device. find the screen that the window is on and
|
||||||
|
@ -550,8 +518,8 @@ nsDeviceContextMac::GetRect(nsRect &aRect)
|
||||||
// we have a printer device
|
// we have a printer device
|
||||||
aRect.x = 0;
|
aRect.x = 0;
|
||||||
aRect.y = 0;
|
aRect.y = 0;
|
||||||
aRect.width = (mPageRect.right-mPageRect.left)*mDevUnitsToAppUnits;
|
aRect.width = NS_STATIC_CAST(nscoord, (mPageRect.right-mPageRect.left)*mDevUnitsToAppUnits);
|
||||||
aRect.height = (mPageRect.bottom-mPageRect.top)*mDevUnitsToAppUnits;
|
aRect.height = NS_STATIC_CAST(nscoord, (mPageRect.bottom-mPageRect.top)*mDevUnitsToAppUnits);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// we have a screen device. find the screen that the window is on and
|
// we have a screen device. find the screen that the window is on and
|
||||||
|
@ -586,8 +554,8 @@ NS_IMETHODIMP nsDeviceContextMac::GetClientRect(nsRect &aRect)
|
||||||
if( mSpec ) {
|
if( mSpec ) {
|
||||||
// we have a printer device
|
// we have a printer device
|
||||||
aRect.x = aRect.y = 0;
|
aRect.x = aRect.y = 0;
|
||||||
aRect.width = (mPageRect.right-mPageRect.left)*mDevUnitsToAppUnits;
|
aRect.width = NS_STATIC_CAST(nscoord, (mPageRect.right-mPageRect.left)*mDevUnitsToAppUnits);
|
||||||
aRect.height = (mPageRect.bottom-mPageRect.top)*mDevUnitsToAppUnits;
|
aRect.height = NS_STATIC_CAST(nscoord, (mPageRect.bottom-mPageRect.top)*mDevUnitsToAppUnits);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// we have a screen device. find the screen that the window is on and
|
// we have a screen device. find the screen that the window is on and
|
||||||
|
@ -642,8 +610,8 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDev
|
||||||
double top, left, bottom, right;
|
double top, left, bottom, right;
|
||||||
printingContext->GetPageRect(&top, &left, &bottom, &right);
|
printingContext->GetPageRect(&top, &left, &bottom, &right);
|
||||||
Rect& pageRect = macDC->mPageRect;
|
Rect& pageRect = macDC->mPageRect;
|
||||||
pageRect.top = top, pageRect.left = left;
|
pageRect.top = (PRInt16)top, pageRect.left = (PRInt16)left;
|
||||||
pageRect.bottom = bottom, pageRect.right = right;
|
pageRect.bottom = (PRInt16)bottom, pageRect.right = (PRInt16)right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -800,7 +768,7 @@ void nsDeviceContextMac :: InitFontInfoList()
|
||||||
kUnicodeUTF8Format);
|
kUnicodeUTF8Format);
|
||||||
// enumerate all fonts.
|
// enumerate all fonts.
|
||||||
TECObjectRef converter = NULL;
|
TECObjectRef converter = NULL;
|
||||||
TextEncoding oldFontEncoding = NULL;
|
TextEncoding oldFontEncoding = 0;
|
||||||
ATSFontFamilyRef fontFamily;
|
ATSFontFamilyRef fontFamily;
|
||||||
while (::ATSFontFamilyIteratorNext(iter, &fontFamily) == noErr) {
|
while (::ATSFontFamilyIteratorNext(iter, &fontFamily) == noErr) {
|
||||||
// we'd like to use ATSFontFamilyGetName here, but it's ignorant of the
|
// we'd like to use ATSFontFamilyGetName here, but it's ignorant of the
|
||||||
|
@ -820,11 +788,11 @@ void nsDeviceContextMac :: InitFontInfoList()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// convert font name to UNICODE.
|
// convert font name to UNICODE.
|
||||||
UInt8 unicodeFontName[sizeof(fontName)];
|
char unicodeFontName[sizeof(fontName)];
|
||||||
ByteCount actualInputLength, actualOutputLength;
|
ByteCount actualInputLength, actualOutputLength;
|
||||||
err = ::TECConvertText(converter, &fontName[1], fontName[0], &actualInputLength,
|
err = ::TECConvertText(converter, &fontName[1], fontName[0], &actualInputLength,
|
||||||
(TextPtr)unicodeFontName , sizeof(unicodeFontName), &actualOutputLength);
|
(TextPtr)unicodeFontName , sizeof(unicodeFontName), &actualOutputLength);
|
||||||
unicodeFontName[actualOutputLength] = NULL;
|
unicodeFontName[actualOutputLength] = '\0';
|
||||||
|
|
||||||
nsString temp = NS_ConvertUTF8toUTF16(nsDependentCString(unicodeFontName));
|
nsString temp = NS_ConvertUTF8toUTF16(nsDependentCString(unicodeFontName));
|
||||||
FontNameKey key(temp);
|
FontNameKey key(temp);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче