Viewport width client hint is not included on the main frame requests |
||||||
Issue descriptionWith browser side navigation now enabled in Chrome, the main frame requests are sent on the network even before the renderer process is created. This means any client hints that are attached as request headers only in the render process are no longer attached to the main frame request. We have already ported the logic for attaching the device-memory and the dpr client hint to the browser process. See GetAdditionalNavigationRequestClientHintsHeaders() method in chrome/browser/client_hints/client_hints.h. However, currently, the viewport-width client hint is still not included on the main frame requests. We need a mechanism to compute the viewport-width in the browser process, and include it as a request header.
,
Mar 15 2018
,
Mar 15 2018
We need to find an owner of this bug. I am not very familiar with how the viewport is computed. Ilya, Yoav, suggestions?
,
Mar 15 2018
,
Mar 16 2018
I was able to fix this for Desktop (the CL is in-flight). On Android, all the existing APIs that I tried return 1080px on my phone. My phone indeed has 1080 px resolution. However, the Blink code that computes the viewport width computes it as 980 px. Yoav, do you happen to know how 980px is computed?
,
Mar 17 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5c28afb44d6b24345d7f86c7947b8a8b17eb300f commit 5c28afb44d6b24345d7f86c7947b8a8b17eb300f Author: Tarun Bansal <tbansal@chromium.org> Date: Sat Mar 17 02:55:20 2018 Include viewport-width client hint on main frame navigations on desktop Bug: 821974 Change-Id: Icceeabb2e31c702341d898193f5ad6870b2d3f1e Reviewed-on: https://chromium-review.googlesource.com/967095 Commit-Queue: Tarun Bansal <tbansal@chromium.org> Reviewed-by: Ryan Sturm <ryansturm@chromium.org> Cr-Commit-Position: refs/heads/master@{#543925} [modify] https://crrev.com/5c28afb44d6b24345d7f86c7947b8a8b17eb300f/chrome/browser/client_hints/client_hints.cc [modify] https://crrev.com/5c28afb44d6b24345d7f86c7947b8a8b17eb300f/chrome/browser/client_hints/client_hints_browsertest.cc [modify] https://crrev.com/5c28afb44d6b24345d7f86c7947b8a8b17eb300f/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers [modify] https://crrev.com/5c28afb44d6b24345d7f86c7947b8a8b17eb300f/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers [modify] https://crrev.com/5c28afb44d6b24345d7f86c7947b8a8b17eb300f/chrome/test/data/client_hints/accept_ch_without_lifetime_img_localhost.html.mock-http-headers
,
Mar 19 2018
Apologies, but I don't remember specifics here. If I had to guess, I'd guess it's something that's the result of PageScaleConstraints[1]. So I would start by printing out the values there on Android. (on the roads, so can't build for Android here...) Thinking about it, `viewport-width` for the navigation request could be different than the one for subresource requests as `<meta name=viewport>` may be impacting the results of what you see inside the renderer. tbansal@ - is the 980px vs. 1080px difference something you see in all pages? Also, is the viewport-width value on the navigation request specified somehow? [1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h?type=cs&sq=package:chromium&l=48
,
Mar 19 2018
+rune and mounir who probably know more than me about Android viewport settings
,
Mar 20 2018
Seems like 980px is the default value. https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/css/viewportAndroid.css https://developers.google.com/web/fundamentals/design-and-ux/responsive/ The developer can override it later by using meta tags, but that can happen only after the browser receives response back from the server. For main frame requests on Android, seems like it should be safe to always send 980px as the value.
,
Mar 20 2018
OK, that makes sense. @igrigorik - would be good to specify the browser behavior here somewhere, although I'm not sure what's the best place for that. Maybe Fetch?
,
Mar 20 2018
Yoav: can you clarify which part(s) you're referring to?
,
Mar 20 2018
When it comes to Viewport-Width, there are multiple values[1] that can be sent both for the case of navigation requests as well as subresource requests. It makes sense to me that we'd define the navigation request to use the initial viewport and subresource requests to use the resource viewport width. [1] https://drafts.csswg.org/css-device-adapt/#constraining-defs
,
Mar 20 2018
,
Mar 20 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/79df868e50bae74269ced7a1a45510b254281d7b commit 79df868e50bae74269ced7a1a45510b254281d7b Author: Tarun Bansal <tbansal@chromium.org> Date: Tue Mar 20 23:01:36 2018 Send viewport width on main frame navigations on Android The value is set to 980px which is the default value on Android. Bug: 821974 Change-Id: I6f3842d503ba62b752969a97e1e714109afff497 Reviewed-on: https://chromium-review.googlesource.com/971351 Commit-Queue: Tarun Bansal <tbansal@chromium.org> Reviewed-by: Ryan Sturm <ryansturm@chromium.org> Cr-Commit-Position: refs/heads/master@{#544578} [modify] https://crrev.com/79df868e50bae74269ced7a1a45510b254281d7b/chrome/browser/client_hints/client_hints.cc [modify] https://crrev.com/79df868e50bae74269ced7a1a45510b254281d7b/chrome/browser/client_hints/client_hints_browsertest.cc
,
Mar 20 2018
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by tbansal@chromium.org
, Mar 14 2018