Fixes for printing bugs 84017 and 89151. The fix for bug 84017 removes the need for a resize reflow to get form frame values to print. The restoration of these values into the new frame model is done as part of the initial reflow. The fix for bug 89151 gets rid of the extra frame model built and forces printed images to come out of the decoded image cache. r=darinf, heikki, sr=rpotts
This commit is contained in:
Родитель
883c91c685
Коммит
338e3871f8
|
@ -345,10 +345,6 @@ public:
|
||||||
void OnStartPrinting();
|
void OnStartPrinting();
|
||||||
|
|
||||||
nsCOMPtr<nsIDeviceContext> mPrintDC;
|
nsCOMPtr<nsIDeviceContext> mPrintDC;
|
||||||
nsCOMPtr<nsIPresContext> mPrintPC;
|
|
||||||
nsCOMPtr<nsIStyleSet> mPrintSS;
|
|
||||||
nsCOMPtr<nsIPresShell> mPrintPS;
|
|
||||||
nsCOMPtr<nsIViewManager> mPrintVM;
|
|
||||||
nsIView *mPrintView;
|
nsIView *mPrintView;
|
||||||
FILE *mFilePointer; // a file where information can go to when printing
|
FILE *mFilePointer; // a file where information can go to when printing
|
||||||
|
|
||||||
|
@ -719,19 +715,13 @@ PrintData::~PrintData()
|
||||||
|
|
||||||
// printing is complete, clean up now
|
// 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
|
OnEndPrinting(NS_OK); // removes listener
|
||||||
|
|
||||||
if (mPrintPS) {
|
if (mPrintDC) {
|
||||||
mPrintDC->EndDocument();
|
|
||||||
#ifdef DEBUG_PRINTING
|
#ifdef DEBUG_PRINTING
|
||||||
fprintf(mDebugFD, "****************** End Document ************************\n");
|
fprintf(mDebugFD, "****************** End Document ************************\n");
|
||||||
#endif
|
#endif
|
||||||
|
mPrintDC->EndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete mPrintObject;
|
delete mPrintObject;
|
||||||
|
@ -2839,6 +2829,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO)
|
||||||
NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE);
|
||||||
presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE);
|
presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE);
|
||||||
|
|
||||||
|
// set it on the new pres shell
|
||||||
|
aPO->mPresShell->SetHistoryState(layoutState);
|
||||||
|
|
||||||
aPO->mPresShell->BeginObservingDocument();
|
aPO->mPresShell->BeginObservingDocument();
|
||||||
|
|
||||||
nsMargin margin(0,0,0,0);
|
nsMargin margin(0,0,0,0);
|
||||||
|
@ -2877,12 +2870,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO)
|
||||||
}
|
}
|
||||||
|
|
||||||
aPO->mPresContext->SetPageDim(&adjRect);
|
aPO->mPresContext->SetPageDim(&adjRect);
|
||||||
// XXX replace this line with the commented one below when bug 101264 is fixed
|
rv = aPO->mPresShell->InitialReflow(width, height);
|
||||||
// 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);
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
// Transfer Selection Ranges to the new Print PresShell
|
// Transfer Selection Ranges to the new Print PresShell
|
||||||
|
@ -2918,22 +2906,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO)
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// update the history from the old presentation shell
|
|
||||||
nsCOMPtr<nsIFrameManager> 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();
|
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;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -4407,85 +4382,6 @@ nsresult rv;
|
||||||
NS_RELEASE(devspec);
|
NS_RELEASE(devspec);
|
||||||
|
|
||||||
if(webContainer) {
|
if(webContainer) {
|
||||||
// load the document and do the initial reflow on the entire document
|
|
||||||
nsCOMPtr<nsIPrintContext> 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
|
#ifdef DEBUG_dcone
|
||||||
float a1,a2;
|
float a1,a2;
|
||||||
PRInt32 i1,i2;
|
PRInt32 i1,i2;
|
||||||
|
|
|
@ -44,6 +44,7 @@ REQUIRES = xpcom \
|
||||||
pref \
|
pref \
|
||||||
htmlparser \
|
htmlparser \
|
||||||
view \
|
view \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
|
|
|
@ -42,6 +42,7 @@ REQUIRES = xpcom \
|
||||||
gfx \
|
gfx \
|
||||||
layout \
|
layout \
|
||||||
layout_xul \
|
layout_xul \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
include <$(DEPTH)\config\config.mak>
|
include <$(DEPTH)\config\config.mak>
|
||||||
|
|
|
@ -941,7 +941,7 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL,
|
||||||
doc->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -535,7 +535,7 @@ nsXBLPrototypeBinding::LoadResources(PRBool* aResult)
|
||||||
|
|
||||||
// Now kick off the image load
|
// Now kick off the image load
|
||||||
nsCOMPtr<imgIRequest> req;
|
nsCOMPtr<imgIRequest> 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
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -345,10 +345,6 @@ public:
|
||||||
void OnStartPrinting();
|
void OnStartPrinting();
|
||||||
|
|
||||||
nsCOMPtr<nsIDeviceContext> mPrintDC;
|
nsCOMPtr<nsIDeviceContext> mPrintDC;
|
||||||
nsCOMPtr<nsIPresContext> mPrintPC;
|
|
||||||
nsCOMPtr<nsIStyleSet> mPrintSS;
|
|
||||||
nsCOMPtr<nsIPresShell> mPrintPS;
|
|
||||||
nsCOMPtr<nsIViewManager> mPrintVM;
|
|
||||||
nsIView *mPrintView;
|
nsIView *mPrintView;
|
||||||
FILE *mFilePointer; // a file where information can go to when printing
|
FILE *mFilePointer; // a file where information can go to when printing
|
||||||
|
|
||||||
|
@ -719,19 +715,13 @@ PrintData::~PrintData()
|
||||||
|
|
||||||
// printing is complete, clean up now
|
// 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
|
OnEndPrinting(NS_OK); // removes listener
|
||||||
|
|
||||||
if (mPrintPS) {
|
if (mPrintDC) {
|
||||||
mPrintDC->EndDocument();
|
|
||||||
#ifdef DEBUG_PRINTING
|
#ifdef DEBUG_PRINTING
|
||||||
fprintf(mDebugFD, "****************** End Document ************************\n");
|
fprintf(mDebugFD, "****************** End Document ************************\n");
|
||||||
#endif
|
#endif
|
||||||
|
mPrintDC->EndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete mPrintObject;
|
delete mPrintObject;
|
||||||
|
@ -2839,6 +2829,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO)
|
||||||
NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE);
|
||||||
presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE);
|
presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE);
|
||||||
|
|
||||||
|
// set it on the new pres shell
|
||||||
|
aPO->mPresShell->SetHistoryState(layoutState);
|
||||||
|
|
||||||
aPO->mPresShell->BeginObservingDocument();
|
aPO->mPresShell->BeginObservingDocument();
|
||||||
|
|
||||||
nsMargin margin(0,0,0,0);
|
nsMargin margin(0,0,0,0);
|
||||||
|
@ -2877,12 +2870,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO)
|
||||||
}
|
}
|
||||||
|
|
||||||
aPO->mPresContext->SetPageDim(&adjRect);
|
aPO->mPresContext->SetPageDim(&adjRect);
|
||||||
// XXX replace this line with the commented one below when bug 101264 is fixed
|
rv = aPO->mPresShell->InitialReflow(width, height);
|
||||||
// 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);
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
// Transfer Selection Ranges to the new Print PresShell
|
// Transfer Selection Ranges to the new Print PresShell
|
||||||
|
@ -2918,22 +2906,9 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO)
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// update the history from the old presentation shell
|
|
||||||
nsCOMPtr<nsIFrameManager> 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();
|
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;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -4407,85 +4382,6 @@ nsresult rv;
|
||||||
NS_RELEASE(devspec);
|
NS_RELEASE(devspec);
|
||||||
|
|
||||||
if(webContainer) {
|
if(webContainer) {
|
||||||
// load the document and do the initial reflow on the entire document
|
|
||||||
nsCOMPtr<nsIPrintContext> 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
|
#ifdef DEBUG_dcone
|
||||||
float a1,a2;
|
float a1,a2;
|
||||||
PRInt32 i1,i2;
|
PRInt32 i1,i2;
|
||||||
|
|
|
@ -2167,6 +2167,11 @@ FrameManager::RestoreFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFram
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIContent> content;
|
nsCOMPtr<nsIContent> content;
|
||||||
rv = aFrame->GetContent(getter_AddRefs(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;
|
nsCAutoString stateKey;
|
||||||
rv = GenerateStateKey(content, aID, stateKey);
|
rv = GenerateStateKey(content, aID, stateKey);
|
||||||
|
|
|
@ -119,7 +119,7 @@ nsImageLoader::Load(const nsAReadableString &aURI)
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return il->LoadImage(uri, loadGroup, NS_STATIC_CAST(imgIDecoderObserver *, this),
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1332,6 +1332,13 @@ nsPresContext::GetDeviceContext(nsIDeviceContext** aResult) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsPresContext::GetImageLoadFlags(nsLoadFlags& aLoadFlags)
|
||||||
|
{
|
||||||
|
aLoadFlags = nsIRequest::LOAD_NORMAL;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsPresContext::LoadImage(const nsString& aURL,
|
nsPresContext::LoadImage(const nsString& aURL,
|
||||||
nsIFrame* aTargetFrame,
|
nsIFrame* aTargetFrame,
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "nsColor.h"
|
#include "nsColor.h"
|
||||||
#include "nsCoord.h"
|
#include "nsCoord.h"
|
||||||
#include "nsAWritableString.h"
|
#include "nsAWritableString.h"
|
||||||
|
#include "nsIRequest.h"
|
||||||
#ifdef IBMBIDI
|
#ifdef IBMBIDI
|
||||||
class nsBidiPresUtils;
|
class nsBidiPresUtils;
|
||||||
#endif // IBMBIDI
|
#endif // IBMBIDI
|
||||||
|
@ -165,6 +166,11 @@ public:
|
||||||
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
||||||
NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 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
|
* Get look and feel object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2630,6 +2630,11 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rootFrame) {
|
if (rootFrame) {
|
||||||
|
nsCOMPtr<nsILayoutHistoryState> 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_DEBUGLOG(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this));
|
||||||
MOZ_TIMER_RESET(mReflowWatch);
|
MOZ_TIMER_RESET(mReflowWatch);
|
||||||
MOZ_TIMER_START(mReflowWatch);
|
MOZ_TIMER_START(mReflowWatch);
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "nsColor.h"
|
#include "nsColor.h"
|
||||||
#include "nsCoord.h"
|
#include "nsCoord.h"
|
||||||
#include "nsAWritableString.h"
|
#include "nsAWritableString.h"
|
||||||
|
#include "nsIRequest.h"
|
||||||
#ifdef IBMBIDI
|
#ifdef IBMBIDI
|
||||||
class nsBidiPresUtils;
|
class nsBidiPresUtils;
|
||||||
#endif // IBMBIDI
|
#endif // IBMBIDI
|
||||||
|
@ -165,6 +166,11 @@ public:
|
||||||
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
||||||
NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 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
|
* Get look and feel object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "nsColor.h"
|
#include "nsColor.h"
|
||||||
#include "nsCoord.h"
|
#include "nsCoord.h"
|
||||||
#include "nsAWritableString.h"
|
#include "nsAWritableString.h"
|
||||||
|
#include "nsIRequest.h"
|
||||||
#ifdef IBMBIDI
|
#ifdef IBMBIDI
|
||||||
class nsBidiPresUtils;
|
class nsBidiPresUtils;
|
||||||
#endif // IBMBIDI
|
#endif // IBMBIDI
|
||||||
|
@ -165,6 +166,11 @@ public:
|
||||||
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
||||||
NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 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
|
* Get look and feel object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -119,7 +119,7 @@ nsImageLoader::Load(const nsAReadableString &aURI)
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return il->LoadImage(uri, loadGroup, NS_STATIC_CAST(imgIDecoderObserver *, this),
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1332,6 +1332,13 @@ nsPresContext::GetDeviceContext(nsIDeviceContext** aResult) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsPresContext::GetImageLoadFlags(nsLoadFlags& aLoadFlags)
|
||||||
|
{
|
||||||
|
aLoadFlags = nsIRequest::LOAD_NORMAL;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsPresContext::LoadImage(const nsString& aURL,
|
nsPresContext::LoadImage(const nsString& aURL,
|
||||||
nsIFrame* aTargetFrame,
|
nsIFrame* aTargetFrame,
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode);
|
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode);
|
||||||
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult);
|
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult);
|
||||||
NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode);
|
NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode);
|
||||||
|
NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags);
|
||||||
NS_IMETHOD GetLookAndFeel(nsILookAndFeel** aLookAndFeel);
|
NS_IMETHOD GetLookAndFeel(nsILookAndFeel** aLookAndFeel);
|
||||||
NS_IMETHOD GetBaseURL(nsIURI** aURLResult);
|
NS_IMETHOD GetBaseURL(nsIURI** aURLResult);
|
||||||
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
PrintContext();
|
PrintContext();
|
||||||
~PrintContext();
|
~PrintContext();
|
||||||
|
|
||||||
|
NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags);
|
||||||
NS_IMETHOD GetMedium(nsIAtom** aMedium);
|
NS_IMETHOD GetMedium(nsIAtom** aMedium);
|
||||||
NS_IMETHOD IsPaginated(PRBool* aResult);
|
NS_IMETHOD IsPaginated(PRBool* aResult);
|
||||||
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
|
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
|
||||||
|
@ -93,7 +94,12 @@ PrintContext::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
return nsPresContext::QueryInterface(aIID, 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
|
NS_IMETHODIMP
|
||||||
PrintContext::GetMedium(nsIAtom** aResult)
|
PrintContext::GetMedium(nsIAtom** aResult)
|
||||||
|
|
|
@ -40,6 +40,7 @@ REQUIRES = xpcom \
|
||||||
widget \
|
widget \
|
||||||
locale \
|
locale \
|
||||||
timer \
|
timer \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
|
|
|
@ -29,6 +29,7 @@ REQUIRES = xpcom \
|
||||||
gfx \
|
gfx \
|
||||||
content \
|
content \
|
||||||
layout_xul \
|
layout_xul \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
include <$(DEPTH)/config/config.mak>
|
include <$(DEPTH)/config/config.mak>
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
|
||||||
NS_RELEASE(listener);
|
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;
|
return NS_OK;
|
||||||
|
@ -1383,7 +1383,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||||
GetLoadGroup(aPresContext, getter_AddRefs(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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1547,6 +1547,11 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||||
GetLoadGroup(aPresContext, getter_AddRefs(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 */
|
/* get the URI, convert internal-gopher-stuff if needed */
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri;
|
||||||
GetURI(aSpec, getter_AddRefs(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 */
|
/* set this back to FALSE before we do the real load */
|
||||||
mInitialLoadCompleted = PR_FALSE;
|
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 */
|
#define INTERNAL_GOPHER_LENGTH 16 /* "internal-gopher-" length */
|
||||||
|
|
|
@ -304,12 +304,6 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsRect adjSize;
|
nsRect adjSize;
|
||||||
aPresContext->GetPageDim(&pageSize, &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 suppressLeftMargin = PR_FALSE;
|
||||||
PRBool suppressRightMargin = PR_FALSE;
|
PRBool suppressRightMargin = PR_FALSE;
|
||||||
PRBool suppressTopMargin = PR_FALSE;
|
PRBool suppressTopMargin = PR_FALSE;
|
||||||
|
@ -382,11 +376,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
availSize, reflowReason);
|
availSize, reflowReason);
|
||||||
nsReflowStatus status;
|
nsReflowStatus status;
|
||||||
kidReflowState.availableWidth = pageSize.width - margin.left - margin.right;
|
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
|
kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom;
|
||||||
if (NS_UNCONSTRAINEDSIZE != pageSize.height) {
|
|
||||||
kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom;
|
|
||||||
}
|
|
||||||
//kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom;
|
|
||||||
|
|
||||||
kidReflowState.mComputedWidth = kidReflowState.availableWidth;
|
kidReflowState.mComputedWidth = kidReflowState.availableWidth;
|
||||||
//kidReflowState.mComputedHeight = kidReflowState.availableHeight;
|
//kidReflowState.mComputedHeight = kidReflowState.availableHeight;
|
||||||
|
|
|
@ -145,7 +145,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
|
||||||
NS_RELEASE(listener);
|
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;
|
return NS_OK;
|
||||||
|
@ -1383,7 +1383,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||||
GetLoadGroup(aPresContext, getter_AddRefs(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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2167,6 +2167,11 @@ FrameManager::RestoreFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFram
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIContent> content;
|
nsCOMPtr<nsIContent> content;
|
||||||
rv = aFrame->GetContent(getter_AddRefs(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;
|
nsCAutoString stateKey;
|
||||||
rv = GenerateStateKey(content, aID, stateKey);
|
rv = GenerateStateKey(content, aID, stateKey);
|
||||||
|
|
|
@ -1547,6 +1547,11 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||||
GetLoadGroup(aPresContext, getter_AddRefs(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 */
|
/* get the URI, convert internal-gopher-stuff if needed */
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri;
|
||||||
GetURI(aSpec, getter_AddRefs(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 */
|
/* set this back to FALSE before we do the real load */
|
||||||
mInitialLoadCompleted = PR_FALSE;
|
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 */
|
#define INTERNAL_GOPHER_LENGTH 16 /* "internal-gopher-" length */
|
||||||
|
|
|
@ -2630,6 +2630,11 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rootFrame) {
|
if (rootFrame) {
|
||||||
|
nsCOMPtr<nsILayoutHistoryState> 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_DEBUGLOG(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this));
|
||||||
MOZ_TIMER_RESET(mReflowWatch);
|
MOZ_TIMER_RESET(mReflowWatch);
|
||||||
MOZ_TIMER_START(mReflowWatch);
|
MOZ_TIMER_START(mReflowWatch);
|
||||||
|
|
|
@ -304,12 +304,6 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsRect adjSize;
|
nsRect adjSize;
|
||||||
aPresContext->GetPageDim(&pageSize, &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 suppressLeftMargin = PR_FALSE;
|
||||||
PRBool suppressRightMargin = PR_FALSE;
|
PRBool suppressRightMargin = PR_FALSE;
|
||||||
PRBool suppressTopMargin = PR_FALSE;
|
PRBool suppressTopMargin = PR_FALSE;
|
||||||
|
@ -382,11 +376,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
availSize, reflowReason);
|
availSize, reflowReason);
|
||||||
nsReflowStatus status;
|
nsReflowStatus status;
|
||||||
kidReflowState.availableWidth = pageSize.width - margin.left - margin.right;
|
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
|
kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom;
|
||||||
if (NS_UNCONSTRAINEDSIZE != pageSize.height) {
|
|
||||||
kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom;
|
|
||||||
}
|
|
||||||
//kidReflowState.availableHeight = pageSize.height - margin.top - margin.bottom;
|
|
||||||
|
|
||||||
kidReflowState.mComputedWidth = kidReflowState.availableWidth;
|
kidReflowState.mComputedWidth = kidReflowState.availableWidth;
|
||||||
//kidReflowState.mComputedHeight = kidReflowState.availableHeight;
|
//kidReflowState.mComputedHeight = kidReflowState.availableHeight;
|
||||||
|
|
|
@ -38,6 +38,7 @@ REQUIRES = xpcom \
|
||||||
webshell \
|
webshell \
|
||||||
view \
|
view \
|
||||||
accessibility \
|
accessibility \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
|
|
|
@ -33,6 +33,7 @@ REQUIRES = xpcom \
|
||||||
accessibility \
|
accessibility \
|
||||||
gfx \
|
gfx \
|
||||||
content \
|
content \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize)
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||||
GetLoadGroup(aPresContext, getter_AddRefs(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;
|
aResize = PR_TRUE;
|
||||||
|
|
||||||
|
|
|
@ -1336,7 +1336,7 @@ nsOutlinerBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1", &rv));
|
nsCOMPtr<imgILoader> 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) {
|
if (!mImageCache) {
|
||||||
mImageCache = new nsSupportsHashtable(32);
|
mImageCache = new nsSupportsHashtable(32);
|
||||||
|
|
|
@ -1336,7 +1336,7 @@ nsOutlinerBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1", &rv));
|
nsCOMPtr<imgILoader> 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) {
|
if (!mImageCache) {
|
||||||
mImageCache = new nsSupportsHashtable(32);
|
mImageCache = new nsSupportsHashtable(32);
|
||||||
|
|
|
@ -53,8 +53,10 @@ interface imgILoader : nsISupports
|
||||||
* @param aObserver the observer
|
* @param aObserver the observer
|
||||||
* @param aCX some random data
|
* @param aCX some random data
|
||||||
* @param aLoadFlags Load flags for the request
|
* @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.
|
* Start the load and decode of an image.
|
||||||
|
|
|
@ -108,8 +108,10 @@ void GetCacheSession(nsIURI *aURI, nsICacheSession **_retval)
|
||||||
|
|
||||||
if (isChrome)
|
if (isChrome)
|
||||||
gChromeSession = newSession;
|
gChromeSession = newSession;
|
||||||
else
|
else {
|
||||||
gSession = newSession;
|
gSession = newSession;
|
||||||
|
gSession->SetDoomEntriesIfExpired(PR_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
*_retval = newSession;
|
*_retval = newSession;
|
||||||
NS_ADDREF(*_retval);
|
NS_ADDREF(*_retval);
|
||||||
|
@ -172,7 +174,20 @@ PRBool imgCache::Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor
|
||||||
return PR_TRUE;
|
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");
|
LOG_STATIC_FUNC(gImgLog, "imgCache::Get");
|
||||||
|
|
||||||
|
@ -192,6 +207,15 @@ PRBool imgCache::Get(nsIURI *aKey, imgRequest **aRequest, nsICacheEntryDescripto
|
||||||
if (NS_FAILED(rv) || !entry)
|
if (NS_FAILED(rv) || !entry)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
|
if (aDoomIfExpired) {
|
||||||
|
PRUint32 expirationTime;
|
||||||
|
entry->GetExpirationTime(&expirationTime);
|
||||||
|
if (expirationTime && (expirationTime <= SecondsFromPRTime(PR_Now()))) {
|
||||||
|
entry->Doom();
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> sup;
|
nsCOMPtr<nsISupports> sup;
|
||||||
entry->GetCacheElement(getter_AddRefs(sup));
|
entry->GetCacheElement(getter_AddRefs(sup));
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
/* additional members */
|
/* additional members */
|
||||||
static PRBool Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor **aEntry);
|
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 PRBool Remove(nsIURI *aKey);
|
||||||
|
|
||||||
static nsresult ClearChromeImageCache();
|
static nsresult ClearChromeImageCache();
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
#include "nsIHttpChannel.h"
|
#include "nsIHttpChannel.h"
|
||||||
|
#include "nsICachingChannel.h"
|
||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
#include "nsILoadGroup.h"
|
#include "nsILoadGroup.h"
|
||||||
#include "nsIProxyObjectManager.h"
|
#include "nsIProxyObjectManager.h"
|
||||||
|
@ -93,8 +94,8 @@ imgLoader::~imgLoader()
|
||||||
|
|
||||||
#define SHOULD_RELOAD(flags) (flags & nsIRequest::LOAD_BYPASS_CACHE || flags & nsIRequest::VALIDATE_ALWAYS)
|
#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); */
|
/* 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, imgIRequest **_retval)
|
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");
|
NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
|
||||||
|
|
||||||
|
@ -109,8 +110,12 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsILoadGroup *aLoadGroup, imgID
|
||||||
|
|
||||||
imgRequest *request = nsnull;
|
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<nsICacheEntryDescriptor> entry;
|
nsCOMPtr<nsICacheEntryDescriptor> 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) {
|
if (request && entry) {
|
||||||
/* this isn't exactly what I want here. This code will re-doom every
|
/* 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)) {
|
if (SHOULD_RELOAD(aLoadFlags)) {
|
||||||
doomRequest = PR_TRUE;
|
doomRequest = PR_TRUE;
|
||||||
} else if (aLoadGroup) {
|
} else if (!(aLoadFlags & nsIRequest::LOAD_FROM_CACHE) &&
|
||||||
|
aLoadGroup) {
|
||||||
nsLoadFlags flags = 0;
|
nsLoadFlags flags = 0;
|
||||||
aLoadGroup->GetLoadFlags(&flags);
|
aLoadGroup->GetLoadFlags(&flags);
|
||||||
if (SHOULD_RELOAD(flags)) {
|
if (SHOULD_RELOAD(flags)) {
|
||||||
|
@ -264,7 +270,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
|
||||||
channel->GetOriginalURI(getter_AddRefs(uri));
|
channel->GetOriginalURI(getter_AddRefs(uri));
|
||||||
|
|
||||||
nsCOMPtr<nsICacheEntryDescriptor> entry;
|
nsCOMPtr<nsICacheEntryDescriptor> entry;
|
||||||
imgCache::Get(uri, &request, getter_AddRefs(entry)); // addrefs request
|
imgCache::Get(uri, PR_TRUE, &request, getter_AddRefs(entry)); // addrefs request
|
||||||
|
|
||||||
if (request) {
|
if (request) {
|
||||||
// we have this in our cache already.. cancel the current (document) load
|
// we have this in our cache already.. cancel the current (document) load
|
||||||
|
|
|
@ -41,6 +41,7 @@ REQUIRES = xpcom \
|
||||||
locale \
|
locale \
|
||||||
timer \
|
timer \
|
||||||
pref \
|
pref \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXTRA_DSO_LIBS = gkgfx
|
EXTRA_DSO_LIBS = gkgfx
|
||||||
|
|
|
@ -34,6 +34,7 @@ REQUIRES = xpcom \
|
||||||
timer \
|
timer \
|
||||||
pref \
|
pref \
|
||||||
content \
|
content \
|
||||||
|
necko \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
DEFINES =-D_IMPL_NS_VIEW -DWIN32_LEAN_AND_MEAN
|
DEFINES =-D_IMPL_NS_VIEW -DWIN32_LEAN_AND_MEAN
|
||||||
|
|
Загрузка…
Ссылка в новой задаче