diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index 3aebe4a4702..256d5eab949 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -345,10 +345,6 @@ public: void OnStartPrinting(); nsCOMPtr mPrintDC; - nsCOMPtr mPrintPC; - nsCOMPtr mPrintSS; - nsCOMPtr mPrintPS; - nsCOMPtr mPrintVM; nsIView *mPrintView; FILE *mFilePointer; // a file where information can go to when printing @@ -719,19 +715,13 @@ PrintData::~PrintData() // printing is complete, clean up now - if (mPrintPS) { - // XXX we never call BeginObservingDocument on this pres shell. - mPrintPS->EndObservingDocument(); - mPrintPS->Destroy(); - } - OnEndPrinting(NS_OK); // removes listener - if (mPrintPS) { - mPrintDC->EndDocument(); + if (mPrintDC) { #ifdef DEBUG_PRINTING fprintf(mDebugFD, "****************** End Document ************************\n"); #endif + mPrintDC->EndDocument(); } delete mPrintObject; @@ -2839,6 +2829,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO) NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE); presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE); + // set it on the new pres shell + aPO->mPresShell->SetHistoryState(layoutState); + aPO->mPresShell->BeginObservingDocument(); nsMargin margin(0,0,0,0); @@ -2877,12 +2870,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO) } aPO->mPresContext->SetPageDim(&adjRect); - // XXX replace this line with the commented one below when bug 101264 is fixed - // By doing an intitial reflow with an unconstrained height, we avoid doing a - // resize reflow where frames have already been split and avoid buggy pull up code. - // See also bug 101264 in nsSimplePageSequencer::Reflow. - rv = aPO->mPresShell->InitialReflow(width, NS_MAXSIZE); - //rv = aPO->mPresShell->InitialReflow(width, height); + rv = aPO->mPresShell->InitialReflow(width, height); if (NS_SUCCEEDED(rv)) { // Transfer Selection Ranges to the new Print PresShell @@ -2918,22 +2906,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO) fclose(fd); } #endif - - // update the history from the old presentation shell - nsCOMPtr fm; - rv = aPO->mPresShell->GetFrameManager(getter_AddRefs(fm)); - if(NS_SUCCEEDED(rv) && fm) { - nsIFrame* root; - aPO->mPresShell->GetRootFrame(&root); - fm->RestoreFrameState(aPO->mPresContext, root, layoutState); - } } aPO->mPresShell->EndObservingDocument(); - // EndObserving document no longer does a reflow.. which history needs.. or we - // get a blank page for text fields. this will reflow.. fixes bug 84017. - // XXX remove this line when bug 101264 is fixed - aPO->mPresShell->ResizeReflow(width, height); return rv; } @@ -4407,85 +4382,6 @@ nsresult rv; NS_RELEASE(devspec); if(webContainer) { - // load the document and do the initial reflow on the entire document - nsCOMPtr printcon(do_CreateInstance(kPrintContextCID, &rv)); - if (NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } else { - mPrt->mPrintPC = do_QueryInterface(printcon, &rv); - if (NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - } - - - PRInt32 width, height; - mPrt->mPrintDC->GetDeviceSurfaceDimensions(width,height); - // XXX - Hack Alert - // OK, so ther eis a selection, we will print the entire selection - // on one page and then crop the page. - // This means you can never print any selection that is longer than one page - // put it keeps it from page breaking in the middle of your print of the selection - if (isSelection) { - //height = 0x0FFFFFFF; - } - - mPrt->mPrintPC->Init(mPrt->mPrintDC); - mPrt->mPrintPC->SetContainer(webContainer); - CreateStyleSet(mDocument, getter_AddRefs(mPrt->mPrintSS)); - - mPrt->mPrintPS = do_CreateInstance(kPresShellCID, &rv); - if(NS_FAILED(rv)){ - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - mPrt->mPrintVM = do_CreateInstance(kViewManagerCID, &rv); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - rv = mPrt->mPrintVM->Init(mPrt->mPrintDC); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - rv = CallCreateInstance(kViewCID, &mPrt->mPrintView); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - nsRect tbounds = nsRect(0,0,width,height); - rv = mPrt->mPrintView->Init(mPrt->mPrintVM,tbounds,nsnull); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - // setup hierarchical relationship in view manager - mPrt->mPrintVM->SetRootView(mPrt->mPrintView); - mPrt->mPrintPS->Init(mDocument,mPrt->mPrintPC,mPrt->mPrintVM,mPrt->mPrintSS); - - // Compatability mode must be set in the mPrintPC or the document - // will be printed in "Standard" mode even if it was a "Quirks" doc - nsCompatibility mode; - mPresContext->GetCompatibilityMode(&mode); - mPrt->mPrintPC->SetCompatibilityMode(mode); - - mPrt->mPrintPS->InitialReflow(width,height); - #ifdef DEBUG_dcone float a1,a2; PRInt32 i1,i2; diff --git a/content/events/src/Makefile.in b/content/events/src/Makefile.in index 054a55e3de6..8f6aca382d0 100644 --- a/content/events/src/Makefile.in +++ b/content/events/src/Makefile.in @@ -44,6 +44,7 @@ REQUIRES = xpcom \ pref \ htmlparser \ view \ + necko \ $(NULL) CPPSRCS = \ diff --git a/content/events/src/makefile.win b/content/events/src/makefile.win index ee822d73356..179c2238f66 100644 --- a/content/events/src/makefile.win +++ b/content/events/src/makefile.win @@ -42,6 +42,7 @@ REQUIRES = xpcom \ gfx \ layout \ layout_xul \ + necko \ $(NULL) include <$(DEPTH)\config\config.mak> diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp index 93dd74515f4..d5dc88d68c2 100644 --- a/content/html/content/src/nsHTMLImageElement.cpp +++ b/content/html/content/src/nsHTMLImageElement.cpp @@ -941,7 +941,7 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, doc->GetDocumentLoadGroup(getter_AddRefs(loadGroup)); } - il->LoadImage(uri, loadGroup, this, sup, nsIRequest::LOAD_NORMAL, getter_AddRefs(mRequest)); + il->LoadImage(uri, loadGroup, this, sup, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(mRequest)); } } diff --git a/content/xbl/src/nsXBLPrototypeBinding.cpp b/content/xbl/src/nsXBLPrototypeBinding.cpp index 62a121fdb5c..72fe9c2a7e6 100644 --- a/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -535,7 +535,7 @@ nsXBLPrototypeBinding::LoadResources(PRBool* aResult) // Now kick off the image load nsCOMPtr req; - il->LoadImage(url, nsnull, nsnull, nsnull, nsIRequest::LOAD_BACKGROUND, getter_AddRefs(req)); + il->LoadImage(url, nsnull, nsnull, nsnull, nsIRequest::LOAD_BACKGROUND, nsnull, getter_AddRefs(req)); } else #endif diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 3aebe4a4702..256d5eab949 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -345,10 +345,6 @@ public: void OnStartPrinting(); nsCOMPtr mPrintDC; - nsCOMPtr mPrintPC; - nsCOMPtr mPrintSS; - nsCOMPtr mPrintPS; - nsCOMPtr mPrintVM; nsIView *mPrintView; FILE *mFilePointer; // a file where information can go to when printing @@ -719,19 +715,13 @@ PrintData::~PrintData() // printing is complete, clean up now - if (mPrintPS) { - // XXX we never call BeginObservingDocument on this pres shell. - mPrintPS->EndObservingDocument(); - mPrintPS->Destroy(); - } - OnEndPrinting(NS_OK); // removes listener - if (mPrintPS) { - mPrintDC->EndDocument(); + if (mPrintDC) { #ifdef DEBUG_PRINTING fprintf(mDebugFD, "****************** End Document ************************\n"); #endif + mPrintDC->EndDocument(); } delete mPrintObject; @@ -2839,6 +2829,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO) NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE); presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE); + // set it on the new pres shell + aPO->mPresShell->SetHistoryState(layoutState); + aPO->mPresShell->BeginObservingDocument(); nsMargin margin(0,0,0,0); @@ -2877,12 +2870,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO) } aPO->mPresContext->SetPageDim(&adjRect); - // XXX replace this line with the commented one below when bug 101264 is fixed - // By doing an intitial reflow with an unconstrained height, we avoid doing a - // resize reflow where frames have already been split and avoid buggy pull up code. - // See also bug 101264 in nsSimplePageSequencer::Reflow. - rv = aPO->mPresShell->InitialReflow(width, NS_MAXSIZE); - //rv = aPO->mPresShell->InitialReflow(width, height); + rv = aPO->mPresShell->InitialReflow(width, height); if (NS_SUCCEEDED(rv)) { // Transfer Selection Ranges to the new Print PresShell @@ -2918,22 +2906,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO) fclose(fd); } #endif - - // update the history from the old presentation shell - nsCOMPtr fm; - rv = aPO->mPresShell->GetFrameManager(getter_AddRefs(fm)); - if(NS_SUCCEEDED(rv) && fm) { - nsIFrame* root; - aPO->mPresShell->GetRootFrame(&root); - fm->RestoreFrameState(aPO->mPresContext, root, layoutState); - } } aPO->mPresShell->EndObservingDocument(); - // EndObserving document no longer does a reflow.. which history needs.. or we - // get a blank page for text fields. this will reflow.. fixes bug 84017. - // XXX remove this line when bug 101264 is fixed - aPO->mPresShell->ResizeReflow(width, height); return rv; } @@ -4407,85 +4382,6 @@ nsresult rv; NS_RELEASE(devspec); if(webContainer) { - // load the document and do the initial reflow on the entire document - nsCOMPtr printcon(do_CreateInstance(kPrintContextCID, &rv)); - if (NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } else { - mPrt->mPrintPC = do_QueryInterface(printcon, &rv); - if (NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - } - - - PRInt32 width, height; - mPrt->mPrintDC->GetDeviceSurfaceDimensions(width,height); - // XXX - Hack Alert - // OK, so ther eis a selection, we will print the entire selection - // on one page and then crop the page. - // This means you can never print any selection that is longer than one page - // put it keeps it from page breaking in the middle of your print of the selection - if (isSelection) { - //height = 0x0FFFFFFF; - } - - mPrt->mPrintPC->Init(mPrt->mPrintDC); - mPrt->mPrintPC->SetContainer(webContainer); - CreateStyleSet(mDocument, getter_AddRefs(mPrt->mPrintSS)); - - mPrt->mPrintPS = do_CreateInstance(kPresShellCID, &rv); - if(NS_FAILED(rv)){ - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - mPrt->mPrintVM = do_CreateInstance(kViewManagerCID, &rv); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - rv = mPrt->mPrintVM->Init(mPrt->mPrintDC); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - rv = CallCreateInstance(kViewCID, &mPrt->mPrintView); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - nsRect tbounds = nsRect(0,0,width,height); - rv = mPrt->mPrintView->Init(mPrt->mPrintVM,tbounds,nsnull); - if(NS_FAILED(rv)) { - gCurrentlyPrinting = PR_FALSE; - ShowPrintErrorDialog(rv); - return rv; - } - - // setup hierarchical relationship in view manager - mPrt->mPrintVM->SetRootView(mPrt->mPrintView); - mPrt->mPrintPS->Init(mDocument,mPrt->mPrintPC,mPrt->mPrintVM,mPrt->mPrintSS); - - // Compatability mode must be set in the mPrintPC or the document - // will be printed in "Standard" mode even if it was a "Quirks" doc - nsCompatibility mode; - mPresContext->GetCompatibilityMode(&mode); - mPrt->mPrintPC->SetCompatibilityMode(mode); - - mPrt->mPrintPS->InitialReflow(width,height); - #ifdef DEBUG_dcone float a1,a2; PRInt32 i1,i2; diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index 961d2297afc..9973fd6f61f 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -2167,6 +2167,11 @@ FrameManager::RestoreFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFram nsresult rv = NS_OK; nsCOMPtr content; rv = aFrame->GetContent(getter_AddRefs(content)); + // If we don't have content, we can't generate a hash + // key and there's probably no state information for us. + if (!content) { + return rv; + } nsCAutoString stateKey; rv = GenerateStateKey(content, aID, stateKey); diff --git a/layout/base/nsImageLoader.cpp b/layout/base/nsImageLoader.cpp index 716160704c0..696b35f8fe6 100644 --- a/layout/base/nsImageLoader.cpp +++ b/layout/base/nsImageLoader.cpp @@ -119,7 +119,7 @@ nsImageLoader::Load(const nsAReadableString &aURI) if (NS_FAILED(rv)) return rv; return il->LoadImage(uri, loadGroup, NS_STATIC_CAST(imgIDecoderObserver *, this), - nsnull, nsIRequest::LOAD_BACKGROUND, getter_AddRefs(mRequest)); + nsnull, nsIRequest::LOAD_BACKGROUND, nsnull, getter_AddRefs(mRequest)); } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 8f60491ad3e..257e8c6bcfb 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1332,6 +1332,13 @@ nsPresContext::GetDeviceContext(nsIDeviceContext** aResult) const return NS_OK; } +NS_IMETHODIMP +nsPresContext::GetImageLoadFlags(nsLoadFlags& aLoadFlags) +{ + aLoadFlags = nsIRequest::LOAD_NORMAL; + return NS_OK; +} + NS_IMETHODIMP nsPresContext::LoadImage(const nsString& aURL, nsIFrame* aTargetFrame, diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index e9a2ef96763..35ac8d2cabb 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -42,6 +42,7 @@ #include "nsColor.h" #include "nsCoord.h" #include "nsAWritableString.h" +#include "nsIRequest.h" #ifdef IBMBIDI class nsBidiPresUtils; #endif // IBMBIDI @@ -165,6 +166,11 @@ public: NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0; NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 0; + /** + * Get an special load flags for images for this context + */ + NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags) = 0; + /** * Get look and feel object */ diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 1202dbf2aa3..7214a1778d2 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2630,6 +2630,11 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } if (rootFrame) { + nsCOMPtr historyState = do_QueryReferent(mHistoryState); + if (historyState) { + mFrameManager->RestoreFrameState(mPresContext, rootFrame, historyState); + } + MOZ_TIMER_DEBUGLOG(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this)); MOZ_TIMER_RESET(mReflowWatch); MOZ_TIMER_START(mReflowWatch); diff --git a/layout/base/public/nsIPresContext.h b/layout/base/public/nsIPresContext.h index e9a2ef96763..35ac8d2cabb 100644 --- a/layout/base/public/nsIPresContext.h +++ b/layout/base/public/nsIPresContext.h @@ -42,6 +42,7 @@ #include "nsColor.h" #include "nsCoord.h" #include "nsAWritableString.h" +#include "nsIRequest.h" #ifdef IBMBIDI class nsBidiPresUtils; #endif // IBMBIDI @@ -165,6 +166,11 @@ public: NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0; NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 0; + /** + * Get an special load flags for images for this context + */ + NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags) = 0; + /** * Get look and feel object */ diff --git a/layout/base/public/nsPresContext.h b/layout/base/public/nsPresContext.h index e9a2ef96763..35ac8d2cabb 100644 --- a/layout/base/public/nsPresContext.h +++ b/layout/base/public/nsPresContext.h @@ -42,6 +42,7 @@ #include "nsColor.h" #include "nsCoord.h" #include "nsAWritableString.h" +#include "nsIRequest.h" #ifdef IBMBIDI class nsBidiPresUtils; #endif // IBMBIDI @@ -165,6 +166,11 @@ public: NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0; NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 0; + /** + * Get an special load flags for images for this context + */ + NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags) = 0; + /** * Get look and feel object */ diff --git a/layout/base/src/nsImageLoader.cpp b/layout/base/src/nsImageLoader.cpp index 716160704c0..696b35f8fe6 100644 --- a/layout/base/src/nsImageLoader.cpp +++ b/layout/base/src/nsImageLoader.cpp @@ -119,7 +119,7 @@ nsImageLoader::Load(const nsAReadableString &aURI) if (NS_FAILED(rv)) return rv; return il->LoadImage(uri, loadGroup, NS_STATIC_CAST(imgIDecoderObserver *, this), - nsnull, nsIRequest::LOAD_BACKGROUND, getter_AddRefs(mRequest)); + nsnull, nsIRequest::LOAD_BACKGROUND, nsnull, getter_AddRefs(mRequest)); } diff --git a/layout/base/src/nsPresContext.cpp b/layout/base/src/nsPresContext.cpp index 8f60491ad3e..257e8c6bcfb 100644 --- a/layout/base/src/nsPresContext.cpp +++ b/layout/base/src/nsPresContext.cpp @@ -1332,6 +1332,13 @@ nsPresContext::GetDeviceContext(nsIDeviceContext** aResult) const return NS_OK; } +NS_IMETHODIMP +nsPresContext::GetImageLoadFlags(nsLoadFlags& aLoadFlags) +{ + aLoadFlags = nsIRequest::LOAD_NORMAL; + return NS_OK; +} + NS_IMETHODIMP nsPresContext::LoadImage(const nsString& aURL, nsIFrame* aTargetFrame, diff --git a/layout/base/src/nsPresContext.h b/layout/base/src/nsPresContext.h index 3951223eaaf..507bf3841db 100644 --- a/layout/base/src/nsPresContext.h +++ b/layout/base/src/nsPresContext.h @@ -74,6 +74,7 @@ public: NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode); NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult); NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode); + NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags); NS_IMETHOD GetLookAndFeel(nsILookAndFeel** aLookAndFeel); NS_IMETHOD GetBaseURL(nsIURI** aURLResult); NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0; diff --git a/layout/base/src/nsPrintContext.cpp b/layout/base/src/nsPrintContext.cpp index 0cd9e1ad0a7..148a54ee8e7 100644 --- a/layout/base/src/nsPrintContext.cpp +++ b/layout/base/src/nsPrintContext.cpp @@ -57,6 +57,7 @@ public: PrintContext(); ~PrintContext(); + NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags); NS_IMETHOD GetMedium(nsIAtom** aMedium); NS_IMETHOD IsPaginated(PRBool* aResult); NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect); @@ -93,7 +94,12 @@ PrintContext::QueryInterface(REFNSIID aIID, void** aInstancePtr) return nsPresContext::QueryInterface(aIID, aInstancePtr); } - +NS_IMETHODIMP +PrintContext::GetImageLoadFlags(nsLoadFlags& aLoadFlags) +{ + aLoadFlags = nsIRequest::LOAD_FROM_CACHE | nsIRequest::VALIDATE_NEVER | nsIRequest::LOAD_NORMAL; + return NS_OK; +} NS_IMETHODIMP PrintContext::GetMedium(nsIAtom** aResult) diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index 63ab0505dda..e66ad033051 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -40,6 +40,7 @@ REQUIRES = xpcom \ widget \ locale \ timer \ + necko \ $(NULL) CPPSRCS = \ diff --git a/layout/build/makefile.win b/layout/build/makefile.win index 7431ff1f898..8d4952bb426 100644 --- a/layout/build/makefile.win +++ b/layout/build/makefile.win @@ -29,6 +29,7 @@ REQUIRES = xpcom \ gfx \ content \ layout_xul \ + necko \ $(NULL) include <$(DEPTH)/config/config.mak> diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 8f1f34d3cb4..a95d05fbc8b 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -145,7 +145,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext, NS_RELEASE(listener); } - il->LoadImage(imgURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, getter_AddRefs(mImageRequest)); + il->LoadImage(imgURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(mImageRequest)); } return NS_OK; @@ -1383,7 +1383,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr loadGroup; GetLoadGroup(aPresContext, getter_AddRefs(loadGroup)); - il->LoadImage(newURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, getter_AddRefs(mImageRequest)); + il->LoadImage(newURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(mImageRequest)); } } } diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 3523e47e13d..7258bbc76c9 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1547,6 +1547,11 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon nsCOMPtr loadGroup; GetLoadGroup(aPresContext, getter_AddRefs(loadGroup)); + nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL; + if (aPresContext) { + aPresContext->GetImageLoadFlags(loadFlags); + } + /* get the URI, convert internal-gopher-stuff if needed */ nsCOMPtr uri; GetURI(aSpec, getter_AddRefs(uri)); @@ -1556,7 +1561,7 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon /* set this back to FALSE before we do the real load */ mInitialLoadCompleted = PR_FALSE; - return il->LoadImage(uri, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, aRequest); + return il->LoadImage(uri, loadGroup, mListener, aPresContext, loadFlags, nsnull, aRequest); } #define INTERNAL_GOPHER_LENGTH 16 /* "internal-gopher-" length */ diff --git a/layout/generic/nsSimplePageSequence.cpp b/layout/generic/nsSimplePageSequence.cpp index 2c18a3ec57a..00356e9fa00 100644 --- a/layout/generic/nsSimplePageSequence.cpp +++ b/layout/generic/nsSimplePageSequence.cpp @@ -304,12 +304,6 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, nsRect adjSize; aPresContext->GetPageDim(&pageSize, &adjSize); - // XXX remove these 4 lines when bug 101264 is fixed. See also bug 101264 in nsDocumentViewer::ReflowPrintObject - if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { - pageSize.height = NS_UNCONSTRAINEDSIZE; - adjSize.height = NS_UNCONSTRAINEDSIZE; - } - PRBool suppressLeftMargin = PR_FALSE; PRBool suppressRightMargin = PR_FALSE; PRBool suppressTopMargin = PR_FALSE; @@ -382,11 +376,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, availSize, reflowReason); nsReflowStatus status; kidReflowState.availableWidth = pageSize.width - margin.left - margin.right; - // XXX remove these 3 lines when bug 101264 is fixed. See also bug 101264 in nsDocumentViewer::ReflowPrintObject - if (NS_UNCONSTRAINEDSIZE != pageSize.height) { - kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom; - } - //kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom; + kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom; kidReflowState.mComputedWidth = kidReflowState.availableWidth; //kidReflowState.mComputedHeight = kidReflowState.availableHeight; diff --git a/layout/html/base/src/nsBulletFrame.cpp b/layout/html/base/src/nsBulletFrame.cpp index 8f1f34d3cb4..a95d05fbc8b 100644 --- a/layout/html/base/src/nsBulletFrame.cpp +++ b/layout/html/base/src/nsBulletFrame.cpp @@ -145,7 +145,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext, NS_RELEASE(listener); } - il->LoadImage(imgURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, getter_AddRefs(mImageRequest)); + il->LoadImage(imgURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(mImageRequest)); } return NS_OK; @@ -1383,7 +1383,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr loadGroup; GetLoadGroup(aPresContext, getter_AddRefs(loadGroup)); - il->LoadImage(newURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, getter_AddRefs(mImageRequest)); + il->LoadImage(newURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(mImageRequest)); } } } diff --git a/layout/html/base/src/nsFrameManager.cpp b/layout/html/base/src/nsFrameManager.cpp index 961d2297afc..9973fd6f61f 100644 --- a/layout/html/base/src/nsFrameManager.cpp +++ b/layout/html/base/src/nsFrameManager.cpp @@ -2167,6 +2167,11 @@ FrameManager::RestoreFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFram nsresult rv = NS_OK; nsCOMPtr content; rv = aFrame->GetContent(getter_AddRefs(content)); + // If we don't have content, we can't generate a hash + // key and there's probably no state information for us. + if (!content) { + return rv; + } nsCAutoString stateKey; rv = GenerateStateKey(content, aID, stateKey); diff --git a/layout/html/base/src/nsImageFrame.cpp b/layout/html/base/src/nsImageFrame.cpp index 3523e47e13d..7258bbc76c9 100644 --- a/layout/html/base/src/nsImageFrame.cpp +++ b/layout/html/base/src/nsImageFrame.cpp @@ -1547,6 +1547,11 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon nsCOMPtr loadGroup; GetLoadGroup(aPresContext, getter_AddRefs(loadGroup)); + nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL; + if (aPresContext) { + aPresContext->GetImageLoadFlags(loadFlags); + } + /* get the URI, convert internal-gopher-stuff if needed */ nsCOMPtr uri; GetURI(aSpec, getter_AddRefs(uri)); @@ -1556,7 +1561,7 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon /* set this back to FALSE before we do the real load */ mInitialLoadCompleted = PR_FALSE; - return il->LoadImage(uri, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, aRequest); + return il->LoadImage(uri, loadGroup, mListener, aPresContext, loadFlags, nsnull, aRequest); } #define INTERNAL_GOPHER_LENGTH 16 /* "internal-gopher-" length */ diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 1202dbf2aa3..7214a1778d2 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -2630,6 +2630,11 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } if (rootFrame) { + nsCOMPtr historyState = do_QueryReferent(mHistoryState); + if (historyState) { + mFrameManager->RestoreFrameState(mPresContext, rootFrame, historyState); + } + MOZ_TIMER_DEBUGLOG(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this)); MOZ_TIMER_RESET(mReflowWatch); MOZ_TIMER_START(mReflowWatch); diff --git a/layout/html/base/src/nsSimplePageSequence.cpp b/layout/html/base/src/nsSimplePageSequence.cpp index 2c18a3ec57a..00356e9fa00 100644 --- a/layout/html/base/src/nsSimplePageSequence.cpp +++ b/layout/html/base/src/nsSimplePageSequence.cpp @@ -304,12 +304,6 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, nsRect adjSize; aPresContext->GetPageDim(&pageSize, &adjSize); - // XXX remove these 4 lines when bug 101264 is fixed. See also bug 101264 in nsDocumentViewer::ReflowPrintObject - if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { - pageSize.height = NS_UNCONSTRAINEDSIZE; - adjSize.height = NS_UNCONSTRAINEDSIZE; - } - PRBool suppressLeftMargin = PR_FALSE; PRBool suppressRightMargin = PR_FALSE; PRBool suppressTopMargin = PR_FALSE; @@ -382,11 +376,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, availSize, reflowReason); nsReflowStatus status; kidReflowState.availableWidth = pageSize.width - margin.left - margin.right; - // XXX remove these 3 lines when bug 101264 is fixed. See also bug 101264 in nsDocumentViewer::ReflowPrintObject - if (NS_UNCONSTRAINEDSIZE != pageSize.height) { - kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom; - } - //kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom; + kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom; kidReflowState.mComputedWidth = kidReflowState.availableWidth; //kidReflowState.mComputedHeight = kidReflowState.availableHeight; diff --git a/layout/html/table/src/Makefile.in b/layout/html/table/src/Makefile.in index 3e35661d561..6719553f238 100644 --- a/layout/html/table/src/Makefile.in +++ b/layout/html/table/src/Makefile.in @@ -38,6 +38,7 @@ REQUIRES = xpcom \ webshell \ view \ accessibility \ + necko \ $(NULL) CPPSRCS = \ diff --git a/layout/html/table/src/makefile.win b/layout/html/table/src/makefile.win index 795e99ccdbb..ee586876292 100644 --- a/layout/html/table/src/makefile.win +++ b/layout/html/table/src/makefile.win @@ -33,6 +33,7 @@ REQUIRES = xpcom \ accessibility \ gfx \ content \ + necko \ $(NULL) diff --git a/layout/xul/base/src/nsImageBoxFrame.cpp b/layout/xul/base/src/nsImageBoxFrame.cpp index 2203a783d88..ded1ba22e41 100644 --- a/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/layout/xul/base/src/nsImageBoxFrame.cpp @@ -287,7 +287,7 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize) nsCOMPtr loadGroup; GetLoadGroup(aPresContext, getter_AddRefs(loadGroup)); - il->LoadImage(srcURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, getter_AddRefs(mImageRequest)); + il->LoadImage(srcURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(mImageRequest)); aResize = PR_TRUE; diff --git a/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp b/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp index faf8dbf3715..66c21f31212 100644 --- a/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp +++ b/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp @@ -1336,7 +1336,7 @@ nsOutlinerBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID, nsresult rv; nsCOMPtr il(do_GetService("@mozilla.org/image/loader;1", &rv)); - il->LoadImage(srcURI, nsnull, listener, mPresContext, nsIRequest::LOAD_NORMAL, getter_AddRefs(imageRequest)); + il->LoadImage(srcURI, nsnull, listener, mPresContext, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(imageRequest)); if (!mImageCache) { mImageCache = new nsSupportsHashtable(32); diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index faf8dbf3715..66c21f31212 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -1336,7 +1336,7 @@ nsOutlinerBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID, nsresult rv; nsCOMPtr il(do_GetService("@mozilla.org/image/loader;1", &rv)); - il->LoadImage(srcURI, nsnull, listener, mPresContext, nsIRequest::LOAD_NORMAL, getter_AddRefs(imageRequest)); + il->LoadImage(srcURI, nsnull, listener, mPresContext, nsIRequest::LOAD_NORMAL, nsnull, getter_AddRefs(imageRequest)); if (!mImageCache) { mImageCache = new nsSupportsHashtable(32); diff --git a/modules/libpr0n/public/imgILoader.idl b/modules/libpr0n/public/imgILoader.idl index 8fa8f472871..4fb109b50bf 100644 --- a/modules/libpr0n/public/imgILoader.idl +++ b/modules/libpr0n/public/imgILoader.idl @@ -53,8 +53,10 @@ interface imgILoader : nsISupports * @param aObserver the observer * @param aCX some random data * @param aLoadFlags Load flags for the request + * @param aCacheKey cache key to use for a load if the original + * image came from a request that had post data */ - imgIRequest loadImage(in nsIURI aURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags); + imgIRequest loadImage(in nsIURI aURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey); /** * Start the load and decode of an image. diff --git a/modules/libpr0n/src/imgCache.cpp b/modules/libpr0n/src/imgCache.cpp index 2e7500e9d8e..fe3a8eca306 100644 --- a/modules/libpr0n/src/imgCache.cpp +++ b/modules/libpr0n/src/imgCache.cpp @@ -108,8 +108,10 @@ void GetCacheSession(nsIURI *aURI, nsICacheSession **_retval) if (isChrome) gChromeSession = newSession; - else + else { gSession = newSession; + gSession->SetDoomEntriesIfExpired(PR_FALSE); + } *_retval = newSession; NS_ADDREF(*_retval); @@ -172,7 +174,20 @@ PRBool imgCache::Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor return PR_TRUE; } -PRBool imgCache::Get(nsIURI *aKey, imgRequest **aRequest, nsICacheEntryDescriptor **aEntry) +static PRUint32 +SecondsFromPRTime(PRTime prTime) +{ + PRInt64 microSecondsPerSecond, intermediateResult; + PRUint32 seconds; + + LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC); + LL_DIV(intermediateResult, prTime, microSecondsPerSecond); + LL_L2UI(seconds, intermediateResult); + return seconds; +} + + +PRBool imgCache::Get(nsIURI *aKey, PRBool aDoomIfExpired, imgRequest **aRequest, nsICacheEntryDescriptor **aEntry) { LOG_STATIC_FUNC(gImgLog, "imgCache::Get"); @@ -192,6 +207,15 @@ PRBool imgCache::Get(nsIURI *aKey, imgRequest **aRequest, nsICacheEntryDescripto if (NS_FAILED(rv) || !entry) return PR_FALSE; + if (aDoomIfExpired) { + PRUint32 expirationTime; + entry->GetExpirationTime(&expirationTime); + if (expirationTime && (expirationTime <= SecondsFromPRTime(PR_Now()))) { + entry->Doom(); + return PR_FALSE; + } + } + nsCOMPtr sup; entry->GetCacheElement(getter_AddRefs(sup)); diff --git a/modules/libpr0n/src/imgCache.h b/modules/libpr0n/src/imgCache.h index 1e611b496e2..eb184752fff 100644 --- a/modules/libpr0n/src/imgCache.h +++ b/modules/libpr0n/src/imgCache.h @@ -50,7 +50,7 @@ public: /* additional members */ static PRBool Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor **aEntry); - static PRBool Get(nsIURI *aKey, imgRequest **aRequest, nsICacheEntryDescriptor **aEntry); + static PRBool Get(nsIURI *aKey, PRBool aDoomIfExpired, imgRequest **aRequest, nsICacheEntryDescriptor **aEntry); static PRBool Remove(nsIURI *aKey); static nsresult ClearChromeImageCache(); diff --git a/modules/libpr0n/src/imgLoader.cpp b/modules/libpr0n/src/imgLoader.cpp index 5052c598183..0870878961f 100644 --- a/modules/libpr0n/src/imgLoader.cpp +++ b/modules/libpr0n/src/imgLoader.cpp @@ -28,6 +28,7 @@ #include "nsIChannel.h" #include "nsIHttpChannel.h" +#include "nsICachingChannel.h" #include "nsIIOService.h" #include "nsILoadGroup.h" #include "nsIProxyObjectManager.h" @@ -93,8 +94,8 @@ imgLoader::~imgLoader() #define SHOULD_RELOAD(flags) (flags & nsIRequest::LOAD_BYPASS_CACHE || flags & nsIRequest::VALIDATE_ALWAYS) -/* imgIRequest loadImage (in nsIURI aURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags); */ -NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsILoadGroup *aLoadGroup, imgIDecoderObserver *aObserver, nsISupports *aCX, nsLoadFlags aLoadFlags, imgIRequest **_retval) +/* imgIRequest loadImage (in nsIURI aURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports aCacheKey); */ +NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsILoadGroup *aLoadGroup, imgIDecoderObserver *aObserver, nsISupports *aCX, nsLoadFlags aLoadFlags, nsISupports* aCacheKey, imgIRequest **_retval) { NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer"); @@ -109,8 +110,12 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsILoadGroup *aLoadGroup, imgID imgRequest *request = nsnull; + // XXX For now ignore the cache key. We will need it in the future + // for correctly dealing with image load requests that are a result + // of post data. nsCOMPtr entry; - imgCache::Get(aURI, &request, getter_AddRefs(entry)); // addrefs request + imgCache::Get(aURI, !(aLoadFlags & nsIRequest::LOAD_FROM_CACHE), + &request, getter_AddRefs(entry)); // addrefs request if (request && entry) { /* this isn't exactly what I want here. This code will re-doom every @@ -122,7 +127,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsILoadGroup *aLoadGroup, imgID if (SHOULD_RELOAD(aLoadFlags)) { doomRequest = PR_TRUE; - } else if (aLoadGroup) { + } else if (!(aLoadFlags & nsIRequest::LOAD_FROM_CACHE) && + aLoadGroup) { nsLoadFlags flags = 0; aLoadGroup->GetLoadFlags(&flags); if (SHOULD_RELOAD(flags)) { @@ -264,7 +270,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb channel->GetOriginalURI(getter_AddRefs(uri)); nsCOMPtr entry; - imgCache::Get(uri, &request, getter_AddRefs(entry)); // addrefs request + imgCache::Get(uri, PR_TRUE, &request, getter_AddRefs(entry)); // addrefs request if (request) { // we have this in our cache already.. cancel the current (document) load diff --git a/view/src/Makefile.in b/view/src/Makefile.in index e98b974f61b..5d1465a278a 100644 --- a/view/src/Makefile.in +++ b/view/src/Makefile.in @@ -41,6 +41,7 @@ REQUIRES = xpcom \ locale \ timer \ pref \ + necko \ $(NULL) EXTRA_DSO_LIBS = gkgfx diff --git a/view/src/makefile.win b/view/src/makefile.win index 675baafe80c..5bce1bddaea 100644 --- a/view/src/makefile.win +++ b/view/src/makefile.win @@ -34,6 +34,7 @@ REQUIRES = xpcom \ timer \ pref \ content \ + necko \ $(NULL) DEFINES =-D_IMPL_NS_VIEW -DWIN32_LEAN_AND_MEAN