Closed Bug 1793605 Opened 3 years ago Closed 3 years ago

On Headless and Linux new windows appear to not open at their intended size immediately.

Categories

(Core :: Layout, defect)

defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: matc.pub, Assigned: matc.pub)

Details

Attachments

(3 files)

Steps to reproduce:

Open a new window an log its sizes.

onclick = function () {
  let win = open(document.location.href, "", "width=200,height=200");
  console.log(win.innerWidth, win.innerHeight);
  win.onload = function () {
    console.log(win.innerWidth, win.innerHeight);
    win.close();
  };
};

This behavior started after Bug 1786513 (Make SimpleResizeReflow not flush by default.). The windows do indeed open at their intended size but the layout is not flushed early enough.

Actual results:

Log looks like:

1280 931
200 200

Expected results:

Log should look like:

200 200
200 200

Without flushing the layout, new windows appear to initially open at the
size of their opener instead of their intended size.

We can flush the layout from OpenWindowInternal when we have access to
chrome. For remote tabs we can extend the condition for
nsFrameLoader::ForceLayoutIfNecessary to also apply when the pres shell
needs a layout flush.

Assignee: nobody → matc.pub
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

I extended the test case a bit to include the view from the content in the new window. And it looks like by the time the content gets to run scripts the layout is reliably already flushed (without any of my changes), e.g. the window appears properly sized to the content in the new window.

Attachment #9297130 - Attachment description: Bug 1793605 - Flush layout of new windows after SizeOpenedWindow call. r=emilio → Bug 1793605 - Flush layout in window.open calls with specified size. r=emilio
Component: Untriaged → Layout
Product: Firefox → Core
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3549afc9ae93 Flush layout in window.open calls with specified size. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: