Closed Bug 1250674 Opened 8 years ago Closed 8 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)


(Blocks 2 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+
Keywords: checkin-needed
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
platform-rel: --- → +
Whiteboard: [platform-rel-Google][platform-rel-GoogleDocs]

(In reply to Petruta Horea [:phorea], Desktop QA from comment #11)

Header/footer is not printed anymore on svg images.
Should this fix apply for this type of files too?

All seems to be well here now; I can't reproduce this^ described followup behavior. I'm seeing headers/footers when print-previewing those SVG files (as long as the margins in the print preview dialog are sufficient, just as for any other print-previewed content). And this is as-expected, I think.

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