Commit Graph

471 Commits

Author SHA1 Message Date
Jonathan Watt
b9e6418c12 Bug 1833244 p2. Implement sheet orientation switching/rotation for page-orientation. r=AlaskanEmily,dholbert
Where supported (print preview and print-to-PDF), this implements changing the
orientation and/or rotation of print sheets, as appropriate, in response to CSS
`page-orientation`. When supported we:

- in the single page-per-sheet case, rotate the sheet in order to implement
  any `page-orientation` rotation on the sheet. Rotating the sheet is necessary
  so that when we output PDF files the pages visually have the correct
  orientation.

- in the multiple pages-per-sheet case, we already rotate individual pages in
  their grid cell. This commit keeps such pages rotated, as appropriate, but
  augments that behavior by switching the orientation of the sheet (based on
  the first page on the sheet), if necessary, to make best use of the space on
  the sheet. (We can't know what orientation any subsequent pages on the sheet
  will have, so we assume the same orientation as the first one.)

Depends on D179423

Differential Revision: https://phabricator.services.mozilla.com/D179448
2023-08-22 10:57:55 +00:00
Iulian Moraru
6e0f98f12e Backed out changeset 6db2de19f043 (bug 1833244) for causing wp failures on page-size-006-print.html. CLOSED TREE 2023-08-22 05:05:53 +03:00
Jonathan Watt
613c8a80dc Bug 1833244 p2. Implement sheet orientation switching/rotation for page-orientation. r=AlaskanEmily,dholbert
Where supported (print preview and print-to-PDF), this implements changing the
orientation and/or rotation of print sheets, as appropriate, in response to CSS
`page-orientation`. When supported we:

- in the single page-per-sheet case, rotate the sheet in order to implement
  any `page-orientation` rotation on the sheet. Rotating the sheet is necessary
  so that when we output PDF files the pages visually have the correct
  orientation.

- in the multiple pages-per-sheet case, we already rotate individual pages in
  their grid cell. This commit keeps such pages rotated, as appropriate, but
  augments that behavior by switching the orientation of the sheet (based on
  the first page on the sheet), if necessary, to make best use of the space on
  the sheet. (We can't know what orientation any subsequent pages on the sheet
  will have, so we assume the same orientation as the first one.)

Depends on D179423

Differential Revision: https://phabricator.services.mozilla.com/D179448
2023-08-21 21:55:17 +00:00
Cristian Tuns
66c26a8a3e Backed out changeset bc3dcd234d91 (bug 1833244) for causing multiple failures with *page_size* CLOSED TREE 2023-08-21 11:15:08 -04:00
Jonathan Watt
ec68cae310 Bug 1833244 p2. Implement sheet orientation switching/rotation for page-orientation. r=AlaskanEmily,dholbert
Where supported (print preview and print-to-PDF), this implements changing the
orientation and/or rotation of print sheets, as appropriate, in response to CSS
`page-orientation`. When supported we:

- in the single page-per-sheet case, rotate the sheet in order to implement
  any `page-orientation` rotation on the sheet. Rotating the sheet is necessary
  so that when we output PDF files the pages visually have the correct
  orientation.

- in the multiple pages-per-sheet case, we already rotate individual pages in
  their grid cell. This commit keeps such pages rotated, as appropriate, but
  augments that behavior by switching the orientation of the sheet (based on
  the first page on the sheet), if necessary, to make best use of the space on
  the sheet. (We can't know what orientation any subsequent pages on the sheet
  will have, so we assume the same orientation as the first one.)

Depends on D179423

Differential Revision: https://phabricator.services.mozilla.com/D179448
2023-08-21 14:21:49 +00:00
Stanca Serban
c012a11e13 Backed out 3 changesets (bug 1833244) for causing multiple failures.
Backed out changeset 7bc8c25b2935 (bug 1833244)
Backed out changeset 4576af83a4ec (bug 1833244)
Backed out changeset 90a5bbba7b9c (bug 1833244)
2023-06-03 18:36:21 +03:00
Jonathan Watt
006c723c50 Bug 1833244 p3. Implement sheet orientation switching/rotation for page-orientation. r=AlaskanEmily,dholbert
Where supported (print preview and print-to-PDF), this implements changing the
orientation and/or rotation of print sheets, as appropriate, in response to CSS
`page-orientation`. When supported we:

- in the single page-per-sheet case, rotate the sheet in order to implement
  any `page-orientation` rotation on the sheet. Rotating the sheet is necessary
  so that the pages in the PDF files that we output are correct.

- in the multiple pages-per-sheet case, we already rotate individual pages in
  their grid cell. This change keeps such pages rotated, as appropriate, but
  augments that behavior by switching the orientation of the sheet (based on
  the first page on the sheet) if necessary to best place the page to make
  maximum use of the space.

Depends on D179423

Differential Revision: https://phabricator.services.mozilla.com/D179448
2023-06-03 14:21:38 +00:00
Jonathan Watt
777bf674bc Bug 1835713. Change the print code to not assume that sheets all have the same dimensions. r=dholbert
This code doesn't change behavior itself. The same sheet size is cached on all
sheets. Patches for future bugs will change that.

Differential Revision: https://phabricator.services.mozilla.com/D179395
2023-05-30 12:09:04 +00:00
Norisz Fay
b6c759299b Backed out changeset b448658be51d (bug 1835713) for causing build bustages on PrintedSheetFrame.cpp CLOSED TREE 2023-05-30 13:58:26 +03:00
Jonathan Watt
ed4deffe81 Bug 1835713. Change the print code to not assume that sheets all have the same dimensions. r=dholbert
This code doesn't change behavior itself. The same sheet size is cached on all
sheets. Patches for future bugs will change that.

Differential Revision: https://phabricator.services.mozilla.com/D179395
2023-05-30 10:40:58 +00:00
Jonathan Watt
93540964c2 Bug 1835475. Only use nsPageFrame::ComputePageSizeScale when pps==1. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D179296
2023-05-29 00:14:58 +00:00
Jonathan Watt
bceccce8ff Bug 1833239. Change the multiple pages-per-sheet printing code to center pages in the grid cells. r=AlaskanEmily,dholbert
Prior to this patch, we would place the pages edge-to-edge, then center that
collection of pages in the sheet. Now we create a grid of equally sized cells
that uses as much of the sheet as possible. Each page is then centered in its
grid cell.

Differential Revision: https://phabricator.services.mozilla.com/D179092
2023-05-27 01:13:53 +00:00
Jonathan Watt
b6f3cdafda Bug 1833688. Simplify ComputePagesPerSheetAndPageSizeTransform. r=dholbert
Prior to this change, it wasn't at all clear that the single page-per-sheet
calculations are actually very simple. This makes it a lot clearer. It also
changes the transform code to avoid unnecessary mixing of Pre* and Post*
operations, which was making the code more difficult to reason about.

Separating out this change also makes the changes that will be introduced in
bug 1833239 a lot easier to understand.

Differential Revision: https://phabricator.services.mozilla.com/D178351
2023-05-17 20:51:48 +00:00
Jonathan Watt
97a4bc93ce Bug 1830900. Move multiple pages-per-sheet grid calculations to be per-sheet, not per-print. r=AlaskanEmily
To support mixed sheet orientations when printing, these calculations need to
be per-sheet. (This change will also be necessary further in the future when we
support saving to PDF with different sheet sizes.)

Differential Revision: https://phabricator.services.mozilla.com/D176914
2023-05-04 22:49:01 +00:00
Fred Chasen
2614aa90e5 Bug 1793220 - Handle at-page size rules that use zero as width or height r=dholbert
Setting an at-page size where the width or height is zero is valid CSS but is unprintable, so a size with zero in it will be ignored with this change.

Differential Revision: https://phabricator.services.mozilla.com/D167624
2023-02-27 20:22:18 +00:00
Jonathan Watt
a84880ffd8 Bug 1673987 - Implement page-orientation in @page rules for multiple pages-per-sheet. r=AlaskanEmily
Differential Revision: https://phabricator.services.mozilla.com/D169368
2023-02-10 00:56:35 +00:00
Emily McDonough
a45ccd2c9f Bug 1802238 - Don't allow using mixed page sizes when printing unless layout.css.allow-mixed-page-sizes is set r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D162920
2022-12-06 21:24:29 +00:00
Emily McDonough
c9eb4460e7 Bug 1803861 - Implement nsPageFrame::FirstContinuation and nsPageContentFrame::FirstContinuation with constant complexity r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D163759
2022-12-06 00:07:09 +00:00
Cristian Tuns
f57a2244e7 Backed out changeset b5b515b2a259 (bug 1802238) for causing crashtest failures on 1683126.html CLOSED TREE 2022-12-01 20:53:37 -05:00
Emily McDonough
0d1af39d57 Bug 1802238 - Don't allow using mixed page sizes when printing unless layout.css.allow-mixed-page-sizes is set r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D162920
2022-12-01 20:20:09 +00:00
Emily McDonough
2e5781f6ff Bug 1740365 Part 1 - Use CSS page name when constructing nsPageContentFrames and computed page content style r=dholbert,emilio
This works with margin and page-size, though we can't properly test mixed
page-size yet due to limitations in both print preview testing (which does not
handle multiple pages) and paged reftests (which ignore page-size).

It may be appropriate to remove the @page { margin } propagation from Servo
after this change.

Differential Revision: https://phabricator.services.mozilla.com/D158227
2022-11-10 23:43:48 +00:00
Cosmin Sabou
25a1b0c47d Backed out 2 changesets (bug 1740365) for causing bp-hybrid bustages on PresShell.h. CLOSED TREE
Backed out changeset b52bc7d5cf65 (bug 1740365)
Backed out changeset 5ba5fdd07fe0 (bug 1740365)
2022-11-10 18:06:51 +02:00
Emily McDonough
186f6606a6 Bug 1740365 Part 1 - Use CSS page name when constructing nsPageContentFrames and computed page content style r=dholbert,emilio
This works with margin and page-size, though we can't properly test mixed
page-size yet due to limitations in both print preview testing (which does not
handle multiple pages) and paged reftests (which ignore page-size).

It may be appropriate to remove the @page { margin } propagation from Servo
after this change.

Differential Revision: https://phabricator.services.mozilla.com/D158227
2022-11-10 15:30:39 +00:00
Jonathan Watt
26fe398c62 Bug 1798312 - Rename page::PageOrientation to page::PageSizeOrientation. r=AlaskanEmily
The @page rule may contain both 'page-orientation' and 'size' properties. The
'size' property can contain an orientation component which was being
represented as 'PageOrientation' prior to this patch. This patch changes that
to 'PageSizeOrientation' so that 'PageOrientation' can be used for
'page-orientation' in a subsequent patch.

Differential Revision: https://phabricator.services.mozilla.com/D160790
2022-10-31 22:52:16 +00:00
David Shin
e6118a5a8c Bug 1681183: Ignore unwriteable margins user specifies Margins: None for printing. r=dholbert,mstriemer
This lets users e.g. print-to-scale where it matters.
Custom margins are still clamped to unwriteable margins, even when all zeroes,
to avoid impacting user-specified & persisted margins.

Differential Revision: https://phabricator.services.mozilla.com/D152900
2022-08-15 19:55:08 +00:00
Ting-Yu Lin
06ddbd2b65 Bug 1464761 Part 4 - Remove nsReflowStatus::mTruncated bit. r=dholbert
In the description of the mTruncated bit, its purpose is the same as calling
SetInlineLineBreakBeforeAndReset(). We've removed all its usages in previous
patches, so the bit is no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D151461
2022-07-27 21:55:18 +00:00
Emily McDonough
e3614dba68 Bug 1774307 - Remove unused member of nsPageBreakFrame and make some variables in nsPageBreakFrame::Reflow const r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D149330
2022-06-15 00:34:02 +00:00
Emily McDonough
4f3ab1c8df Bug 1769161 Part 3 - Scale unwriteable margins and user-specified margins by the page-size scaling factor r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D148207
2022-06-10 19:37:22 +00:00
Emily McDonough
91262aa1ff Bug 1769161 Part 2 - Rename and document margin and sizing calculation for nsPageFrame margins. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D146602
2022-06-10 19:37:22 +00:00
Emily McDonough
7f1aecc783 Bug 1769161 Part 1 - Refactor scaling factor due to page-size for nsPageFrame to be in its own function. r=dholbert
This includes two versions of the function, one which takes an already-computed
page size to avoid computing this multiple times for a caller, and the other
which computes this value itself for convenience.

Differential Revision: https://phabricator.services.mozilla.com/D146601
2022-06-10 19:37:22 +00:00
Molnar Sandor
fcc1b7838e Backed out 4 changesets (bug 1769161) for causing mochitest failures in layout/base/tests/chrome/test_printpreview.xhtml CLOSED TREE
Backed out changeset d376decbcba0 (bug 1769161)
Backed out changeset a821b6bc4a18 (bug 1769161)
Backed out changeset 4ffac65dfc17 (bug 1769161)
Backed out changeset 616392cd1725 (bug 1769161)
2022-06-10 07:45:32 +03:00
Emily McDonough
88bb7ca966 Bug 1769161 Part 3 - Scale unwriteable margins and user-specified margins by the page-size scaling factor r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D148207
2022-06-09 23:51:07 +00:00
Emily McDonough
d45e94a661 Bug 1769161 Part 2 - Rename and document margin and sizing calculation for nsPageFrame margins. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D146602
2022-06-09 23:51:07 +00:00
Emily McDonough
2ff88825cd Bug 1769161 Part 1 - Refactor scaling factor due to page-size for nsPageFrame to be in its own function. r=dholbert
This includes two versions of the function, one which takes an already-computed
page size to avoid computing this multiple times for a caller, and the other
which computes this value itself for convenience.

Differential Revision: https://phabricator.services.mozilla.com/D146601
2022-06-09 23:51:07 +00:00
Emily McDonough
5a1e3df4ac Bug 1765011 - Ensure we do not truncate header/footer text in between surrogate pair characters r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D143855
2022-05-05 19:13:24 +00:00
Emilio Cobos Álvarez
7966ccdd67 Bug 1766020 - Add support for parsing container-query-specific features. r=firefox-style-system-reviewers,layout-reviewers,boris
There are some mediaqueries-5 features that we still don't support and
explain the remaining failures in at-container-{parsing,serialization}.

Differential Revision: https://phabricator.services.mozilla.com/D144446
2022-04-27 10:52:32 +00:00
Miko Mynttinen
528f0d244b Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 23:42:18 +00:00
Norisz Fay
baf6cd65cb Backed out 2 changesets (bug 1714584) per devs request for causing crashes a=backout
Backed out changeset 3baead3e079b (bug 1714584)
Backed out changeset a2da895a58ce (bug 1714584)
2022-02-22 16:41:57 +02:00
Miko Mynttinen
485b0007af Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 00:44:25 +00:00
Emily McDonough
abc8c55387 Bug 1730091 - Do not apply the scaling factor that accounts for nsPageContentFrame scaling to headers/footers r=dholbert
This scaling factor is to account for ComputePagesPerSheetAndPageSizeTransform,
but that is not used when printing headers/footers, which resulted in the
reversed scale clipping the header/footer.

Differential Revision: https://phabricator.services.mozilla.com/D136830
2022-02-04 01:31:31 +00:00
Csoregi Natalia
49bd3860ab Backed out changeset 8c4414cc1e61 (bug 1730091) for failures on test_printpreview.xhtml. CLOSED TREE 2022-02-03 04:38:16 +02:00
Emily McDonough
f203309eff Bug 1730091 - Do not apply the scaling factor that accounts for nsPageContentFrame scaling to headers/footers r=dholbert
This scaling factor is to account for ComputePagesPerSheetAndPageSizeTransform,
but that is not used when printing headers/footers, which resulted in the
reversed scale clipping the header/footer.

Differential Revision: https://phabricator.services.mozilla.com/D136830
2022-02-02 23:45:25 +00:00
Matt Woodrow
445639539e Bug 1728232 - Remove RestoreState. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124006
2021-09-13 05:01:34 +00:00
criss
3f0efebda9 Backed out 10 changesets (bug 1714138, bug 1542929, bug 1728232, bug 1729236, bug 1728258, bug 1728251, bug 1728050) for causing bug 1424348 a=backout
Backed out changeset c5b71e6ce0e5 (bug 1729236)
Backed out changeset c6bcc4ed3d2e (bug 1729236)
Backed out changeset 7e292895282a (bug 1729236)
Backed out changeset d9ddd915e0c2 (bug 1714138)
Backed out changeset 82b98d2f0dcf (bug 1728258)
Backed out changeset 9a84a36b9dc4 (bug 1542929)
Backed out changeset 96be978630ff (bug 1728251)
Backed out changeset d7a8bf19d849 (bug 1728251)
Backed out changeset cce0c53b439f (bug 1728232)
Backed out changeset 3afd6aee7849 (bug 1728050)
2021-09-12 12:00:30 +03:00
Matt Woodrow
fd0279e72a Bug 1728232 - Remove RestoreState. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124006
2021-09-10 03:43:32 +00:00
Marian-Vasile Laza
da24ed0855 Backed out 7 changesets (bug 1728050, bug 1728251, bug 1728232, bug 1542929, bug 1714138, bug 1728258) for causing reftest failures. CLOSED TREE
Backed out changeset 41e053201cd3 (bug 1714138)
Backed out changeset 16ae9f5b4aa0 (bug 1728258)
Backed out changeset 414aa7ff05fe (bug 1542929)
Backed out changeset 7217ecf149c4 (bug 1728251)
Backed out changeset 405ff2ed2110 (bug 1728251)
Backed out changeset 3eec9e6c7218 (bug 1728232)
Backed out changeset 66038c15fe54 (bug 1728050)
2021-09-07 09:00:26 +03:00
Matt Woodrow
22423c85ea Bug 1728232 - Remove RestoreState. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124006
2021-09-06 23:12:03 +00:00
Jonathan Kew
2f1b0578c6 Bug 1725297 - Remove expiring font telemetry probes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D124051
2021-08-31 13:48:51 +00:00
Jonathan Kew
b887626dcf Bug 1725940 - patch 2 - Move nsFontCache from the device context to the prescontext. r=emilio
To look up/instantiate platform fonts based on CSS font properties, we create a gfxFontGroup from an nsFont and other attributes; this is currently cached in an nsFontCache attached to the nsDeviceContext.

However, this assumes that the mapping to platform fonts will be the same for all documents using the given device context. In a world where visibility of platform fonts to the page may be restricted, and may depend on the individual document (e.g. if the user disables tracking protection for a particular site), the mapping represented by nsFontCache may vary, and determining how to resolve a given font request will need access to the requesting document in order to know what visibility it is allowed.

To support this, this patch moves the nsFontCache from nsDeviceContext to nsPresContext. In itself, this should cause no visible change in behavior, but it provides a basis for the patches that will follow in bug 1715501.

It's likely that this will have some effects on individual performance tests, depending on the exact content and sequencing of page loads, because of changed caching behavior. E.g. having a per-presContext cache may sometimes mean that we no longer take advantage of a cached gfxFontGroup that a previously-loaded page created; but on the other hand the caches will tend to be smaller and have faster lookups.

My testing so far suggests that we will see some apparent regressions, alongside some improvements, but that overall there should be little change. I'd like to get this change landed separately, before any of the actual font-visibility behavior changes, so that we can more clearly see and isolate any unexpected effects.

Differential Revision: https://phabricator.services.mozilla.com/D122715
2021-08-16 13:58:03 +00:00
Emily McDonough
c309205b03 Bug 1722890 Part 1 - Apply page scaling to the clipping rect for page content frames r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D122291
2021-08-12 23:31:19 +00:00