Closed Bug 1250674 Opened 7 years ago Closed 7 years ago

Don't print header/footer if larger than user defined margins


(Core :: Printing: Output, defect)

Not set



Tracking Status
platform-rel --- +
firefox48 --- fixed


(Reporter: tschneider, Assigned: tschneider, NeedInfo)


(Blocks 3 open bugs)


(Whiteboard: [platform-rel-Google][platform-rel-GoogleDocs])


(1 file)

Apps like PDF.js and Google docs take control over the entire printing page by setting margin to 0 in CSS @page rules. If these margins are smaller then the space needed to print the header of footer, user content gets overdrawn. We should therefore skip painting footers/headers should in this case. Chrome is behaving the same way. This is one of 2 requested features that keeps Google Docs from printing natively.
Blocks: 1246805
Assignee: nobody → tschneider
No longer blocks: 1246805
Blocks: 1246805
Attachment #8722671 - Flags: review?(dbaron)
Can you explain what the difference is between mPD->mReflowMargin and mPageContentMargin?

Also, how do other browsers behave?
Flags: needinfo?(tschneider)
(In reply to David Baron [:dbaron] ⌚️UTC+8 from comment #2)
> Also, how do other browsers behave?

Er, I guess you sort of answered that for Chrome in comment 0, but it's probably worth checking:
 (1) whether the points where we flip from showing to not showing headers will be equivalent with this patch (under different cases, if there are relevant cases to check)
 (2) perhaps check Edge as well, and maybe Safari
Chrome is using the same flip points. Safari doesn't seem to support CSS defined page margins at all. Edge behaves like Firefox does without this patch, overdrawing user content. It disables printing of headers/fooders by default tho.
Flags: needinfo?(tschneider)
> Can you explain what the difference is between mPD->mReflowMargin and mPageContentMargin?

mReflowMargin defines the default margins as defined via print.print_margin_* prefs. mPageContentMargin holds the actual, CSS specified margins, which might change individually per page.
Comment on attachment 8722671 [details] [diff] [review]
Part 1: Don't paint header/footer if larger than user defined margins

OK, r=dbaron

It would be nice to add a patch 2 that renames mReflowMargin to mDefaultPageMargin or something like that, since mReflowMargin seems like a rather confusing/ambiguous name.  (If you're happy with that name, feel free to just land it with r=dbaron.)
Attachment #8722671 - Flags: review?(dbaron) → review+
Blocks: 212369, 364739
Keywords: checkin-needed
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
platform-rel: --- → +
Whiteboard: [platform-rel-Google][platform-rel-GoogleDocs]
Header/footer is not printed anymore on svg images.
Should this fix apply for this type of files too? 


Thank you!
Flags: needinfo?(tschneider)
You need to log in before you can comment on or make changes to this bug.