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

Issue 821974 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 1
Type: Bug

Blocking:
issue 735518



Sign in to add a comment

Viewport width client hint is not included on the main frame requests

Project Member Reported by tbansal@chromium.org, Mar 14 2018

Issue description

With 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.
 
 
Description: Show this description
Components: UI>Browser>Navigation
We need to find an owner of this bug. I am not very familiar with how the viewport is computed. Ilya, Yoav, suggestions?
Labels: OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows
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?

Comment 7 by y...@yoav.ws, 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

Comment 8 by y...@yoav.ws, Mar 19 2018

Cc: mlamouri@chromium.org futhark@chromium.org
+rune and mounir who probably know more than me about Android viewport settings
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.

Comment 10 by y...@yoav.ws, 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?
Yoav: can you clarify which part(s) you're referring to?

Comment 12 by y...@yoav.ws, 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
Labels: -Pri-3 M-67 Pri-1
Owner: tbansal@chromium.org
Status: Started (was: Untriaged)
Project Member

Comment 14 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)

Sign in to add a comment