diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 534f8538f56..ff9d218fad3 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -704,7 +704,9 @@ protected: // document management data // these items are specific to markup documents (html and xml) // may consider splitting these out into a subclass - PRBool mAllowPlugins; + PRPackedBool mAllowPlugins; + PRPackedBool mIsSticky; + /* character set member data */ nsString mDefaultCharacterSet; nsString mHintCharset; @@ -1087,11 +1089,10 @@ void DocumentViewerImpl::PrepareToStartLoad() { } DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext) - : mPresContext(aPresContext) + : mPresContext(aPresContext), mAllowPlugins(PR_TRUE), mIsSticky(PR_FALSE) { NS_INIT_ISUPPORTS(); mHintCharsetSource = kCharsetUninitialized; - mAllowPlugins = PR_TRUE; PrepareToStartLoad(); } @@ -6124,6 +6125,14 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) mPrt->mPrintDC->SetTextZoom(1.0f); mPrt->mPrintDC->SetZoom(1.0f); + if (mIsSticky) { + // This window is sticky, that means that it might be shown again + // and we don't want the presshell n' all that to be thrown away + // just because the window is hidden. + + return NS_OK; + } + if (mDeviceContext) { mDeviceContext->SetUseAltDC(kUseAltDCFor_FONTMETRICS, PR_TRUE); mDeviceContext->SetUseAltDC(kUseAltDCFor_CREATERC_REFLOW, PR_TRUE); @@ -6903,6 +6912,22 @@ DocumentViewerImpl::CallChildren(CallChildFunc aFunc, void* aClosure) return NS_OK; } +NS_IMETHODIMP +DocumentViewerImpl::GetSticky(PRBool *aSticky) +{ + *aSticky = mIsSticky; + + return NS_OK; +} + +NS_IMETHODIMP +DocumentViewerImpl::SetSticky(PRBool aSticky) +{ + mIsSticky = aSticky; + + return NS_OK; +} + struct TextZoomInfo { float mTextZoom; diff --git a/mozilla/docshell/base/nsIContentViewer.idl b/mozilla/docshell/base/nsIContentViewer.idl index 98dbf307562..6b2b00fcba3 100644 --- a/mozilla/docshell/base/nsIContentViewer.idl +++ b/mozilla/docshell/base/nsIContentViewer.idl @@ -57,4 +57,6 @@ interface nsIContentViewer : nsISupports void hide(); attribute boolean enableRendering; + + attribute boolean sticky; }; diff --git a/mozilla/modules/plugin/base/src/nsPluginViewer.cpp b/mozilla/modules/plugin/base/src/nsPluginViewer.cpp index 3c176a03170..53b0e4048df 100644 --- a/mozilla/modules/plugin/base/src/nsPluginViewer.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginViewer.cpp @@ -705,6 +705,20 @@ PluginViewerImpl::GetEnableRendering(PRBool* aResult) return NS_OK; } +NS_IMETHODIMP +PluginViewerImpl::SetSticky(PRBool aSticky) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +PluginViewerImpl::GetSticky(PRBool *aSticky) +{ + *aSticky = PR_FALSE; + + return NS_OK; +} + void PluginViewerImpl::ForceRefresh() {