nsIPref is no longer passed around through inits on webshell, content viewers and presContext. In places where it is needed, it can be retrieved from the service manager. I removed a number of the getters and setters for prefs as the prefs will be the same from the service manager so we don't need getters. r=waterson a=rickg
This commit is contained in:
Родитель
5b76c26e70
Коммит
5c166f4fd5
|
@ -150,7 +150,6 @@ public:
|
|||
// nsIContentViewer interface...
|
||||
NS_IMETHOD Init(nsNativeWidget aParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
|
@ -421,7 +420,6 @@ DocumentViewerImpl::GetContainer(nsISupports** aResult)
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
|
@ -439,7 +437,7 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
|||
rv = NS_NewGalleyContext(getter_AddRefs(mPresContext));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mPresContext->Init(aDeviceContext, aPrefs);
|
||||
mPresContext->Init(aDeviceContext);
|
||||
makeCX = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -639,7 +637,6 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
|
|||
NS_ENSURE_ARG_POINTER(aDContext);
|
||||
|
||||
nsCOMPtr<nsIStyleSet> ss;
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
PRInt32 width, height;
|
||||
nsIView *view;
|
||||
|
@ -671,8 +668,7 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
|
|||
return rv;
|
||||
}
|
||||
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
cx->Init(aDContext, prefs);
|
||||
cx->Init(aDContext);
|
||||
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
|
@ -1175,7 +1171,6 @@ DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
|||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
PRInt32 width,height;
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
|
||||
nsComponentManager::CreateInstance(kDeviceContextSpecFactoryCID,
|
||||
nsnull,
|
||||
|
@ -1211,8 +1206,7 @@ nsCOMPtr<nsIPref> prefs;
|
|||
}
|
||||
|
||||
mPrintDC->GetDeviceSurfaceDimensions(width,height);
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
mPrintPC->Init(mPrintDC,prefs);
|
||||
mPrintPC->Init(mPrintDC);
|
||||
mPrintPC->SetContainer(webContainer);
|
||||
CreateStyleSet(mDocument,&mPrintSS);
|
||||
|
||||
|
@ -1402,8 +1396,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetDefaultCharacterSet(PRUnichar** aDefaultCha
|
|||
webShell = do_QueryInterface(mContainer);
|
||||
if (webShell)
|
||||
{
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
NS_ENSURE_SUCCESS(webShell->GetPrefs(*(getter_AddRefs(prefs))), NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));
|
||||
if(prefs)
|
||||
prefs->CopyCharPref("intl.charset.default", &gDefCharset);
|
||||
}
|
||||
|
|
|
@ -641,8 +641,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
nsresult rv_detect = NS_OK;
|
||||
if(! gInitDetector)
|
||||
{
|
||||
nsIPref* pref = nsnull;
|
||||
if(NS_SUCCEEDED(webShell->GetPrefs(pref)) && pref)
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
if(pref)
|
||||
{
|
||||
char* detector_name = nsnull;
|
||||
if(NS_SUCCEEDED(
|
||||
|
@ -656,7 +656,6 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
}
|
||||
pref->RegisterCallback("intl.charset.detector", MyPrefChangedCallback, nsnull);
|
||||
}
|
||||
NS_IF_RELEASE(pref);
|
||||
gInitDetector = PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -422,8 +422,8 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
nsresult rv_detect = NS_OK;
|
||||
if(! gInitDetector)
|
||||
{
|
||||
nsIPref* pref = nsnull;
|
||||
if(NS_SUCCEEDED(webShell->GetPrefs(pref)) && pref)
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
if(pref)
|
||||
{
|
||||
char* detector_name = nsnull;
|
||||
if(NS_SUCCEEDED(
|
||||
|
@ -437,7 +437,6 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
}
|
||||
pref->RegisterCallback("intl.charset.detector", MyPrefChangedCallback, nsnull);
|
||||
}
|
||||
NS_IF_RELEASE(pref);
|
||||
gInitDetector = PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -395,23 +395,6 @@ NS_IMETHODIMP nsDocShell::SetParentURIContentListener(nsIURIContentListener*
|
|||
return mContentListener->SetParentContentListener(aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetPrefs(nsIPref** aPrefs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPrefs);
|
||||
|
||||
*aPrefs = mPrefs;
|
||||
NS_IF_ADDREF(*aPrefs);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::SetPrefs(nsIPref* aPrefs)
|
||||
{
|
||||
// null aPrefs is ok
|
||||
mPrefs = aPrefs; // this assignment does an addref
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetZoom(float* zoom)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(zoom);
|
||||
|
@ -1064,6 +1047,7 @@ NS_IMETHODIMP nsDocShell::InitWindow(nativeWindow parentNativeWindow,
|
|||
NS_IMETHODIMP nsDocShell::Create()
|
||||
{
|
||||
NS_ENSURE_STATE(!mContentViewer);
|
||||
mPrefs = do_GetService(NS_PREF_PROGID);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2003,7 +1987,7 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
|
|||
nsRect bounds(x, y, cx, cy);
|
||||
nsCOMPtr<nsIDeviceContext> deviceContext(dont_AddRef(widget->GetDeviceContext()));
|
||||
if(NS_FAILED(mContentViewer->Init(widget->GetNativeData(NS_NATIVE_WIDGET),
|
||||
deviceContext, mPrefs, bounds, nsScrollPreference_kAuto)))
|
||||
deviceContext, bounds, nsScrollPreference_kAuto)))
|
||||
{
|
||||
mContentViewer = nsnull;
|
||||
NS_ERROR("ContentViewer Initialization failed");
|
||||
|
|
|
@ -125,11 +125,6 @@ interface nsIDocShell : nsISupports
|
|||
*/
|
||||
attribute nsIURIContentListener parentURIContentListener;
|
||||
|
||||
/*
|
||||
Prefs to use for the DocShell.
|
||||
*/
|
||||
attribute nsIPref prefs;
|
||||
|
||||
/**
|
||||
* Set/Get the document scale factor. When setting this attribute, a
|
||||
* NS_ERROR_NOT_IMPLEMENTED error may be returned by implementations
|
||||
|
|
|
@ -227,7 +227,6 @@ public:
|
|||
NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult);
|
||||
NS_IMETHOD GetTopLevelWindow(nsIWebShellContainer** aWebShellWindow);
|
||||
NS_IMETHOD GetPrefs(nsIPref*& aPrefs);
|
||||
NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult);
|
||||
NS_IMETHOD SetParent(nsIWebShell* aParent);
|
||||
NS_IMETHOD GetParent(nsIWebShell*& aParent);
|
||||
|
@ -1046,12 +1045,6 @@ nsWebShell::HandleEvent(nsGUIEvent *aEvent)
|
|||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetPrefs(nsIPref*& aPrefs)
|
||||
{
|
||||
return nsDocShell::GetPrefs(&aPrefs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetRootWebShell(nsIWebShell*& aResult)
|
||||
{
|
||||
|
@ -3764,16 +3757,6 @@ NS_IMETHODIMP nsWebShell::SetLoadCookie(nsISupports * aLoadCookie)
|
|||
return mContentListener->SetLoadCookie(aLoadCookie);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetPrefs(nsIPref** aPrefs)
|
||||
{
|
||||
return nsDocShell::GetPrefs(aPrefs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::SetPrefs(nsIPref* aPrefs)
|
||||
{
|
||||
return nsDocShell::SetPrefs(aPrefs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetZoom(float* aZoom)
|
||||
{
|
||||
*aZoom = mZoom;
|
||||
|
|
|
@ -2915,8 +2915,7 @@ nsCSSFrameConstructor::ConstructTextControlFrame(nsIPresShell* aPresShell
|
|||
PRBool
|
||||
nsCSSFrameConstructor::HasGfxScrollbars(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsCOMPtr<nsIPref> pref;
|
||||
aPresContext->GetPrefs(getter_AddRefs(pref));
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
PRBool gfx = PR_FALSE;
|
||||
if (pref) {
|
||||
pref->GetBoolPref("nglayout.widget.gfxscrollbars", &gfx);
|
||||
|
|
|
@ -150,7 +150,6 @@ public:
|
|||
// nsIContentViewer interface...
|
||||
NS_IMETHOD Init(nsNativeWidget aParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
|
@ -421,7 +420,6 @@ DocumentViewerImpl::GetContainer(nsISupports** aResult)
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
|
@ -439,7 +437,7 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
|||
rv = NS_NewGalleyContext(getter_AddRefs(mPresContext));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mPresContext->Init(aDeviceContext, aPrefs);
|
||||
mPresContext->Init(aDeviceContext);
|
||||
makeCX = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -639,7 +637,6 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
|
|||
NS_ENSURE_ARG_POINTER(aDContext);
|
||||
|
||||
nsCOMPtr<nsIStyleSet> ss;
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
PRInt32 width, height;
|
||||
nsIView *view;
|
||||
|
@ -671,8 +668,7 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
|
|||
return rv;
|
||||
}
|
||||
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
cx->Init(aDContext, prefs);
|
||||
cx->Init(aDContext);
|
||||
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
|
@ -1175,7 +1171,6 @@ DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
|||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
PRInt32 width,height;
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
|
||||
nsComponentManager::CreateInstance(kDeviceContextSpecFactoryCID,
|
||||
nsnull,
|
||||
|
@ -1211,8 +1206,7 @@ nsCOMPtr<nsIPref> prefs;
|
|||
}
|
||||
|
||||
mPrintDC->GetDeviceSurfaceDimensions(width,height);
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
mPrintPC->Init(mPrintDC,prefs);
|
||||
mPrintPC->Init(mPrintDC);
|
||||
mPrintPC->SetContainer(webContainer);
|
||||
CreateStyleSet(mDocument,&mPrintSS);
|
||||
|
||||
|
@ -1402,8 +1396,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetDefaultCharacterSet(PRUnichar** aDefaultCha
|
|||
webShell = do_QueryInterface(mContainer);
|
||||
if (webShell)
|
||||
{
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
NS_ENSURE_SUCCESS(webShell->GetPrefs(*(getter_AddRefs(prefs))), NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));
|
||||
if(prefs)
|
||||
prefs->CopyCharPref("intl.charset.default", &gDefCharset);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsIURIContentListener.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
@ -262,13 +263,13 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::Init(nsIDeviceContext* aDeviceContext, nsIPref* aPrefs)
|
||||
nsPresContext::Init(nsIDeviceContext* aDeviceContext)
|
||||
{
|
||||
NS_ASSERTION(!(mInitialized == PR_TRUE), "attempt to reinit pres context");
|
||||
|
||||
mDeviceContext = dont_QueryInterface(aDeviceContext);
|
||||
|
||||
mPrefs = dont_QueryInterface(aPrefs);
|
||||
mPrefs = do_GetService(NS_PREF_PROGID);
|
||||
if (mPrefs) {
|
||||
// Register callbacks so we're notified when the preferences change
|
||||
mPrefs->RegisterCallback("browser.", PrefChangedCallback, (void*)this);
|
||||
|
@ -322,18 +323,6 @@ nsPresContext::GetShell(nsIPresShell** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetPrefs(nsIPref** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aResult = mPrefs;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetCompatibilityMode(nsCompatibility* aResult)
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
/**
|
||||
* Initialize the presentation context from a particular device.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext, nsIPref* aPrefs) = 0;
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext) = 0;
|
||||
|
||||
/**
|
||||
* Stop the presentation in preperation for destruction.
|
||||
|
@ -96,11 +96,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetShell(nsIPresShell** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get a reference to the prefs API for this context
|
||||
*/
|
||||
NS_IMETHOD GetPrefs(nsIPref** aPrefsResult) = 0;
|
||||
|
||||
/**
|
||||
* Access compatibility mode for this context
|
||||
*/
|
||||
|
|
|
@ -3348,9 +3348,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
NS_ASSERTION(NS_OK == rv, "failed to create presentation context");
|
||||
nsCOMPtr<nsIDeviceContext> dc;
|
||||
mPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
cx->Init(dc, prefs);
|
||||
cx->Init(dc);
|
||||
|
||||
// Get our scrolling preference
|
||||
nsScrollPreference scrolling;
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
/**
|
||||
* Initialize the presentation context from a particular device.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext, nsIPref* aPrefs) = 0;
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext) = 0;
|
||||
|
||||
/**
|
||||
* Stop the presentation in preperation for destruction.
|
||||
|
@ -96,11 +96,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetShell(nsIPresShell** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get a reference to the prefs API for this context
|
||||
*/
|
||||
NS_IMETHOD GetPrefs(nsIPref** aPrefsResult) = 0;
|
||||
|
||||
/**
|
||||
* Access compatibility mode for this context
|
||||
*/
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
/**
|
||||
* Initialize the presentation context from a particular device.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext, nsIPref* aPrefs) = 0;
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext) = 0;
|
||||
|
||||
/**
|
||||
* Stop the presentation in preperation for destruction.
|
||||
|
@ -96,11 +96,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetShell(nsIPresShell** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get a reference to the prefs API for this context
|
||||
*/
|
||||
NS_IMETHOD GetPrefs(nsIPref** aPrefsResult) = 0;
|
||||
|
||||
/**
|
||||
* Access compatibility mode for this context
|
||||
*/
|
||||
|
|
|
@ -150,7 +150,6 @@ public:
|
|||
// nsIContentViewer interface...
|
||||
NS_IMETHOD Init(nsNativeWidget aParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
|
@ -421,7 +420,6 @@ DocumentViewerImpl::GetContainer(nsISupports** aResult)
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
|
@ -439,7 +437,7 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
|||
rv = NS_NewGalleyContext(getter_AddRefs(mPresContext));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mPresContext->Init(aDeviceContext, aPrefs);
|
||||
mPresContext->Init(aDeviceContext);
|
||||
makeCX = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -639,7 +637,6 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
|
|||
NS_ENSURE_ARG_POINTER(aDContext);
|
||||
|
||||
nsCOMPtr<nsIStyleSet> ss;
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
PRInt32 width, height;
|
||||
nsIView *view;
|
||||
|
@ -671,8 +668,7 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
|
|||
return rv;
|
||||
}
|
||||
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
cx->Init(aDContext, prefs);
|
||||
cx->Init(aDContext);
|
||||
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
|
@ -1175,7 +1171,6 @@ DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
|||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
PRInt32 width,height;
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
|
||||
nsComponentManager::CreateInstance(kDeviceContextSpecFactoryCID,
|
||||
nsnull,
|
||||
|
@ -1211,8 +1206,7 @@ nsCOMPtr<nsIPref> prefs;
|
|||
}
|
||||
|
||||
mPrintDC->GetDeviceSurfaceDimensions(width,height);
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
mPrintPC->Init(mPrintDC,prefs);
|
||||
mPrintPC->Init(mPrintDC);
|
||||
mPrintPC->SetContainer(webContainer);
|
||||
CreateStyleSet(mDocument,&mPrintSS);
|
||||
|
||||
|
@ -1402,8 +1396,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetDefaultCharacterSet(PRUnichar** aDefaultCha
|
|||
webShell = do_QueryInterface(mContainer);
|
||||
if (webShell)
|
||||
{
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
NS_ENSURE_SUCCESS(webShell->GetPrefs(*(getter_AddRefs(prefs))), NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));
|
||||
if(prefs)
|
||||
prefs->CopyCharPref("intl.charset.default", &gDefCharset);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,6 @@ public:
|
|||
// nsIContentViewer
|
||||
NS_IMETHOD Init(nsNativeWidget aParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
|
@ -287,7 +286,6 @@ PluginViewerImpl::GetContainer(nsISupports** aResult)
|
|||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsIURIContentListener.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
@ -262,13 +263,13 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::Init(nsIDeviceContext* aDeviceContext, nsIPref* aPrefs)
|
||||
nsPresContext::Init(nsIDeviceContext* aDeviceContext)
|
||||
{
|
||||
NS_ASSERTION(!(mInitialized == PR_TRUE), "attempt to reinit pres context");
|
||||
|
||||
mDeviceContext = dont_QueryInterface(aDeviceContext);
|
||||
|
||||
mPrefs = dont_QueryInterface(aPrefs);
|
||||
mPrefs = do_GetService(NS_PREF_PROGID);
|
||||
if (mPrefs) {
|
||||
// Register callbacks so we're notified when the preferences change
|
||||
mPrefs->RegisterCallback("browser.", PrefChangedCallback, (void*)this);
|
||||
|
@ -322,18 +323,6 @@ nsPresContext::GetShell(nsIPresShell** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetPrefs(nsIPref** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aResult = mPrefs;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetCompatibilityMode(nsCompatibility* aResult)
|
||||
{
|
||||
|
|
|
@ -42,11 +42,10 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIPresContext methods
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext, nsIPref* aPrefs);
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD SetShell(nsIPresShell* aShell);
|
||||
NS_IMETHOD GetShell(nsIPresShell** aResult);
|
||||
NS_IMETHOD GetPrefs(nsIPref** aPrefsResult);
|
||||
NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult);
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode);
|
||||
NS_IMETHOD GetWidgetRenderingMode(nsWidgetRendering* aModeResult);
|
||||
|
|
|
@ -787,13 +787,6 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
mWebShell->SetChromeEventHandler(chromeEventHandler);
|
||||
|
||||
|
||||
nsCOMPtr<nsIPref> parentPrefs; // connect the prefs
|
||||
parentShell->GetPrefs(getter_AddRefs(parentPrefs));
|
||||
if (parentPrefs) {
|
||||
mWebShell->SetPrefs(parentPrefs);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
|
|
|
@ -3348,9 +3348,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
NS_ASSERTION(NS_OK == rv, "failed to create presentation context");
|
||||
nsCOMPtr<nsIDeviceContext> dc;
|
||||
mPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||
nsCOMPtr<nsIPref> prefs;
|
||||
mPresContext->GetPrefs(getter_AddRefs(prefs));
|
||||
cx->Init(dc, prefs);
|
||||
cx->Init(dc);
|
||||
|
||||
// Get our scrolling preference
|
||||
nsScrollPreference scrolling;
|
||||
|
|
|
@ -787,13 +787,6 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
mWebShell->SetChromeEventHandler(chromeEventHandler);
|
||||
|
||||
|
||||
nsCOMPtr<nsIPref> parentPrefs; // connect the prefs
|
||||
parentShell->GetPrefs(getter_AddRefs(parentPrefs));
|
||||
if (parentPrefs) {
|
||||
mWebShell->SetPrefs(parentPrefs);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
|
|
|
@ -641,8 +641,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
nsresult rv_detect = NS_OK;
|
||||
if(! gInitDetector)
|
||||
{
|
||||
nsIPref* pref = nsnull;
|
||||
if(NS_SUCCEEDED(webShell->GetPrefs(pref)) && pref)
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
if(pref)
|
||||
{
|
||||
char* detector_name = nsnull;
|
||||
if(NS_SUCCEEDED(
|
||||
|
@ -656,7 +656,6 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
}
|
||||
pref->RegisterCallback("intl.charset.detector", MyPrefChangedCallback, nsnull);
|
||||
}
|
||||
NS_IF_RELEASE(pref);
|
||||
gInitDetector = PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1569,12 +1569,6 @@ nsGfxTextControlFrame::CreateWebShell(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsIWebShell> outerShell = do_QueryInterface(container);
|
||||
NS_ENSURE_TRUE(outerShell, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIPref> outerPrefs; //connect the prefs
|
||||
outerShell->GetPrefs(*getter_AddRefs(outerPrefs));
|
||||
NS_ENSURE_TRUE(outerPrefs, NS_ERROR_UNEXPECTED);
|
||||
|
||||
mWebShell->SetPrefs(outerPrefs);
|
||||
|
||||
float t2p;
|
||||
aPresContext->GetTwipsToPixels(&t2p);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
|
|
@ -2915,8 +2915,7 @@ nsCSSFrameConstructor::ConstructTextControlFrame(nsIPresShell* aPresShell
|
|||
PRBool
|
||||
nsCSSFrameConstructor::HasGfxScrollbars(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsCOMPtr<nsIPref> pref;
|
||||
aPresContext->GetPrefs(getter_AddRefs(pref));
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
PRBool gfx = PR_FALSE;
|
||||
if (pref) {
|
||||
pref->GetBoolPref("nglayout.widget.gfxscrollbars", &gfx);
|
||||
|
|
|
@ -422,8 +422,8 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
nsresult rv_detect = NS_OK;
|
||||
if(! gInitDetector)
|
||||
{
|
||||
nsIPref* pref = nsnull;
|
||||
if(NS_SUCCEEDED(webShell->GetPrefs(pref)) && pref)
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
if(pref)
|
||||
{
|
||||
char* detector_name = nsnull;
|
||||
if(NS_SUCCEEDED(
|
||||
|
@ -437,7 +437,6 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
}
|
||||
pref->RegisterCallback("intl.charset.detector", MyPrefChangedCallback, nsnull);
|
||||
}
|
||||
NS_IF_RELEASE(pref);
|
||||
gInitDetector = PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include "nsCSSRendering.h"
|
||||
#include "nsISelfScrollingFrame.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#define CONSTANT 0
|
||||
//#define DEBUG_REFLOW
|
||||
|
@ -2762,8 +2763,7 @@ void
|
|||
nsBoxDebug::GetPref(nsIPresContext* aPresContext)
|
||||
{
|
||||
gDebug = PR_FALSE;
|
||||
nsCOMPtr<nsIPref> pref;
|
||||
aPresContext->GetPrefs(getter_AddRefs(pref));
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
if (pref) {
|
||||
pref->GetBoolPref("xul.debug.box", &gDebug);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,6 @@ public:
|
|||
// nsIContentViewer
|
||||
NS_IMETHOD Init(nsNativeWidget aParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
|
@ -287,7 +286,6 @@ PluginViewerImpl::GetContainer(nsISupports** aResult)
|
|||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
|
|
|
@ -129,7 +129,6 @@ public:
|
|||
// nsIContentViewer
|
||||
NS_IMETHOD Init(nsNativeWidget aParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
|
@ -287,7 +286,6 @@ PluginViewerImpl::GetContainer(nsISupports** aResult)
|
|||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIBrowserWindow_h___
|
||||
#define nsIBrowserWindow_h___
|
||||
|
||||
#include "nsweb.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIAppShell;
|
||||
class nsIPref;
|
||||
class nsIFactory;
|
||||
class nsIWebShell;
|
||||
class nsString;
|
||||
struct nsRect;
|
||||
|
||||
#define NS_IBROWSER_WINDOW_IID \
|
||||
{ 0xa6cf905c, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
#define NS_BROWSER_WINDOW_CID \
|
||||
{ 0xa6cf905d, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// Chrome mask
|
||||
#define NS_CHROME_DEFAULT_CHROME 0x00000001
|
||||
#define NS_CHROME_WINDOW_BORDERS_ON 0x00000002
|
||||
#define NS_CHROME_WINDOW_CLOSE_ON 0x00000004
|
||||
#define NS_CHROME_WINDOW_RESIZE_ON 0x00000008
|
||||
#define NS_CHROME_MENU_BAR_ON 0x00000010
|
||||
#define NS_CHROME_TOOL_BAR_ON 0x00000020
|
||||
#define NS_CHROME_LOCATION_BAR_ON 0x00000040
|
||||
#define NS_CHROME_STATUS_BAR_ON 0x00000080
|
||||
#define NS_CHROME_PERSONAL_TOOLBAR_ON 0x00000100
|
||||
#define NS_CHROME_SCROLLBARS_ON 0x00000200
|
||||
#define NS_CHROME_TITLEBAR_ON 0x00000400
|
||||
#define NS_CHROME_EXTRACHROME_ON 0x00000800
|
||||
#define NS_CHROME_DEPENDENT 0x10000000
|
||||
#define NS_CHROME_MODAL 0x20000000
|
||||
#define NS_CHROME_OPEN_AS_DIALOG 0x40000000
|
||||
#define NS_CHROME_OPEN_AS_CHROME 0x80000000
|
||||
#define NS_CHROME_ALL_CHROME 0x00000FFE
|
||||
|
||||
/**
|
||||
* API to a "browser window". A browser window contains a toolbar, a web shell
|
||||
* and a status bar. The toolbar and status bar are optional and are
|
||||
* controlled by the chrome API.
|
||||
*/
|
||||
class nsIBrowserWindow : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IBROWSER_WINDOW_IID; return iid; }
|
||||
NS_IMETHOD Init(nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
PRUint32 aChromeMask,
|
||||
PRBool aAllowPlugins = PR_TRUE) = 0;
|
||||
|
||||
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
NS_IMETHOD SizeWindowTo(PRInt32 aWidth, PRInt32 aHeight,
|
||||
PRBool aWidthTransient, PRBool aHeightTransient) = 0;
|
||||
NS_IMETHOD SizeContentTo(PRInt32 aWidth, PRInt32 aHeight) = 0;
|
||||
|
||||
NS_IMETHOD GetContentBounds(nsRect& aResult) = 0;
|
||||
NS_IMETHOD GetWindowBounds(nsRect& aResult) = 0;
|
||||
|
||||
NS_IMETHOD IsIntrinsicallySized(PRBool& aResult) = 0;
|
||||
|
||||
NS_IMETHOD ShowAfterCreation() = 0;
|
||||
|
||||
NS_IMETHOD Show() = 0;
|
||||
|
||||
NS_IMETHOD Hide() = 0;
|
||||
|
||||
NS_IMETHOD Close() = 0;
|
||||
|
||||
NS_IMETHOD ShowModally(PRBool aPrepare) = 0;
|
||||
|
||||
NS_IMETHOD SetChrome(PRUint32 aNewChromeMask) = 0;
|
||||
|
||||
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult) = 0;
|
||||
|
||||
NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0;
|
||||
|
||||
NS_IMETHOD GetTitle(PRUnichar** aResult) = 0;
|
||||
|
||||
NS_IMETHOD SetStatus(const PRUnichar* aStatus) = 0;
|
||||
|
||||
NS_IMETHOD GetStatus(const PRUnichar** aResult) = 0;
|
||||
|
||||
NS_IMETHOD SetDefaultStatus(const PRUnichar* aStatus) = 0;
|
||||
|
||||
NS_IMETHOD GetDefaultStatus(const PRUnichar** aResult) = 0;
|
||||
|
||||
NS_IMETHOD SetProgress(PRInt32 aProgress, PRInt32 aProgressMax) = 0;
|
||||
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow) = 0;
|
||||
|
||||
NS_IMETHOD GetWebShell(nsIWebShell*& aResult) = 0;
|
||||
NS_IMETHOD GetContentWebShell(nsIWebShell **aResult) = 0;
|
||||
|
||||
// XXX minimize, maximize
|
||||
// XXX event control: enable/disable window close box, stick to glass, modal
|
||||
};
|
||||
|
||||
#endif /* nsIBrowserWindow_h___ */
|
|
@ -26,9 +26,6 @@
|
|||
#include "nsIWidget.h"
|
||||
#include "nsIScrollableView.h"
|
||||
|
||||
class nsIWebShell;
|
||||
|
||||
|
||||
// Forward declarations...
|
||||
class nsIDeviceContext;
|
||||
class nsIPref;
|
||||
|
@ -57,7 +54,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD Init(nsNativeWidget aNativeParent,
|
||||
nsIDeviceContext* aDeviceContext,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto)=0;
|
||||
|
||||
|
|
|
@ -151,16 +151,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetDocLoaderObserver(nsIDocumentLoaderObserver** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Set the nsIPref used to get/set preference values...
|
||||
*/
|
||||
NS_IMETHOD SetPrefs(nsIPref* aPrefs) = 0;
|
||||
|
||||
/**
|
||||
* Return the current nsIPref interface.
|
||||
*/
|
||||
NS_IMETHOD GetPrefs(nsIPref*& aPrefs) = 0;
|
||||
|
||||
/**
|
||||
* Return the root WebShell instance. Since WebShells can be nested
|
||||
* (when frames are present for example) this instance represents the
|
||||
|
|
|
@ -227,7 +227,6 @@ public:
|
|||
NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult);
|
||||
NS_IMETHOD GetTopLevelWindow(nsIWebShellContainer** aWebShellWindow);
|
||||
NS_IMETHOD GetPrefs(nsIPref*& aPrefs);
|
||||
NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult);
|
||||
NS_IMETHOD SetParent(nsIWebShell* aParent);
|
||||
NS_IMETHOD GetParent(nsIWebShell*& aParent);
|
||||
|
@ -1046,12 +1045,6 @@ nsWebShell::HandleEvent(nsGUIEvent *aEvent)
|
|||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetPrefs(nsIPref*& aPrefs)
|
||||
{
|
||||
return nsDocShell::GetPrefs(&aPrefs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetRootWebShell(nsIWebShell*& aResult)
|
||||
{
|
||||
|
@ -3764,16 +3757,6 @@ NS_IMETHODIMP nsWebShell::SetLoadCookie(nsISupports * aLoadCookie)
|
|||
return mContentListener->SetLoadCookie(aLoadCookie);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetPrefs(nsIPref** aPrefs)
|
||||
{
|
||||
return nsDocShell::GetPrefs(aPrefs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::SetPrefs(nsIPref* aPrefs)
|
||||
{
|
||||
return nsDocShell::SetPrefs(aPrefs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetZoom(float* aZoom)
|
||||
{
|
||||
*aZoom = mZoom;
|
||||
|
|
|
@ -1012,7 +1012,6 @@ nsBrowserWindow::nsBrowserWindow()
|
|||
|
||||
nsBrowserWindow::~nsBrowserWindow()
|
||||
{
|
||||
NS_IF_RELEASE(mPrefs);
|
||||
NS_IF_RELEASE(mAppShell);
|
||||
NS_IF_RELEASE(mTableInspectorDialog);
|
||||
NS_IF_RELEASE(mImageInspectorDialog);
|
||||
|
@ -1081,7 +1080,6 @@ nsBrowserWindow::QueryInterface(const nsIID& aIID,
|
|||
|
||||
nsresult
|
||||
nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
PRUint32 aChromeMask,
|
||||
PRBool aAllowPlugins)
|
||||
|
@ -1089,8 +1087,6 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
mChromeMask = aChromeMask;
|
||||
mAppShell = aAppShell;
|
||||
NS_IF_ADDREF(mAppShell);
|
||||
mPrefs = aPrefs;
|
||||
NS_IF_ADDREF(mPrefs);
|
||||
mAllowPlugins = aAllowPlugins;
|
||||
|
||||
// Create top level window
|
||||
|
@ -1132,7 +1128,6 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
if (docLoader) {
|
||||
docLoader->AddObserver(this);
|
||||
}
|
||||
mDocShell->SetPrefs(aPrefs);
|
||||
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));
|
||||
docShellWin->SetVisibility(PR_TRUE);
|
||||
|
||||
|
@ -1170,7 +1165,6 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
|
||||
nsresult
|
||||
nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
PRUint32 aChromeMask,
|
||||
PRBool aAllowPlugins,
|
||||
|
@ -1180,8 +1174,6 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
mChromeMask = aChromeMask;
|
||||
mAppShell = aAppShell;
|
||||
NS_IF_ADDREF(mAppShell);
|
||||
mPrefs = aPrefs;
|
||||
NS_IF_ADDREF(mPrefs);
|
||||
mAllowPlugins = aAllowPlugins;
|
||||
|
||||
// Create top level window
|
||||
|
@ -1215,7 +1207,6 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
if (docLoader) {
|
||||
docLoader->AddObserver(this);
|
||||
}
|
||||
mDocShell->SetPrefs(aPrefs);
|
||||
|
||||
if (NS_CHROME_MENU_BAR_ON & aChromeMask) {
|
||||
rv = CreateMenuBar(r.width);
|
||||
|
@ -1879,7 +1870,7 @@ nsBrowserWindow::NewWebShell(PRUint32 aChromeMask,
|
|||
browser->SetApp(mApp);
|
||||
|
||||
// Assume no controls for now
|
||||
rv = browser->Init(mAppShell, mPrefs, bounds, aChromeMask, mAllowPlugins);
|
||||
rv = browser->Init(mAppShell, bounds, aChromeMask, mAllowPlugins);
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
// Default is to startup hidden
|
||||
|
@ -2315,7 +2306,7 @@ nsBrowserWindow::ShowPrintPreview(PRInt32 aID)
|
|||
nsIPresContext* presContext;
|
||||
docv->GetPresContext(presContext);
|
||||
presContext->GetDeviceContext(getter_AddRefs(dc));
|
||||
printContext->Init(dc, mPrefs);
|
||||
printContext->Init(dc);
|
||||
NS_RELEASE(presContext);
|
||||
|
||||
// Make a window using that content viewer
|
||||
|
@ -2324,7 +2315,7 @@ nsBrowserWindow::ShowPrintPreview(PRInt32 aID)
|
|||
// browser event handling code during processing of the NS_DESTROY event...
|
||||
nsBrowserWindow* bw = new nsNativeBrowserWindow;
|
||||
bw->SetApp(mApp);
|
||||
bw->Init(mAppShell, mPrefs, nsRect(0, 0, 600, 400),
|
||||
bw->Init(mAppShell, nsRect(0, 0, 600, 400),
|
||||
NS_CHROME_MENU_BAR_ON, PR_TRUE, docv, printContext);
|
||||
bw->Show();
|
||||
|
||||
|
@ -2370,7 +2361,7 @@ void nsBrowserWindow::DoPrintSetup()
|
|||
kIXPBaseWindowIID,
|
||||
(void**) &dialog);
|
||||
if (rv == NS_OK) {
|
||||
dialog->Init(eXPBaseWindowType_dialog, mAppShell, nsnull, printHTML,
|
||||
dialog->Init(eXPBaseWindowType_dialog, mAppShell, printHTML,
|
||||
title, rect, PRUint32(~0), PR_FALSE);
|
||||
dialog->SetVisible(PR_TRUE);
|
||||
if (NS_OK == dialog->QueryInterface(kIXPBaseWindowIID, (void**)&mXPDialog)) {
|
||||
|
@ -2453,7 +2444,7 @@ void nsBrowserWindow::DoTableInspector()
|
|||
kIXPBaseWindowIID,
|
||||
(void**) &xpWin);
|
||||
if (rv == NS_OK) {
|
||||
xpWin->Init(eXPBaseWindowType_dialog, mAppShell, nsnull, printHTML, title, rect, PRUint32(~0), PR_FALSE);
|
||||
xpWin->Init(eXPBaseWindowType_dialog, mAppShell, printHTML, title, rect, PRUint32(~0), PR_FALSE);
|
||||
xpWin->SetVisible(PR_TRUE);
|
||||
if (NS_OK == xpWin->QueryInterface(kIXPBaseWindowIID, (void**) &mTableInspectorDialog)) {
|
||||
mTableInspector = new nsTableInspectorDialog(this, domDoc); // ref counts domDoc
|
||||
|
@ -2484,7 +2475,7 @@ void nsBrowserWindow::DoImageInspector()
|
|||
nsXPBaseWindow * xpWin = nsnull;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kXPBaseWindowCID, nsnull, kIXPBaseWindowIID, (void**) &xpWin);
|
||||
if (rv == NS_OK) {
|
||||
xpWin->Init(eXPBaseWindowType_dialog, mAppShell, nsnull, printHTML, title, rect, PRUint32(~0), PR_FALSE);
|
||||
xpWin->Init(eXPBaseWindowType_dialog, mAppShell, printHTML, title, rect, PRUint32(~0), PR_FALSE);
|
||||
xpWin->SetVisible(PR_TRUE);
|
||||
if (NS_OK == xpWin->QueryInterface(kIXPBaseWindowIID, (void**) &mImageInspectorDialog)) {
|
||||
mImageInspector = new nsImageInspectorDialog(this, domDoc); // ref counts domDoc
|
||||
|
@ -3062,12 +3053,13 @@ nsBrowserWindow::ToggleBoolPrefAndRefresh(const char * aPrefName)
|
|||
{
|
||||
NS_ASSERTION(nsnull != aPrefName,"null pref name");
|
||||
|
||||
if (nsnull != mPrefs && nsnull != aPrefName)
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));
|
||||
if (prefs && nsnull != aPrefName)
|
||||
{
|
||||
PRBool value;
|
||||
mPrefs->GetBoolPref(aPrefName,&value);
|
||||
mPrefs->SetBoolPref(aPrefName,!value);
|
||||
mPrefs->SavePrefFile();
|
||||
prefs->GetBoolPref(aPrefName,&value);
|
||||
prefs->SetBoolPref(aPrefName,!value);
|
||||
prefs->SavePrefFile();
|
||||
|
||||
ForceRefresh();
|
||||
}
|
||||
|
@ -3325,10 +3317,11 @@ nsBrowserWindow::DispatchDebugMenu(PRInt32 aID)
|
|||
void
|
||||
nsBrowserWindow::SetCompatibilityMode(PRBool aIsStandard)
|
||||
{
|
||||
if (nsnull != mPrefs) {
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_PROGID));
|
||||
if (pref) {
|
||||
int32 prefInt = (aIsStandard) ? eCompatibility_Standard : eCompatibility_NavQuirks;
|
||||
mPrefs->SetIntPref("nglayout.compatibility.mode", prefInt);
|
||||
mPrefs->SavePrefFile();
|
||||
pref->SetIntPref("nglayout.compatibility.mode", prefInt);
|
||||
pref->SavePrefFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ class nsViewerApp;
|
|||
class nsIDocumentViewer;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIPref;
|
||||
class nsIContentConnector;
|
||||
class nsWebCrawler;
|
||||
|
||||
|
@ -78,7 +77,6 @@ public:
|
|||
|
||||
// nsIBrowserWindow
|
||||
NS_IMETHOD Init(nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
PRUint32 aChromeMask,
|
||||
PRBool aAllowPlugins = PR_TRUE);
|
||||
|
@ -219,7 +217,6 @@ public:
|
|||
// Initialize a second view on a different browser windows document
|
||||
// viewer.
|
||||
nsresult Init(nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
PRUint32 aChromeMask,
|
||||
PRBool aAllowPlugins,
|
||||
|
@ -269,7 +266,6 @@ public:
|
|||
|
||||
//for creating more instances
|
||||
nsIAppShell* mAppShell;
|
||||
nsIPref* mPrefs;
|
||||
PRBool mAllowPlugins;
|
||||
|
||||
// Global window collection
|
||||
|
|
|
@ -703,7 +703,7 @@ nsViewerApp::OpenWindow()
|
|||
}
|
||||
bw->SetApp(this);
|
||||
bw->SetShowLoadTimes(mShowLoadTimes);
|
||||
bw->Init(mAppShell, mPrefs, nsRect(0, 0, mWidth, mHeight),
|
||||
bw->Init(mAppShell, nsRect(0, 0, mWidth, mHeight),
|
||||
PRUint32(~0), mAllowPlugins);
|
||||
bw->Show();
|
||||
nsIBrowserWindow* bwCurrent;
|
||||
|
@ -772,7 +772,7 @@ nsViewerApp::ViewSource(nsString& aURL)
|
|||
return rv;
|
||||
}
|
||||
bw->SetApp(this);
|
||||
bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0), mAllowPlugins);
|
||||
bw->Init(mAppShell, nsRect(0, 0, 620, 400), PRUint32(~0), mAllowPlugins);
|
||||
bw->Show();
|
||||
bw->GoTo(aURL.GetUnicode(),"view-source");
|
||||
NS_RELEASE(bw);
|
||||
|
@ -792,7 +792,7 @@ nsViewerApp::OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow)
|
|||
return rv;
|
||||
}
|
||||
bw->SetApp(this);
|
||||
bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), aNewChromeMask, mAllowPlugins);
|
||||
bw->Init(mAppShell, nsRect(0, 0, 620, 400), aNewChromeMask, mAllowPlugins);
|
||||
|
||||
aNewWindow = bw;
|
||||
|
||||
|
|
|
@ -95,8 +95,7 @@ nsXPBaseWindow::nsXPBaseWindow() :
|
|||
mContentRoot(nsnull),
|
||||
mWindowListener(nsnull),
|
||||
mDocIsLoaded(PR_FALSE),
|
||||
mAppShell(nsnull),
|
||||
mPrefs(nsnull)
|
||||
mAppShell(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -104,7 +103,6 @@ nsXPBaseWindow::nsXPBaseWindow() :
|
|||
nsXPBaseWindow::~nsXPBaseWindow()
|
||||
{
|
||||
NS_IF_RELEASE(mContentRoot);
|
||||
NS_IF_RELEASE(mPrefs);
|
||||
NS_IF_RELEASE(mAppShell);
|
||||
}
|
||||
|
||||
|
@ -188,7 +186,6 @@ HandleXPDialogEvent(nsGUIEvent *aEvent)
|
|||
//----------------------------------------------------------------------
|
||||
nsresult nsXPBaseWindow::Init(nsXPBaseWindowType aType,
|
||||
nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsString& aDialogURL,
|
||||
const nsString& aTitle,
|
||||
const nsRect& aBounds,
|
||||
|
@ -200,9 +197,6 @@ nsresult nsXPBaseWindow::Init(nsXPBaseWindowType aType,
|
|||
mAppShell = aAppShell;
|
||||
NS_IF_ADDREF(mAppShell);
|
||||
|
||||
mPrefs = aPrefs;
|
||||
NS_IF_ADDREF(mPrefs);
|
||||
|
||||
// Create top level window
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(kWindowCID, nsnull, kIWidgetIID,
|
||||
|
@ -235,7 +229,6 @@ nsresult nsXPBaseWindow::Init(nsXPBaseWindowType aType,
|
|||
r.x, r.y, r.width, r.height,
|
||||
aAllowPlugins, PR_FALSE);
|
||||
mWebShell->SetContainer((nsIWebShellContainer*) this);
|
||||
mWebShell->SetPrefs(aPrefs);
|
||||
nsCOMPtr<nsIBaseWindow> webShellWin(do_QueryInterface(mWebShell));
|
||||
webShellWin->SetVisibility(PR_TRUE);
|
||||
|
||||
|
@ -534,7 +527,7 @@ NS_IMETHODIMP nsXPBaseWindow::NewWebShell(PRUint32 aChromeMask,
|
|||
nsRect bounds;
|
||||
GetBounds(bounds);
|
||||
|
||||
rv = dialogWindow->Init(mWindowType, mAppShell, mPrefs, mDialogURL, mTitle, bounds, aChromeMask, mAllowPlugins);
|
||||
rv = dialogWindow->Init(mWindowType, mAppShell, mDialogURL, mTitle, bounds, aChromeMask, mAllowPlugins);
|
||||
if (NS_OK == rv) {
|
||||
if (aVisible) {
|
||||
dialogWindow->SetVisible(PR_TRUE);
|
||||
|
|
|
@ -58,7 +58,6 @@ public:
|
|||
// nsIBrowserWindow
|
||||
NS_IMETHOD Init(nsXPBaseWindowType aType,
|
||||
nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsString& aDialogURL,
|
||||
const nsString& aTitle,
|
||||
const nsRect& aBounds,
|
||||
|
@ -141,7 +140,6 @@ protected:
|
|||
|
||||
//for creating more instances
|
||||
nsIAppShell* mAppShell; //not addref'ed!
|
||||
nsIPref* mPrefs; //not addref'ed!
|
||||
PRBool mAllowPlugins;
|
||||
|
||||
nsXPBaseWindowType mWindowType;
|
||||
|
|
|
@ -88,7 +88,6 @@ public:
|
|||
|
||||
NS_IMETHOD Init(nsXPBaseWindowType aType,
|
||||
nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsString& aDialogURL,
|
||||
const nsString& aTitle,
|
||||
const nsRect& aBounds,
|
||||
|
|
|
@ -338,24 +338,6 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
|
|||
docShellAsItem->SetTreeOwner(mChromeTreeOwner);
|
||||
docShellAsItem->SetItemType(nsIDocShellTreeItem::typeChrome);
|
||||
|
||||
/*
|
||||
* XXX: How should preferences be supplied to the nsWebShellWindow?
|
||||
* Should there be the notion of a global preferences service?
|
||||
* Or should there be many preferences components based on
|
||||
* the user profile...
|
||||
*/
|
||||
// Initialize the webshell with the preferences service
|
||||
nsIPref *prefs;
|
||||
|
||||
rv = nsServiceManager::GetService(kPrefCID,
|
||||
NS_GET_IID(nsIPref),
|
||||
(nsISupports **)&prefs);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Set the prefs in the outermost webshell.
|
||||
mWebShell->SetPrefs(prefs);
|
||||
nsServiceManager::ReleaseService(kPrefCID, prefs);
|
||||
}
|
||||
|
||||
if (nsnull != aUrl) {
|
||||
char *tmpStr = NULL;
|
||||
nsAutoString urlString;
|
||||
|
@ -1753,7 +1735,6 @@ nsWebShellWindow::DocumentWillBeDestroyed(nsIDocument *aDocument)
|
|||
|
||||
/**************** nsIBrowserWindow interface ********************/
|
||||
NS_IMETHODIMP nsWebShellWindow::Init(nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
PRUint32 aChromeMask,
|
||||
PRBool aAllowPlugins)
|
||||
|
|
|
@ -190,7 +190,6 @@ public:
|
|||
|
||||
// nsIBrowserWindow methods not already covered elsewhere
|
||||
NS_IMETHOD Init(nsIAppShell* aAppShell,
|
||||
nsIPref* aPrefs,
|
||||
const nsRect& aBounds,
|
||||
PRUint32 aChromeMask,
|
||||
PRBool aAllowPlugins = PR_TRUE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче