patch to clamp to 1/10th of the largest dimension of a page - very low risk. I

think it is unrealistic that the smaller dim of the page would be less than 1/5
of the larger dimension. (and remove unneeded call to get the presshell)
Bug 145976 r=dcone sr=attinasi
This commit is contained in:
rods%netscape.com 2002-05-22 11:32:00 +00:00
parent bcbb81dbcc
commit b66bf63fcf
2 changed files with 4 additions and 12 deletions

View File

@ -327,11 +327,11 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIPref> pref = do_GetService(NS_PREF_CONTRACTID);
if (pref) {
GetEdgePaperMargin(pref, mPageData->mEdgePaperMargin);
nscoord inchInTwips = NS_INCHES_TO_TWIPS(1.0);
nscoord extraThreshold = PR_MAX(pageSize.width, pageSize.height)/10;
PRInt32 gapInTwips;
if (NS_SUCCEEDED(pref->GetIntPref("print.print_extra_margin", &gapInTwips))) {
gapInTwips = PR_MAX(gapInTwips, 0);
gapInTwips = PR_MIN(gapInTwips, inchInTwips); // an inch is still probably excessive
gapInTwips = PR_MIN(gapInTwips, extraThreshold); // clamp to 1/10 of the largest dim of the page
extraGap = nscoord(gapInTwips);
}
}
@ -707,10 +707,6 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext,
aPresContext->GetDeviceContext(getter_AddRefs(dc));
NS_ASSERTION(dc, "nsIDeviceContext can't be NULL!");
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
NS_ASSERTION(presShell, "nsIPresShell can't be NULL!");
nsresult rv = NS_OK;
#if defined(DEBUG_rods) || defined(DEBUG_dcone)

View File

@ -327,11 +327,11 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIPref> pref = do_GetService(NS_PREF_CONTRACTID);
if (pref) {
GetEdgePaperMargin(pref, mPageData->mEdgePaperMargin);
nscoord inchInTwips = NS_INCHES_TO_TWIPS(1.0);
nscoord extraThreshold = PR_MAX(pageSize.width, pageSize.height)/10;
PRInt32 gapInTwips;
if (NS_SUCCEEDED(pref->GetIntPref("print.print_extra_margin", &gapInTwips))) {
gapInTwips = PR_MAX(gapInTwips, 0);
gapInTwips = PR_MIN(gapInTwips, inchInTwips); // an inch is still probably excessive
gapInTwips = PR_MIN(gapInTwips, extraThreshold); // clamp to 1/10 of the largest dim of the page
extraGap = nscoord(gapInTwips);
}
}
@ -707,10 +707,6 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext,
aPresContext->GetDeviceContext(getter_AddRefs(dc));
NS_ASSERTION(dc, "nsIDeviceContext can't be NULL!");
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
NS_ASSERTION(presShell, "nsIPresShell can't be NULL!");
nsresult rv = NS_OK;
#if defined(DEBUG_rods) || defined(DEBUG_dcone)