зеркало из https://github.com/mozilla/gecko-dev.git
Bug 966419 - Update the global ShrinkToFitRatio when the current page overflows and requires additional scaling to fit horizontally on the page in Print/Preview. r=dholbert
This commit is contained in:
Родитель
35750ea4ab
Коммит
f3a6f071a1
|
@ -49,8 +49,6 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize);
|
||||
kidReflowState.SetComputedHeight(maxSize.height);
|
||||
|
||||
mPD->mPageContentSize = maxSize.width;
|
||||
|
||||
// Reflow the page content area
|
||||
rv = ReflowChild(frame, aPresContext, aDesiredSize, kidReflowState, 0, 0, 0, aStatus);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -73,10 +71,11 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
|
|||
// for children sticking outside the child frame's padding edge
|
||||
nscoord xmost = aDesiredSize.ScrollableOverflow().XMost();
|
||||
if (xmost > aDesiredSize.Width()) {
|
||||
mPD->mPageContentXMost =
|
||||
xmost +
|
||||
kidReflowState.mStyleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT) +
|
||||
padding.right;
|
||||
nscoord widthToFit = xmost + padding.right +
|
||||
kidReflowState.mStyleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
|
||||
float ratio = float(maxSize.width) / widthToFit;
|
||||
NS_ASSERTION(ratio >= 0.0 && ratio < 1.0, "invalid shrink-to-fit ratio");
|
||||
mPD->mShrinkToFitRatio = std::min(mPD->mShrinkToFitRatio, ratio);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -841,9 +841,6 @@ NS_IMETHODIMP
|
|||
nsSimplePageSequenceFrame::GetSTFPercent(float& aSTFPercent)
|
||||
{
|
||||
NS_ENSURE_TRUE(mPageData, NS_ERROR_UNEXPECTED);
|
||||
aSTFPercent = 1.0f;
|
||||
if (mPageData && (mPageData->mPageContentXMost > mPageData->mPageContentSize)) {
|
||||
aSTFPercent = float(mPageData->mPageContentSize) / float(mPageData->mPageContentXMost);
|
||||
}
|
||||
aSTFPercent = mPageData->mShrinkToFitRatio;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -29,11 +29,7 @@ class nsSharedPageData {
|
|||
public:
|
||||
// This object a shared by all the nsPageFrames
|
||||
// parented to a SimplePageSequenceFrame
|
||||
nsSharedPageData() :
|
||||
mPageContentXMost(0),
|
||||
mPageContentSize(0)
|
||||
{
|
||||
}
|
||||
nsSharedPageData() : mShrinkToFitRatio(1.0f) {}
|
||||
|
||||
nsString mDateTimeStr;
|
||||
nsString mPageNumFormat;
|
||||
|
@ -52,8 +48,10 @@ public:
|
|||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||
nsCOMPtr<nsIPrintOptions> mPrintOptions;
|
||||
|
||||
nscoord mPageContentXMost; // xmost size from Reflow(width)
|
||||
nscoord mPageContentSize; // constrained size (width)
|
||||
// The scaling ratio we need to apply to make all pages fit horizontally. It's
|
||||
// the minimum "ComputedWidth / OverflowWidth" ratio of all page content frames
|
||||
// that overflowed. It's 1.0 if none overflowed horizontally.
|
||||
float mShrinkToFitRatio;
|
||||
};
|
||||
|
||||
// Simple page sequence frame class. Used when we're in paginated mode
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
<div style="width:8in; border:solid blue">line</div>
|
||||
<div style="page-break-before:always"></div>
|
||||
<div style="width:1in;height:1em"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
<div style="width:8in; border:solid blue">line</div>
|
||||
<div style="page-break-before:always"></div>
|
||||
<div style="width:6in;height:1em"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
<div style="width:1in;height:1em"></div>
|
||||
<div style="page-break-before:always"></div>
|
||||
<div style="width:8in; border:solid blue">line</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
<div style="width:6in;height:1em"></div>
|
||||
<div style="page-break-before:always"></div>
|
||||
<div style="width:8in; border:solid blue">line</div>
|
||||
</body>
|
||||
</html>
|
|
@ -26,3 +26,5 @@
|
|||
== 652178-1.html 652178-1-ref2.html
|
||||
fuzzy-if(cocoaWidget,1,5000) fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu),255,100) == 745025-1.html 745025-1-ref.html
|
||||
== 820496-1.html 820496-1-ref.html
|
||||
== 966419-1.html 966419-1-ref.html
|
||||
== 966419-2.html 966419-2-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче