diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index a6b1e3694cb9..b09e5c4736aa 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -34,6 +34,7 @@ #include "nsplugin.h" #include "nsIPluginHost.h" #include "nsPluginsCID.h" +#include "nsIPref.h" #include "prlog.h" @@ -107,6 +108,8 @@ public: NS_IMETHOD SetObserver(nsIStreamObserver* anObserver); NS_IMETHOD GetObserver(nsIStreamObserver*& aResult); NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult); + NS_IMETHOD SetPrefs(nsIPref* aPrefs); + NS_IMETHOD GetPrefs(nsIPref*& aPrefs); NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult); NS_IMETHOD SetParent(nsIWebShell* aParent); NS_IMETHOD GetParent(nsIWebShell*& aParent); @@ -167,6 +170,7 @@ protected: nsIWebShellContainer* mContainer; nsIContentViewer* mContentViewer; nsIDeviceContext* mDeviceContext; + nsIPref* mPrefs; nsIWidget* mWindow; nsISupports* mInnerWindow; nsIDocumentLoader* mDocLoader; @@ -265,6 +269,8 @@ nsWebShell::~nsWebShell() NS_IF_RELEASE(mInnerWindow); NS_IF_RELEASE(mContentViewer); + NS_IF_RELEASE(mDeviceContext); + NS_IF_RELEASE(mPrefs); NS_IF_RELEASE(mContainer); NS_IF_RELEASE(mObserver); @@ -375,6 +381,7 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer, bounds.x = bounds.y = 0; rv = mContentViewer->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), mDeviceContext, + mPrefs, bounds, mScrollPref); if (NS_OK == rv) { @@ -395,7 +402,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent, //XXX make sure plugins have started up. this really needs to //be associated with the nsIContentViewerContainer interfaces, //not the nsIWebShell interfaces. this is a hack. MMP - CreatePluginHost(); +// CreatePluginHost(); mScrollPref = aScrolling; @@ -615,6 +622,22 @@ nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult) return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE; } +NS_IMETHODIMP +nsWebShell::SetPrefs(nsIPref* aPrefs) +{ + NS_IF_RELEASE(mPrefs); + mPrefs = aPrefs; + NS_IF_ADDREF(mPrefs); + return NS_OK; +} + +NS_IMETHODIMP +nsWebShell::GetPrefs(nsIPref*& aPrefs) +{ + aPrefs = mPrefs; + NS_IF_ADDREF(aPrefs); + return NS_OK; +} nsresult nsWebShell::GetRootWebShell(nsIWebShell*& aResult) diff --git a/layout/html/tests/TestInlineFrame.cpp b/layout/html/tests/TestInlineFrame.cpp index 7ecd4b2cea02..c7c153f44c0b 100644 --- a/layout/html/tests/TestInlineFrame.cpp +++ b/layout/html/tests/TestInlineFrame.cpp @@ -1597,7 +1597,7 @@ int main(int argc, char** argv) NS_NewGalleyContext(&presContext); - presContext->Init(dx); + presContext->Init(dx, nsnull); // Test basic reflowing of unmapped children if (!TestReflowUnmapped(presContext)) { diff --git a/layout/html/tests/table/TableContentTest/TableContentTest.cpp b/layout/html/tests/table/TableContentTest/TableContentTest.cpp index d07c63b37489..9bd7da2f7bee 100644 --- a/layout/html/tests/table/TableContentTest/TableContentTest.cpp +++ b/layout/html/tests/table/TableContentTest/TableContentTest.cpp @@ -441,7 +441,7 @@ GeometryTest::GeometryTest(BasicTest *aDoc) NS_ASSERTION(PR_FALSE, "bad galley pc"); } - pc->Init(dx); + pc->Init(dx, nsnull); // create a view manager nsIViewManager * vm = nsnull; @@ -516,7 +516,7 @@ GeometryTest::GeometryTest(BasicTest *aDoc) fprintf(out, "bad paginated pc"); NS_ASSERTION(PR_FALSE, ""); } - pc->Init(dx); + pc->Init(dx, nsnull); aDoc->CreateCorrectContent(rows, cols); CreateGeometry(aDoc, pc); VerifyGeometry(aDoc, pc); diff --git a/webshell/public/nsIBrowserWindow.h b/webshell/public/nsIBrowserWindow.h index 4a293a609c96..ee8cdd98402e 100644 --- a/webshell/public/nsIBrowserWindow.h +++ b/webshell/public/nsIBrowserWindow.h @@ -23,6 +23,7 @@ #include "nsISupports.h" class nsIAppShell; +class nsIPref; class nsIFactory; class nsIWebShell; class nsString; @@ -49,6 +50,7 @@ struct nsRect; class nsIBrowserWindow : public nsISupports { public: NS_IMETHOD Init(nsIAppShell* aAppShell, + nsIPref* aPrefs, const nsRect& aBounds, PRUint32 aChromeMask) = 0; diff --git a/webshell/public/nsIContentViewer.h b/webshell/public/nsIContentViewer.h index 78f5daeb239e..9a090f157a50 100644 --- a/webshell/public/nsIContentViewer.h +++ b/webshell/public/nsIContentViewer.h @@ -25,6 +25,7 @@ // Forward declarations... class nsIDeviceContext; +class nsIPref; class nsString; struct nsRect; class nsIContentViewerContainer; @@ -48,6 +49,7 @@ public: */ NS_IMETHOD Init(nsNativeWidget aNativeParent, nsIDeviceContext* aDeviceContext, + nsIPref* aPrefs, const nsRect& aBounds, nsScrollPreference aScrolling = nsScrollPreference_kAuto)=0; diff --git a/webshell/public/nsIWebShell.h b/webshell/public/nsIWebShell.h index 3a193d2a31cd..d6b3613e050d 100644 --- a/webshell/public/nsIWebShell.h +++ b/webshell/public/nsIWebShell.h @@ -30,6 +30,7 @@ class nsIStreamObserver; class nsIDocumentLoader; class nsIWebShell; class nsIWebShellContainer; +class nsIPref; // Interface ID for nsIWebShell #define NS_IWEB_SHELL_IID \ @@ -109,6 +110,9 @@ public: NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult) = 0; + NS_IMETHOD SetPrefs(nsIPref* aPrefs) = 0; + NS_IMETHOD GetPrefs(nsIPref*& aPrefs) = 0; + NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult) = 0; NS_IMETHOD SetParent(nsIWebShell* aParent) = 0; NS_IMETHOD GetParent(nsIWebShell*& aParent) = 0; diff --git a/webshell/src/Makefile b/webshell/src/Makefile index d6a9f52aa3fb..397b4d6071d9 100644 --- a/webshell/src/Makefile +++ b/webshell/src/Makefile @@ -22,7 +22,7 @@ LIBRARY_NAME = raptorwebwidget MODULE=raptor -REQUIRES=xpcom raptor dom js plugin java netlib +REQUIRES=xpcom raptor dom js plugin java netlib pref EXTRA_DSO_LDOPTS += -lm diff --git a/webshell/src/makefile.win b/webshell/src/makefile.win index 78558ac14baa..c9a5167df9dd 100644 --- a/webshell/src/makefile.win +++ b/webshell/src/makefile.win @@ -39,7 +39,7 @@ CPP_OBJS= \ LINCS=-I..\public -I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \ -I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib \ - -I$(PUBLIC)\plugin -I$(PUBLIC)\java + -I$(PUBLIC)\plugin -I$(PUBLIC)\java -I$(PUBLIC)\pref MAKE_OBJ_TYPE = DLL DLLNAME = raptorweb diff --git a/webshell/src/nsDocumentViewer.cpp b/webshell/src/nsDocumentViewer.cpp index c8c08381be60..a8ca5bfbd622 100644 --- a/webshell/src/nsDocumentViewer.cpp +++ b/webshell/src/nsDocumentViewer.cpp @@ -60,6 +60,7 @@ public: // nsIContentViewer interface... NS_IMETHOD Init(nsNativeWidget aParent, nsIDeviceContext* aDeviceContext, + nsIPref* aPrefs, const nsRect& aBounds, nsScrollPreference aScrolling = nsScrollPreference_kAuto); @@ -245,6 +246,7 @@ DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult) NS_IMETHODIMP DocumentViewerImpl::Init(nsNativeWidget aNativeParent, nsIDeviceContext* aDeviceContext, + nsIPref* aPrefs, const nsRect& aBounds, nsScrollPreference aScrolling) { @@ -260,7 +262,7 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent, return rv; } - mPresContext->Init(aDeviceContext); + mPresContext->Init(aDeviceContext, aPrefs); rv = Init(aNativeParent, aBounds, mDocument, mPresContext, aScrolling); // Init(...) will addref the Presentation Context... diff --git a/webshell/src/nsWebShell.cpp b/webshell/src/nsWebShell.cpp index a6b1e3694cb9..b09e5c4736aa 100644 --- a/webshell/src/nsWebShell.cpp +++ b/webshell/src/nsWebShell.cpp @@ -34,6 +34,7 @@ #include "nsplugin.h" #include "nsIPluginHost.h" #include "nsPluginsCID.h" +#include "nsIPref.h" #include "prlog.h" @@ -107,6 +108,8 @@ public: NS_IMETHOD SetObserver(nsIStreamObserver* anObserver); NS_IMETHOD GetObserver(nsIStreamObserver*& aResult); NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult); + NS_IMETHOD SetPrefs(nsIPref* aPrefs); + NS_IMETHOD GetPrefs(nsIPref*& aPrefs); NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult); NS_IMETHOD SetParent(nsIWebShell* aParent); NS_IMETHOD GetParent(nsIWebShell*& aParent); @@ -167,6 +170,7 @@ protected: nsIWebShellContainer* mContainer; nsIContentViewer* mContentViewer; nsIDeviceContext* mDeviceContext; + nsIPref* mPrefs; nsIWidget* mWindow; nsISupports* mInnerWindow; nsIDocumentLoader* mDocLoader; @@ -265,6 +269,8 @@ nsWebShell::~nsWebShell() NS_IF_RELEASE(mInnerWindow); NS_IF_RELEASE(mContentViewer); + NS_IF_RELEASE(mDeviceContext); + NS_IF_RELEASE(mPrefs); NS_IF_RELEASE(mContainer); NS_IF_RELEASE(mObserver); @@ -375,6 +381,7 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer, bounds.x = bounds.y = 0; rv = mContentViewer->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), mDeviceContext, + mPrefs, bounds, mScrollPref); if (NS_OK == rv) { @@ -395,7 +402,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent, //XXX make sure plugins have started up. this really needs to //be associated with the nsIContentViewerContainer interfaces, //not the nsIWebShell interfaces. this is a hack. MMP - CreatePluginHost(); +// CreatePluginHost(); mScrollPref = aScrolling; @@ -615,6 +622,22 @@ nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult) return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE; } +NS_IMETHODIMP +nsWebShell::SetPrefs(nsIPref* aPrefs) +{ + NS_IF_RELEASE(mPrefs); + mPrefs = aPrefs; + NS_IF_ADDREF(mPrefs); + return NS_OK; +} + +NS_IMETHODIMP +nsWebShell::GetPrefs(nsIPref*& aPrefs) +{ + aPrefs = mPrefs; + NS_IF_ADDREF(aPrefs); + return NS_OK; +} nsresult nsWebShell::GetRootWebShell(nsIWebShell*& aResult) diff --git a/webshell/tests/viewer/nsBrowserWindow.h b/webshell/tests/viewer/nsBrowserWindow.h index 1dc34a40103f..4e1b1bed2f0a 100644 --- a/webshell/tests/viewer/nsBrowserWindow.h +++ b/webshell/tests/viewer/nsBrowserWindow.h @@ -59,6 +59,7 @@ public: // nsIBrowserWindow NS_IMETHOD Init(nsIAppShell* aAppShell, + nsIPref* aPrefs, const nsRect& aBounds, PRUint32 aChromeMask); NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY); diff --git a/webshell/tests/viewer/nsViewerApp.cpp b/webshell/tests/viewer/nsViewerApp.cpp index 87ca20a8e31a..df895d3c68e4 100644 --- a/webshell/tests/viewer/nsViewerApp.cpp +++ b/webshell/tests/viewer/nsViewerApp.cpp @@ -347,7 +347,7 @@ nsViewerApp::OpenWindow() kIBrowserWindowIID, (void**) &bw); bw->SetApp(this); - bw->Init(mAppShell, nsRect(0, 0, 620, 400), PRUint32(~0)); + bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0)); bw->Show(); mCrawler->SetBrowserWindow(bw);