New issue
Advanced search Search tips

Issue 728460 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

ViewportAPI: window.view.width doesn't apply browser zoom to scrollbar

Project Member Reported by bokan@chromium.org, Jun 1 2017

Issue description

Chrome Version: 61.0.3116.0
OS: 61.0.3116.0

What steps will reproduce the problem?
(0) Enable chrome://flags/#enable-experimental-web-platform-features
(1) Open a page with scrollbars
e.g. data:text/html;charset=utf8,<style>body {height: 5000px;}</style>
(2) Read window.view.width in DevTools
(3) Browser Zoom (ctrl +) to 200%
(4) Read window.view.width again

What is the expected result?
The value of width after zooming should be exactly half of the value before zooming.

What happens instead?
The value isn't exactly half (the exact numbers will vary based on window width.

It seems we don't apply browser zoom when subtracting the scrollbar thickness from the width (this applies to height too).


 

Comment 1 Deleted

Comment 2 by bokan@chromium.org, Jun 1 2017

OS: Should be ALL above

Note, for custom scrollbars, since they increase in size with browser zoom, the width should not be halved. URL to test custom scrollbars:

data:text/html;charset=utf8,<style>body {height: 5000px;} ::-webkit-scrollbar { width: 20px; height: 20px;} ::-webkit-scrollbar-track { background-color: #b46868; } ::-webkit-scrollbar-thumb{ background-color: rgba(0, 0, 0, 0.2); }</style>
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/09a769b10b54536d1b4ba1c68c288f0f87203c12

commit 09a769b10b54536d1b4ba1c68c288f0f87203c12
Author: David Bokan <bokan@chromium.org>
Date: Thu Jun 01 15:50:36 2017

[ViewportAPI] Correctly apply browser-zoom to view.width|height

The view.width and view.height return the viewport width and height
*excluding* any classic scrollbars. These values are in CSS pixels. The
current implementation of these functions would subtract out the
scrollbar thickness but failed to apply browser-zoom to the scrollbar
(it does correctly apply pinch-zoom though). This patch scales the
subtracted thickness by the browser-zoom factor.

Bug:  728460 
Change-Id: I35a3a033ac2909e4191da12cad173ace492f4218
Reviewed-on: https://chromium-review.googlesource.com/520666
Reviewed-by: David Tapuska <dtapuska@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#476299}
[modify] https://crrev.com/09a769b10b54536d1b4ba1c68c288f0f87203c12/third_party/WebKit/LayoutTests/fast/dom/viewport/viewport-dimensions-exclude-custom-scrollbars.html
[modify] https://crrev.com/09a769b10b54536d1b4ba1c68c288f0f87203c12/third_party/WebKit/LayoutTests/fast/dom/viewport/viewport-dimensions-exclude-scrollbars.html
[modify] https://crrev.com/09a769b10b54536d1b4ba1c68c288f0f87203c12/third_party/WebKit/Source/core/frame/VisualViewport.cpp

Comment 4 by bokan@chromium.org, Jun 1 2017

Status: Fixed (was: Started)

Sign in to add a comment