Commit Graph
55 Commits
Author SHA1 Message Date
Eugeniusz Lewandowski fc8097fcc3 Bug 1650944 - Remove ReflowInput.h include from nsIFrame.h r=firefox-style-system-reviewers,layout-reviewers,emilio
Removed the Reflow Input in nsIFrame. Added includes for ReflowInput as
necessary in cpp files. Also Forward Declared nsLineLayout in 3 header
files.

Differential Revision: https://phabricator.services.mozilla.com/D298203
2026-05-04 12:06:23 +00:00
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
Ting-Yu Lin 19124a708f Bug 2009647 Part 2 - Add measuring reflow in printing scenarios for fragmentainer-aware abspos positioning. r=layout-reviewers,dshin
This extends the measuring reflow mechanism from multicol (Bug 1994346) to
printing scenarios. When absolutely positioned elements exist, we now perform
an initial measuring reflow with an unconstrained page height to compute
unfragmented positions, sizes, etc.

Each frame type (nsPageSequenceFrame, nsPageFrame, PrintedSheetFrame,
nsPageContentFrame) has their own logic to calculate the available size for its
child, and they do not derive the size from their own reflow input's available
size. To avoid substantial refactoring, this patch checks
`mIsInFragmentainerMeasuringReflow` and overrides the available block-size to
unconstrained when running a measuring reflow.

Differential Revision: https://phabricator.services.mozilla.com/D284550
2026-02-25 05:20:37 +00:00
serge-sans-paille a6fd653fe8 Bug 1999717 - Remove unused STL header inclusions in layout/** r=emilio,firefox-style-system-reviewers,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D272285
2025-11-12 20:47:05 +00:00
Ting-Yu Lin 3fca23660d Bug 1897135 Part 2 - Remove redundant mFrameManager member in PresShell. r=dholbert
We can just use `mFrameConstructor` to call `GetRootFrame()`. In order to do so
while keeping `PresShell::GetRootFrame()` as a inline method, we need to include
`nsCSSFrameConstructor` header in `PresShell.h`, and remove `PresShell` header
in `nsCSSFrameConstructor.h`. That means we can no longer inline
`RestyleManager()` since it needs to access `PresShell`, but it's OK since
`RestyleManager` is used only in the frame constructor, and is probably not in
the hot path.

Differential Revision: https://phabricator.services.mozilla.com/D210670
2024-05-17 21:37:01 +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
Jonathan Watt 8620798225 Bug 1868710. Guard the mixed sheet size code with the correct pref. r=AlaskanEmily
The various prefs related to CSS page size etc. have gotten confused. That
said...

The pref check in `PrintedSheetFrame::ComputeSheetSize` is really a redundant
early return, since the values returned from the `ComputePageSize()` and
`GetPageOrientationRotation()` calls that follow it are pref guarded.

Similarly, the gfx checks are just belt and braces given the sheet size
computation is already pref guarded, and it's the value from that that's being
fed through to these locations.

Nevertheless, let's leave these checks in for now, but just guard them with
the actual pref that's supposed to control whether the pages in PDF output
can have different sizes.

Differential Revision: https://phabricator.services.mozilla.com/D195743
2023-12-08 01:11:19 +00:00
Jonathan Watt e867c0bdf9 Bug 1865485. Rename nsIPrintSettings::HasOrthogonalSheetsAndPages to HasOrthogonalPagesPerSheet. r=dholbert
The old name is potentially misleading now that we implement 'page-orientation'
since that provides a new mechanism by which pages could end up orthoganal
to the sheet, but this method is very specifically about pages-per-sheet
induced rotation.

Differential Revision: https://phabricator.services.mozilla.com/D193989
2023-11-20 09:14:50 +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
Jonathan Watt 05e63b3bcb Bug 1833244 p1. Create infrastructure to pass page dimensions to PrintTarget::BeginPage. r=dholbert,geckoview-reviewers,jonalmeida
OS print drivers/devices know nothing about page dimensions unless we tell
them. Previously, the physical page dimensions (including orientation) have
always been the same, so communicating their dimensions once at the start of
a print has been enough. In preparation for supporting different "physical"
page dimensions (in the immediate future only different page orientations) when
we save to PDF, we need to have the infrastructure to pass dimensions through
on a page-by-page basis. This patch adds that.

None of the PrintTarget subclasses do anything with this extra information yet,
but in a follow-up patch PrintTargetPDF will use this information to create
PDFs with mixed page orientations.

Differential Revision: https://phabricator.services.mozilla.com/D179423
2023-07-10 14:26:12 +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 8bf72ebc46 Bug 1833244 p2. Create infrastructure to pass page dimensions to PrintTarget::BeginPage. r=dholbert
OS print drivers/devices know nothing about page dimensions unless we tell
them. Previously, the physical page dimensions (including orientation) have
always been the same, so communicating their dimensions once at the start of
a print has been enough. In preparation for supporting different "physical"
page dimensions (in the immediate future only different page orientations) when
we save to PDF, we need to have the infrastructure to pass dimensions through
on a page-by-page basis. This patch adds that.

None of the PrintTarget subclasses do anything with this extra information yet,
but in a follow-up patch PrintTargetPDF will use this information to create
PDFs with mixed page orientations.

Differential Revision: https://phabricator.services.mozilla.com/D179423
2023-06-03 14:21:37 +00:00
Iulian Moraru 083e1115f0 Backed out changeset 9fce1abd1c50 (bug 1833244) for causing build bustages on nsDeviceContextAndroid.h. CLOSED TREE 2023-05-31 16:31:53 +03:00
Jonathan Watt abac61f9ca Bug 1833244 p1. Create infrastructure to pass page dimensions to PrintTarget::BeginPage. r=dholbert
OS print drivers/devices know nothing about page dimensions unless we tell
them. Previously, the physical page dimensions (including orientation) have
always been the same, so communicating their dimensions once at the start of
a print has been enough. In preparation for supporting different "physical"
page dimensions (in the immediate future only different page orientations) when
we save to PDF, we need to have the infrastructure to pass dimensions through
on a page-by-page basis. This patch adds that.

None of the PrintTarget subclasses do anything with this extra information yet,
but in a follow-up patch PrintTargetPDF will use this information to create
PDFs with mixed page orientations.

Depends on D179395

Differential Revision: https://phabricator.services.mozilla.com/D179423
2023-05-31 13:02:26 +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 365cb046e7 Bug 1835447. Use print pages' own computed size as their container size. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D179290
2023-05-29 00:09:43 +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 741805cd60 Bug 1833682. Fix n-pages-per-sheet regression, to ensure we properly scale pages beyond the first sheet. r=dholbert
When splitting out the code for bug 1830900 I missed this rather important line.
That bug changed the code to store certain values on a per-sheet basis, but
forgot to include this line to calculate them for all sheets (as opposed to
just the first sheet).

Differential Revision: https://phabricator.services.mozilla.com/D178347
2023-05-18 03:00:31 +00:00
Norisz Fay 6080554647 Backed out changeset 5c3497c1599f (bug 1833682) for causing assertion failures on PrintedSheetFrame.cpp 2023-05-18 00:19:14 +03:00
Jonathan Watt 1b5f6da84e Bug 1833682. Fix n-pages-per-sheet regression, to ensure we properly scale pages beyond the first sheet. r=dholbert
When splitting out the code for bug 1830900 I missed this rather important line.
That bug changed the code to store certain values on a per-sheet basis, but
forgot to include this line to calculate them for all sheets (as opposed to
just the first sheet).

Differential Revision: https://phabricator.services.mozilla.com/D178347
2023-05-17 20:10:07 +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
Jonathan Watt 890ec5db90 Bug 1824852. Ensure PrintedSheetFrame calls MoveOverflowToChildList before reflow. r=dholbert
The intention is to allow PrintedSheetFrame::Reflow to access the page style
prior to reflowing its child so that it can decide whether to apply page style
to the sheet (in the case of one page-per-sheet). This will happen in a
subsequent bug.

Differential Revision: https://phabricator.services.mozilla.com/D173773
2023-03-30 11:29:29 +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
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
Emilio Cobos Álvarez 1b4b657dc0 Bug 1700379 - Move code dealing with transform getters to the frame that we actually wrap its contents around. r=miko
This shouldn't change behavior, but simplifies the setup quite a bit, I
think.

Differential Revision: https://phabricator.services.mozilla.com/D109510
2021-05-04 18:46:44 +00:00
Alexandru Michis af1b3332b6 Backed out changeset 0229f8dc291a (bug 1700379) for causing failures in test_printpreview.xhtml
CLOSED TREE
2021-05-03 22:10:12 +03:00
Emilio Cobos Álvarez e09580e642 Bug 1700379 - Move code dealing with transform getters to the frame that we actually wrap its contents around. r=miko
This shouldn't change behavior, but simplifies the setup quite a bit, I
think.

Differential Revision: https://phabricator.services.mozilla.com/D109510
2021-05-03 17:59:47 +00:00
Emilio Cobos Álvarez d791b7bfc8 Bug 1691858 - Minor cleanup of our @page rule setup. r=AlaskanEmily
Actually, there's not so much we can improve right now, in the sense
that:

 * We need the ::-moz-page-content pseudo-element to be able to set
 `display` on the page, since that's a style rule rather than a @page
 rule. We could get away without it.

 * Keeping the current code-path (slightly cleaned up) is less code, for
 now at least. We can have a separate code-path or what not that
 actually performs the @page rule selector-matching and what not if
 needed when we get to named pages or other page selectors. Selectors
 like :first should be pretty trivial to implement, actually.

We make some paged mode anon boxes non-inheriting anon boxes. This
allows us to share the styles and is generally nicer. They don't need to
inherit from anywhere.

We could remove the origin handling and don't look at UA rules or what
not, but it seems pretty harmless to do that.

We also fix the name of the pseudo-elements to match the capitalization.

Differential Revision: https://phabricator.services.mozilla.com/D104772
2021-02-12 15:42:38 +00:00
Daniel Holbert dd81406515 Bug 1669905 part 3: Add support for 2 and 6 as options for pages-per-sheet, in the print-related frame classes (and add tests for these values). r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D99553
2021-01-05 02:13:03 +00:00
Daniel Holbert 8d87f25f7c Bug 1669905 part 1: Adjust PrintedSheetFrame::BuildDisplayList to avoid clipping nsPageFrame children. r=TYLin
Without this patch, the rest of this bug's patch-stack can end up improperly
clipping content at the bottom of pages, when printing in 2- and
6-pages-per-sheet configurations.

This clipping problem happens because we build the nsPageFrame's display items
*without direct knowledge* of the fact that it's scaled down, and that ends up
confusing the display list code about whether content is visible.  Here's what
happens, when we improperly clip (in a build with all of this bug's patches
except for this one):

 (1) We size & scale the print-preview scrollport to display a
landscape-oriented sheet (onto which we plan to lay out two
portrait-oriented pages, if we're e.g. rendering with 2 pages-per-sheet).

 (2) The scrollport area gets passed down as the visible area in our
BuildDisplayList codepath.

 (3) When we build the display list for a nsPageFrame (before we've applied its
pages-per-sheet scale-down transform), the display list code correctly judges
that some of the page's display items (e.g. its footers) are beyond the bottom
of the scrollport and can safely be clipped. (At first, they seem like they're
beyond the bottom of the scrollport, since they're part of a tall-and-skinny
portrait-oriented nsPageFrame that we're laying out in a scrollport that's been
sized for a short-and-wide landscape-oriented sheet).

 (4) Then we scale down the rendered nsPageFrame to place it on our sheet, and
we find that part of the page is missing -- the part that was out of the
scrollport from the display list code's perspective -- even though it's now
transformed to be fully visible.

The simplest fix for this is to temporarily override the visible rect to be the
nsPageFrame's full mRect.  This fix prevents us from thinking that any of the
nsPageFrame should be clipped (except for parts that legitimately overflow the
nsPageFrame, which of course are still appropriate to clip).

Note that nsPageFrame itself does this same visible-rect-replacement trick,
when it renders its own nsPageContentFrame child.  This patch is partially
cribbed from nsPageFrame's similar code.

Differential Revision: https://phabricator.services.mozilla.com/D100425
2021-01-05 02:26:57 +00:00
Daniel Holbert dbdfca78bb Bug 1681623: Simplify pages-per-sheet data & logic to only store a single track count (either the row or column count), since the other one is implicit. r=TYLin
This patch doesn't change behavior.  It's just a simplification of the data
that we track for our different pages-per-sheet mode (with some minor
refactoring of the logic involved).

This is a necessary step towards implementing support for 2 and 6
pages-per-sheet (which are referenced in comments included in this patch,
and which will be implemented separately in bug 1669905)

Differential Revision: https://phabricator.services.mozilla.com/D99180
2020-12-10 00:58:43 +00:00
Daniel Holbert 58f9b1a0ca Bug 1670068 part 1: When printing in pages-per-sheet mode, be sure we don't place any of the pages into the sheet's "unwriteable margin" area. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D98713
2020-12-08 00:00:02 +00:00
Emilio Cobos Álvarez 4a92eafa04 Bug 1679706 - Communicate to the front-end whether there are no visible pages at all. r=jfkthame
This will allow them to react however they want to empty page ranges as
a result of another setting change.

Differential Revision: https://phabricator.services.mozilla.com/D98183
2020-12-02 21:48:03 +00:00
Emilio Cobos Álvarez 021c3e99a4 No bug - fix a comment typo (dispayed/displayed).
DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D98181
2020-11-30 12:22:27 +00:00
Emilio Cobos Álvarez d1c43878e6 Bug 1669854 - Add a single pageRanges print setting. r=nordzilla
... which is an array of pairs of ranges, and use it instead of the
existing printRange / startPage / endPage settings.

Differential Revision: https://phabricator.services.mozilla.com/D96093
2020-11-07 16:01:57 +00:00
Daniel Holbert 17fe9772c4 Bug 1631452 part 2: Add the pages-per-sheet info to nsSharedPageData and use it to control the number of pages that end up on a PrintedSheetFrame. r=TYLin,mattwoodrow
The idea here is that we reflow each page as if it were the only page on its
sheet, and then we transform it as-needed to put it in the right
"pages-per-sheet" cell, at paint time.

LIMITATION: Right now I haven't implemented the values "2" and "6", since those
will involve a bit of extra complexity to rotate the sheet to be orthogonal to
the page sizes (and to only do that if the page's aspect ratio merits it). That
will be covered in followup bug 1669905.

Differential Revision: https://phabricator.services.mozilla.com/D86800
2020-10-13 23:30:42 +00:00
Daniel Holbert b85e4e71b3 Bug 1661868 part 2: Unify page-range handling logic, to assume all PrintedSheetFrames should be printed (and let them manage page-range-based skipping during layout). r=TYLin
This patch does the following things:

(1) It removes the legacy page-range-handling function
"DetermineWhetherToPrintPage()", and it now will always print every
PrintedSheetFrame.

(2) It activates PrintedSheetFrame's page-range handling function so that it
can take over responsibility for skipping pages during print operations.

(3) It adjusts the nsPrintJob code that kicks off individual asynchronous
"print the next page" operations (which is now really "print the next
PrintedSheetFrame).  This nsPrintJob code used to have page-range-related
handling interwoven into it, and that handling isn't necessary anymore now that
we're handling page-skipping up front at layout time.

(4) It replaces the mPageNum member-var (which tracks which page we're about to
print or are currently printing) with mCurrentSheetIdx, which is now a 0-based
index into the list of PrintedSheetFrame instances.

(5) It removes nsPrintData:mNumPagesPrinted, which was only used for
progress-bar-completion updates & which basically tracked the same information
that I'm tracking in the new mCurrentSheetIdx variable.

There's some additional cleanup that we should do after this lands (e.g. some
s/page/sheet/ renamings) but I'm holding off on that for now, to keep this
patch relatively targeted.

Differential Revision: https://phabricator.services.mozilla.com/D92660
2020-10-07 20:51:56 +00:00
Daniel Holbert aee0177344 Bug 1661868 part 1: Broaden PrintedSheetFrame's "layout-time" page-range handling to support complex page ranges. r=TYLin
This patch does the following:

* It adds better documentation for the meanings of the page range member-vars
in nsSharedPageData.

* It copies some logic (with minor tweaks) from the legacy codepath that
handles page-range support (nsPageSequenceFrame::DetermineWhetherToPrintPage())
into to the new codepath for page-range support (PrintedSheetFrame.cpp's helper
function "TagIfSkippedByCustomRange()").

At this point in the patch stack, the legacy codepath is unchanged & still
handles all print operations; and the new PrintedSheetFrame.cpp codepath only
handles page-range-skipping for the print-preview visualization in the
Tab-Modal print dialog. So, this patch effectively gives that print-preview
visualization the platform-support that it would need for complex page ranges
(though that's not available in the UI at this point, so you can't really test
that).

Spoiler alert: the next patch in this series will remove the legacy codepath
entirely, and at *that* point, the platform-native print dialog's
complex-page-range feature will be backed by the PrintedSheetFrame.cpp code
that's added here.

Differential Revision: https://phabricator.services.mozilla.com/D92696
2020-10-07 20:45:23 +00:00
Daniel Holbert dcdb038cf7 Bug 1662940: Add back assertion to ensure we don't create printed sheets with no pages on them (softened for the first sheet). r=hiro
Per the comment in the patch: if we're given a bogus range, we can technically
end up with a single PrintedSheetFrame that contains no displayable
pages. Luckily, that's a situation that the frontend should detect & recover
from quickly & gracefully, so it's not really a problem. So: in that scenario,
we'll now spam a non-fatal warning; and we'll fatally assert if any sheet
*beyond* the first page has zero displayable pages. (That still shouldn't be
possible.)

Differential Revision: https://phabricator.services.mozilla.com/D89537
2020-09-09 02:30:59 +00:00
Emma Malysz 42bb8307d6 Bug 1661852, honor printRange option and update startRange when the number of pages changes r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D89084
2020-09-03 03:03:05 +00:00
Daniel Holbert 1682dcf563 Bug 1659005 part 4: Check for page-range-skipped pages for tab-modal print preview, and group them as unpainted additional children on the nearest PrintedSheetFrame. r=TYLin
For now, we *only* use this new page-skipping code during print preview, via a
PresContext::IsScreen() check.  There's a separate legacy codepath that we'll
continue to use for skipping pages during actual printing; see e.g.
nsPageSequenceFrame::DetermineWhetherToPrintPage().  I intend to replace that
codepath soon, but for now I'm leaving it intact, in the interests of making
this patch minimally invasive & low-risk for beta uplift.

Differential Revision: https://phabricator.services.mozilla.com/D87394
2020-08-29 00:58:14 +00:00
Daniel Holbert fd9b34985d Bug 1659005 part 3: Remove checks for a hypothetical pre-existing pageFrame next-in-flow (which can't happen, in practice). r=TYLin
This patch shouldn't change behavior at all.

Since our print reflow pipeline doesn't try to handle incremental reflow (per
the early return in nsPageSequenceFrame::Reflow), we can safely assume that our
page frames don't have a preexisting next-in-flow (until we explicitly create
one for them).

This simplifies the logic & the number of scenarios that we need to consider.

Differential Revision: https://phabricator.services.mozilla.com/D88470
2020-08-28 22:31:50 +00:00