Desktop PWA opens popup windows at wrong size
Reported by
a...@scirra.com,
Oct 24 2017
|
|||||||||||
Issue descriptionUserAgent: 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
,
Oct 25 2017
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.
,
Nov 30 2017
Any news on this? Users are continuing to report this as an issue in our PWA.
,
Jan 16 2018
Users are still reporting this as an issue. Is anyone looking in to this?
,
Feb 26 2018
Users are continuing to report this as an issue (e.g. https://github.com/Scirra/Construct-3-bugs/issues/1318).
,
Jul 17
Users are still continuing to report this as an issue. Is anyone looking at this at all?
,
Jul 17
Also tested on Linux, and it works as expected - Window opens 500x300.
,
Jul 17
I've been experiencing this problem for around a year now. Window constantly at a wrong size.
,
Jul 17
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.
,
Jul 18
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.
,
Jul 18
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
,
Jul 18
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.
,
Jul 18
,
Jul 18
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.
,
Jul 18
,
Jul 19
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.
,
Jul 25
Possibly related is issue 677381, which has apparently slipped through the net and gone 18 months with no response from Google.
,
Jul 26
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).
,
Jul 26
avi@, do you have an idea of owner candidates of this issue?
,
Jul 26
Tagging John and Scott as Windows peeps who might have knowledge in this area.
,
Aug 14
Possibly related: https://bugs.chromium.org/p/chromium/issues/detail?id=567925
,
Sep 4
This issue is being repeatedly reported for our PWA, e.g.: https://github.com/Scirra/Construct-3-bugs/issues/947 https://github.com/Scirra/Construct-3-bugs/issues/1059 https://github.com/Scirra/Construct-3-bugs/issues/1200 https://github.com/Scirra/Construct-3-bugs/issues/1318 https://github.com/Scirra/Construct-3-bugs/issues/1987 This was reported around a year ago. Can someone start working on it? |
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by ligim...@chromium.org
, Oct 24 2017