New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 777854 link

Starred by 5 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows , Chrome
Pri: 2
Type: Bug

Blocked on:
issue 677381



Sign in to add a comment

Desktop PWA opens popup windows at wrong size

Reported by a...@scirra.com, Oct 24 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3248.2 Safari/537.36

Steps to reproduce the problem:
1. Visit: https://www.scirra.com/labs/bugs/a2hspopup/
2. Click 'Open popup'
3. Verify popup says "Window inner size is 500 x 300", then close it
4. Select menu -> More tools -> Add to desktop, and ensure "Open as window" ticked
5. Open the desktop shortcut
6. Click 'Open popup'

What is the expected behavior?
Popup should be created at the same size it was the first time: 500 x 300

What went wrong?
Popup is created at a slightly smaller size when run from the desktop shortcut. Here I get 484 x 261.

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 64.0.3248.2  Channel: canary
OS Version: 10.0
Flash Version: 

This affects our desktop PWA Construct 3 (editor.construct.net). We save and restore popup sizes when previewing a game, and the result is popups get smaller every time they are opened. This was first reported to us here: https://github.com/Scirra/Construct-3-bugs/issues/947
 
Labels: Needs-Triage-M64
Cc: rkalavakuntla@chromium.org
Components: UI>Browser
Labels: M-64
Status: Untriaged (was: Unconfirmed)
Tested this issue on Win-7 & Win-10 using chrome reported version 64.0.3248.2 and able to reproduce the issue.
Steps to reproduce the problem:
1. Visited: https://www.scirra.com/labs/bugs/a2hspopup/
2. Clicked 'Open popup'
3. Verified popup says "Window inner size is 500 x 300", then closed it
4. Selected menu -> More tools -> Add to desktop, and ensured "Open as window" ticked
5. Opened the desktop shortcut
6. Clicked 'Open popup' and Observed that popup is created at a slightly smaller size when run from the desktop shortcut.Here I got 484 x 261 for Win-10 and 484 x 262 for Win-7.
Please find the attached screencast for reference.
Also tested this issue on Ubuntu 14.04 using chrome reported version 64.0.3248.2 and unable to reproduce the issue.

This is a Non-Regression issue as this issue is observed from M50 chrome builds.

Hence marking this as 'Untriaged' for further updates from Dev.

Thanks.
777854.webm
3.0 MB View Download

Comment 3 by a...@scirra.com, Nov 30 2017

Any news on this? Users are continuing to report this as an issue in our PWA.

Comment 4 by a...@scirra.com, Jan 16 2018

Users are still reporting this as an issue. Is anyone looking in to this?

Comment 5 by a...@scirra.com, Feb 26 2018

Users are continuing to report this as an issue (e.g. https://github.com/Scirra/Construct-3-bugs/issues/1318).
Users are still continuing to report this as an issue. Is anyone looking at this at all?
Cc: mgiuca@chromium.org
Components: UI>Browser>WebAppInstalls Platform>Apps>Foundation
Also tested on Linux, and it works as expected - Window opens 500x300. 
I've been experiencing this problem for around a year now. Window constantly at a wrong size.
Cc: ortuno@chromium.org alancutter@chromium.org
Components: -UI>Browser -UI>Browser>WebAppInstalls -Platform>Apps>Foundation Platform>Apps
I don't think this is a PWA-specific issue. I think it's a general problem with bookmark apps.

I remember fixing a vaguely similar size issue with DevTools a while ago (https://bugs.chromium.org/p/chromium/issues/detail?id=222428). I suspect something similar is going on here where the popup is assuming that there's UI that's not actually present when it calculates sizes.
Labels: OS-Chrome
Weird: On Chrome OS this doesn't even work properly in the normal case.

- Chrome OS from normal browser tab: 500 x 257
- Chrome OS from installed app: 500 x 268

The discrepancy in vertical height is understandable (though still wrong) because the address bar is hidden in the PWA case. But I don't understand the discrepancy in horizontal width.
Testing on Windows 10 ToT build (69.0.3493.0 	00d1887a807c3b7ab3c802a0fd9aef0f658b7a85-refs/heads/master@{#575194}):
From normal browser: 500 x 303
From installed app window: 484 x 264
Components: -Platform>Apps Blink>WindowDialog
Tracked this down to https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/page/create_window.cc?q=CreateNewWindow which does:

  // ... 'width' and 'height'
  // specify the size of the viewport. We can only resize the window, so adjust
  // for the difference between the window size and the viewport size.
  // ...
  if (features.width_set)
    window_rect.SetWidth(features.width +
                         (window_rect.Width() - viewport_size.Width()));
  if (features.height_set)
    window_rect.SetHeight(features.height +
                          (window_rect.Height() - viewport_size.Height()));

So the calculation "window_rect.Height() - viewport_size.Height()" must be wrong (or, it changes after this calculation is made).

Tagging with Blink>WindowDialog since this is happening in other popups, not just bookmark apps.
Status: Available (was: Untriaged)
OK: I put in a LOG on this calculation and it's (on Chrome OS):

[1:1:0718/173432.148743:ERROR:create_window.cc(250)] Window width = 500 + (0 - 0) = 500
[1:1:0718/173432.148901:ERROR:create_window.cc(259)] Window height = 300 + (0 - 0) = 300

Looks like *at* the time of creating this window, both window_rect and viewport_size are 0. So we simply aren't adjusting the window frame for the border size at all.

window.outerWidth and window.outerHeight is 500 x 300.
Cc: -rkalavakuntla@chromium.org
So here's where |window_rect| and |viewport_size| come from:

  IntRect window_rect = page->GetChromeClient().RootWindowRect();
  IntSize viewport_size = page->GetChromeClient().PageRect().Size();

The implementation of PageRect in ChromeClientImpl:

  IntRect ChromeClientImpl::PageRect() {
    return RootWindowRect();
  }

So yeah, |window_rect| and |viewport_size| will always be exactly the same. So "window_rect.Width() - viewport_size.Width()" will always be 0 and the window size will always be set ignoring the window border.

RootWindowRect was renamed from WindowRect in r412667 (dominickn@ found this) but it seems even at that time, pageRect just called rootWindowRect. So I'm not sure this ever "regressed", it's just wrong, and I don't think it can be fixed here; it has to be fixed at a later phase in the creation of the window.
Possibly related is issue 677381, which has apparently slipped through the net and gone 18 months with no response from Google.
Blockedon: 677381
Cc: tkent@chromium.org mkwst@chromium.org japhet@chromium.org
I think these are the same issue but I'll keep them separate but linked, due to this being specific to PWA windows.

Finding an owner for this is hard. This code traces back to WebKit (pre-Blink). For example, the above code is largely unchanged in this 2012 version of WebKit:

https://chromium.googlesource.com/chromium/src/+/211f346e/third_party/WebKit/Source/WebCore/loader/FrameLoader.cpp#3327

In fact, it's still there:

https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/loader/FrameLoader.cpp#L3970

I don't think anybody who currently works on Chromium is responsible for this, and I'm not sure who would know about browser window creation now. CCing a few people who might have context based on sifting through the blame (tkent, japhet, mkwst).
Cc: -tkent@chromium.org a...@chromium.org
avi@, do you have an idea of owner candidates of this issue?

Cc: jam@chromium.org sky@chromium.org
Tagging John and Scott as Windows peeps who might have knowledge in this area.

Sign in to add a comment