Closed Bug 1250674 Opened 5 years ago Closed 5 years ago

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

Categories

(Core :: Printing: Output, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
platform-rel --- +
firefox48 --- fixed

People

(Reporter: tschneider, Assigned: tschneider, NeedInfo)

References

(Blocks 3 open bugs)

Details

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

Attachments

(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.
Duplicate of this bug: 1209265
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
https://hg.mozilla.org/mozilla-central/rev/3fd66d7ceea8
Status: NEW → RESOLVED
Closed: 5 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? 

Samples: https://upload.wikimedia.org/wikipedia/en/c/ce/SVG-logo.svg
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/410.svg
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/compuserver_msn_Ford_Focus.svg

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