зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1250674 - Don't print header/footer if larger than user defined margins. r=dbaron
--HG-- extra : rebase_source : 778ef2680cd72a5aa0056861f0d9214de698e78d
This commit is contained in:
Родитель
74df504068
Коммит
6b4432e4a6
|
@ -102,23 +102,22 @@ nsPageFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
// Use the margins given in the @page rule.
|
||||
// If a margin is 'auto', use the margin from the print settings for that side.
|
||||
nsMargin pageContentMargin;
|
||||
const nsStyleSides& marginStyle = kidReflowState.mStyleMargin->mMargin;
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
if (marginStyle.GetUnit(side) == eStyleUnit_Auto) {
|
||||
pageContentMargin.Side(side) = mPD->mReflowMargin.Side(side);
|
||||
mPageContentMargin.Side(side) = mPD->mReflowMargin.Side(side);
|
||||
} else {
|
||||
pageContentMargin.Side(side) = kidReflowState.ComputedPhysicalMargin().Side(side);
|
||||
mPageContentMargin.Side(side) = kidReflowState.ComputedPhysicalMargin().Side(side);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nscoord maxWidth = maxSize.width - pageContentMargin.LeftRight() / scale;
|
||||
nscoord maxWidth = maxSize.width - mPageContentMargin.LeftRight() / scale;
|
||||
nscoord maxHeight;
|
||||
if (maxSize.height == NS_UNCONSTRAINEDSIZE) {
|
||||
maxHeight = NS_UNCONSTRAINEDSIZE;
|
||||
} else {
|
||||
maxHeight = maxSize.height - pageContentMargin.TopBottom() / scale;
|
||||
maxHeight = maxSize.height - mPageContentMargin.TopBottom() / scale;
|
||||
}
|
||||
|
||||
// Check the width and height, if they're too small we reset the margins
|
||||
|
@ -126,11 +125,11 @@ nsPageFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (maxWidth < onePixelInTwips ||
|
||||
(maxHeight != NS_UNCONSTRAINEDSIZE && maxHeight < onePixelInTwips)) {
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
pageContentMargin.Side(side) = mPD->mReflowMargin.Side(side);
|
||||
mPageContentMargin.Side(side) = mPD->mReflowMargin.Side(side);
|
||||
}
|
||||
maxWidth = maxSize.width - pageContentMargin.LeftRight() / scale;
|
||||
maxWidth = maxSize.width - mPageContentMargin.LeftRight() / scale;
|
||||
if (maxHeight != NS_UNCONSTRAINEDSIZE) {
|
||||
maxHeight = maxSize.height - pageContentMargin.TopBottom() / scale;
|
||||
maxHeight = maxSize.height - mPageContentMargin.TopBottom() / scale;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,8 +137,8 @@ nsPageFrame::Reflow(nsPresContext* aPresContext,
|
|||
kidReflowState.SetComputedHeight(maxHeight);
|
||||
|
||||
// calc location of frame
|
||||
nscoord xc = pageContentMargin.left;
|
||||
nscoord yc = pageContentMargin.top;
|
||||
nscoord xc = mPageContentMargin.left;
|
||||
nscoord yc = mPageContentMargin.top;
|
||||
|
||||
// Get the child's desired size
|
||||
ReflowChild(frame, aPresContext, aDesiredSize, kidReflowState, xc, yc, 0, aStatus);
|
||||
|
@ -336,8 +335,8 @@ nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
|||
gfxContext* gfx = aRenderingContext.ThebesContext();
|
||||
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
|
||||
|
||||
if ((aHeaderFooter == eHeader && aHeight < mPD->mReflowMargin.top) ||
|
||||
(aHeaderFooter == eFooter && aHeight < mPD->mReflowMargin.bottom)) {
|
||||
if ((aHeaderFooter == eHeader && aHeight < mPageContentMargin.top) ||
|
||||
(aHeaderFooter == eFooter && aHeight < mPageContentMargin.bottom)) {
|
||||
nsAutoString str;
|
||||
ProcessSpecialCodes(aStr, str);
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ protected:
|
|||
int32_t mTotNumPages;
|
||||
|
||||
nsSharedPageData* mPD;
|
||||
nsMargin mPageContentMargin;
|
||||
};
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче