Bug 129288 - Changing font size from XUL prefs dialog crashes PPEmbed. It's because the XUL pref window's docshell is typeContent, not typeChrome. r=adamlock/sr=alecf/a=asa

This commit is contained in:
ccarlen%netscape.com 2002-03-08 23:58:50 +00:00
parent a015dc148a
commit 49237b7b2d
3 changed files with 29 additions and 1 deletions

View File

@ -40,6 +40,7 @@
#include "nsIWindowWatcher.h"
#include "nsIServiceManagerUtils.h"
#include "nsIWebBrowserSetup.h"
#include "CBrowserShell.h"
#include "CBrowserWindow.h"
@ -209,7 +210,16 @@ LWindow* CWindowCreator::CreateWindowInternal(PRUint32 inChromeFlags,
ThrowIfNil_(aShell);
aShell->AddAttachments();
aShell->PutInside(theWindow, false);
if (chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)
{
nsCOMPtr<nsIWebBrowser> browser;
aShell->GetWebBrowser(getter_AddRefs(browser));
nsCOMPtr<nsIWebBrowserSetup> setup(do_QueryInterface(browser));
if (setup)
setup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_TRUE);
}
if (chromeFlags & nsIWebBrowserChrome::CHROME_STATUSBAR)
{
LView::SetDefaultView(theWindow);

View File

@ -94,6 +94,16 @@ interface nsIWebBrowserSetup : nsISupports
*/
const unsigned long SETUP_USE_GLOBAL_HISTORY = 256;
/**
* A value of PR_TRUE makes the browser a chrome wrapper.
* Default is PR_FALSE.
*
* @since mozilla1.0
*
* @see setProperty
*/
const unsigned long SETUP_IS_CHROME_WRAPPER = 7;
/**
* Sets a property on the new web browser object.
*

View File

@ -443,6 +443,8 @@ NS_IMETHODIMP nsWebBrowser::SetItemType(PRInt32 aItemType)
{
NS_ENSURE_TRUE((aItemType == typeContentWrapper || aItemType == typeChromeWrapper), NS_ERROR_FAILURE);
mContentType = aItemType;
if (mDocShellAsItem)
mDocShellAsItem->SetItemType(mContentType == typeChromeWrapper ? typeChrome : typeContent);
return NS_OK;
}
@ -738,6 +740,12 @@ NS_IMETHODIMP nsWebBrowser::SetProperty(PRUint32 aId, PRUint32 aValue)
// obsolete
}
break;
case nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER:
{
NS_ENSURE_TRUE((aValue == PR_TRUE || aValue == PR_FALSE), NS_ERROR_INVALID_ARG);
SetItemType(aValue ? typeChromeWrapper : typeContentWrapper);
}
break;
default:
rv = NS_ERROR_INVALID_ARG;