Commit Graph
479 Commits
Author SHA1 Message Date
Ting-Yu Lin 4ef20f0ad7 Bug 1906792 Part 1 - Let nsLeafFrame and subclasses override GetIntrinsicSize(). r=layout-reviewers,emilio
`nsIFrame` already provides `GetIntrinsicSize()` for subclasses to override.
Therefore, `nsLeafFrame` doesn't need to introduce another version for its
subclasses.

This patch (hopefully) shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D215998
2024-07-09 18:49:32 +00:00
Ting-Yu Lin 8a77ebbb16 Bug 1888535 Part 5 - Remove DISPLAY_REFLOW. r=layout-reviewers,emilio
It is used in `Reflow()` implementations.

Differential Revision: https://phabricator.services.mozilla.com/D206317
2024-04-02 19:03:05 +00:00
Emily McDonough 82706767b1 Bug 1882890 Part 1 - When page scaling in nsPageFrame is small, center the content instead of putting in the upper left. r=dholbert,layout-reviewers,emilio
This is controlled by the pref print.center_page_on_sheet

Differential Revision: https://phabricator.services.mozilla.com/D203195
2024-03-28 19:00:51 +00:00
Norisz Fay 5747c02b72 Backed out 2 changesets (bug 1882890) for causing failures on test_printpreview.xhtml CLOSED TREE
Backed out changeset 08c947500cfc (bug 1882890)
Backed out changeset 6dfb0be3d0a0 (bug 1882890)
2024-03-28 04:03:07 +02:00
Emily McDonough 9ab114fa2f Bug 1882890 Part 1 - When page scaling in nsPageFrame is small, center the content instead of putting in the upper left. r=dholbert,layout-reviewers,emilio
This is controlled by the pref print.center_page_on_sheet

Differential Revision: https://phabricator.services.mozilla.com/D203195
2024-03-27 18:56:19 +00:00
Ting-Yu Lin 3676762a28 Bug 1865012 Part 3 - Remove FirstContinuation overrides for nsPageFrame and nsPageContentFrame. r=dholbert
The overrides were added in bug 1803861. With Part 1 , they are no longer
needed.

Actually, without this patch, the assertion "First descendent of
nsPageSequenceFrame should not have a previous continuation" in
`nsPageFrame::FirstContinuation` will be triggered when constructing frame tree,
because `nsSplittableFrame::SetPrevContinuation` now accesses
`FirstContinuation()`, but the parent-child relationship might not properly set
up yet.

Differential Revision: https://phabricator.services.mozilla.com/D197758
2024-01-23 23:15:02 +00:00
Norisz Fay a7b0088da8 Backed out 4 changesets (bug 1865012) for causing mochitest failure on test_gencontent.html CLOSED TREE
Backed out changeset 95d920859b91 (bug 1865012)
Backed out changeset 26f6c2765cb5 (bug 1865012)
Backed out changeset 30a3c356ebc9 (bug 1865012)
Backed out changeset 4fb71ff990ae (bug 1865012)
2024-01-23 02:17:49 +02:00
Ting-Yu Lin 43d19da8ac Bug 1865012 Part 3 - Remove FirstContinuation overrides for nsPageFrame and nsPageContentFrame. r=dholbert
The overrides were added in bug 1803861. With Part 1 , they are no longer
needed.

Actually, without this patch, the assertion "First descendent of
nsPageSequenceFrame should not have a previous continuation" in
`nsPageFrame::FirstContinuation` will be triggered when constructing frame tree,
because `nsSplittableFrame::SetPrevContinuation` now accesses
`FirstContinuation()`, but the parent-child relationship might not properly set
up yet.

Differential Revision: https://phabricator.services.mozilla.com/D197758
2024-01-22 19:50:49 +00:00
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