Bug 257546 - sheet support implemented incorrectly. r=peterv, sr=sfraser.
git-svn-id: svn://10.0.0.236/trunk@165311 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
60cebfbc80
commit
ccb9993725
@ -119,7 +119,9 @@ enum nsWindowType { // Don't alter previously encoded enum values - 3rd part
|
||||
// plugin window
|
||||
eWindowType_plugin,
|
||||
// java plugin window
|
||||
eWindowType_java
|
||||
eWindowType_java,
|
||||
// MacOSX sheet (special dialog class)
|
||||
eWindowType_sheet
|
||||
};
|
||||
|
||||
enum nsBorderStyle
|
||||
@ -152,9 +154,6 @@ enum nsBorderStyle
|
||||
// show the close button
|
||||
eBorderStyle_close = 1 << 7,
|
||||
|
||||
// sheet hint (Mac OS X)
|
||||
eBorderStyle_sheet = 1 << 8,
|
||||
|
||||
// whatever the OS wants... i.e. don't do anything
|
||||
eBorderStyle_default = -1
|
||||
};
|
||||
|
||||
@ -355,28 +355,6 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
||||
break;
|
||||
|
||||
default:
|
||||
if (aParent && (aInitData->mBorderStyle & eBorderStyle_sheet))
|
||||
{
|
||||
nsWindowType parentType;
|
||||
aParent->GetWindowType(parentType);
|
||||
if (parentType != eWindowType_invisible)
|
||||
{
|
||||
// Mac OS X sheet support
|
||||
mIsSheet = PR_TRUE;
|
||||
windowClass = kSheetWindowClass;
|
||||
if (aInitData->mBorderStyle & eBorderStyle_resizeh)
|
||||
{
|
||||
attributes = kWindowResizableAttributes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
windowClass = kDocumentWindowClass;
|
||||
attributes = kWindowCollapseBoxAttribute;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
windowClass = kDocumentWindowClass;
|
||||
|
||||
// we ignore the close flag here, since mac dialogs should never have a close box.
|
||||
@ -399,6 +377,37 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
windowClass = kMovableModalWindowClass;
|
||||
attributes = kWindowCollapseBoxAttribute;
|
||||
}
|
||||
|
||||
hOffset = kDialogMarginWidth;
|
||||
vOffset = kDialogTitleBarHeight;
|
||||
break;
|
||||
|
||||
case eWindowType_sheet:
|
||||
mIsTopWidgetWindow = PR_TRUE;
|
||||
if (aInitData)
|
||||
{
|
||||
nsWindowType parentType;
|
||||
aParent->GetWindowType(parentType);
|
||||
if (parentType != eWindowType_invisible)
|
||||
{
|
||||
// Mac OS X sheet support
|
||||
mIsSheet = PR_TRUE;
|
||||
windowClass = kSheetWindowClass;
|
||||
if (aInitData->mBorderStyle & eBorderStyle_resizeh)
|
||||
{
|
||||
attributes = kWindowResizableAttributes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
windowClass = kDocumentWindowClass;
|
||||
attributes = kWindowCollapseBoxAttribute;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -509,8 +518,7 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
||||
nsRect bounds(0, 0, aRect.width, aRect.height - bottomPinDelta);
|
||||
|
||||
// We only need a valid aParent if we have a sheet
|
||||
if (!aInitData || (aInitData->mBorderStyle == eBorderStyle_default) ||
|
||||
!(aInitData->mBorderStyle & eBorderStyle_sheet))
|
||||
if (aInitData->mWindowType != eWindowType_sheet)
|
||||
aParent = nil;
|
||||
|
||||
// init base class
|
||||
|
||||
@ -319,6 +319,16 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
|
||||
widgetInitData.mWindowType = eWindowType_popup;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// Mac OS X sheet support
|
||||
PRUint32 sheetMask = nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
||||
nsIWebBrowserChrome::CHROME_MODAL;
|
||||
if (aParent && ((aChromeMask & sheetMask) == sheetMask))
|
||||
{
|
||||
widgetInitData.mWindowType = eWindowType_sheet;
|
||||
}
|
||||
#endif
|
||||
|
||||
widgetInitData.mContentType = eContentTypeUI;
|
||||
// note default chrome overrides other OS chrome settings, but
|
||||
// not internal chrome
|
||||
@ -349,16 +359,6 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_CARBON
|
||||
// Mac OS X sheet support
|
||||
PRUint32 sheetMask = nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
||||
nsIWebBrowserChrome::CHROME_MODAL;
|
||||
if (aParent && ((aChromeMask & sheetMask) == sheetMask))
|
||||
{
|
||||
widgetInitData.mBorderStyle = NS_STATIC_CAST(enum nsBorderStyle, widgetInitData.mBorderStyle | eBorderStyle_sheet );
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aInitialWidth == nsIAppShellService::SIZE_TO_CONTENT ||
|
||||
aInitialHeight == nsIAppShellService::SIZE_TO_CONTENT) {
|
||||
aInitialWidth = 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user