Closed Bug 2017761 Opened 9 months ago Closed 9 months ago

Assertion failure: scaleX > 0.0f && scaleX <= 1.0f && scaleY > 0.0f && scaleY <= 1.0f, at layout/generic/nsPageFrame.cpp:721

Categories

(Core :: Printing: Output, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1836534

People

(Reporter: dholbert, Unassigned)

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file testcase 1 —

STR:

  1. Load attached testcase in a debug build.
  2. Choose a real printer as your print target (not Firefox's "Save to PDF" print backend)
  3. Expand the "More Settings" and choose 2 or 4 for "pages per sheet".

ACTUAL RESULTS:
Fatal assertion-failure:
Assertion failure: scaleX > 0.0f && scaleX <= 1.0f && scaleY > 0.0f && scaleY <= 1.0f, at /builds/worker/checkouts/gecko/layout/generic/nsPageFrame.cpp:721

EXPECTED RESULTS:
No such fatal assertion-failure.

Source reference:
https://searchfox.org/firefox-main/rev/d77116a11ffef8f77def09a5dd6082c2c2105f35/layout/generic/nsPageFrame.cpp#705-706,717-721

const nscoord cellWidth = sheetFrame->GetGridCellWidth();
const nscoord cellHeight = sheetFrame->GetGridCellHeight();
...
// Scale the page to fit, centered, in the grid cell:
float scaleX = float(cellWidth) / float(contentPageSize.width);
float scaleY = float(cellHeight) / float(contentPageSize.height);
MOZ_ASSERT(scaleX > 0.0f && scaleX <= 1.0f && scaleY > 0.0f &&
           scaleY <= 1.0f);

Values from GDB:

(gdb) p cellWidth
$2 = 23840
(gdb) p cellHeight
$3 = 30720
(gdb) p contentPageSize
$4 = {
  <mozilla::gfx::BaseSize<int, nsSize, int>> = {
    {
      {
        width = 23040,
        height = 28800
      },

Here, contentPageSize is from the @page { size: 4in 5in; [...] in the testcase; and Firefox is trying to scale down the page size to fit into a cell in our 4-pages-per-sheet grid, and we're getting confused because 4in by 5in is already smaller (no downscaling needed) than 1/4th of an 8.5in x 11in us-letter sheet.

This is a sign that we're accidentally scaling up the page size to fit into an N-pages-per-sheet "cell".

This is hard to see with testcase 1, but it's easier to see here with a 1in-by-1in page size. If you print preview this with a physical printer and a US-Letter sheet size, we show it faithfully as a tiny 1in by 1in square; but then if you choose pages-per-sheet:4, then we upscale the square to fill a quarter of the sheet.

Aha, this is bug 1836534.

Status: NEW → RESOLVED
Closed: 9 months ago
Duplicate of bug: 1836534
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: