New issue
Advanced search Search tips

Issue 608142 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: May 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Mac
Pri: 2
Type: Bug



Sign in to add a comment

page zoom rounding error offsetHeight/Width properties

Reported by seddon.r...@gmail.com, Apr 30 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Firefox/45.0

Steps to reproduce the problem:
1. Set browser zoom to >=125%
2. Measure #modernizr element on https://codepen.io/anon/pen/QNZeyW and it returns 6px instead of 7px

What is the expected behavior?
To return 7px no matter what zoom level is set

What went wrong?
offsetHeight returns 6px

Did this work before? N/A 

Chrome version: Version 50.0.2661.94 (64-bit)  Channel: stable
OS Version: OS X 10.9.5
Flash Version: Shockwave Flash 21.0 r0

See https://bugs.chromium.org/p/chromium/issues/detail?id=447902 same issue but for scrollHeight.
 
zoom.png
273 KB View Download
Components: -UI Blink>PageZoom
Labels: OS-Linux
Status: Untriaged (was: Unconfirmed)
Confirmed on Linux and Mac. I am getting 6px on zoom levels 110 and 125 and 7px on others. Chrome version - 50.0.2661.86

Comment 3 by cdr...@gmail.com, May 18 2016

On jsbin:

http://jsbin.com/rebulon

Same as codepen, but also logs to screen on resize. And you don't need to create an account on codepen to see output (grrr).

Here is the link to the originating Modernizr issue: https://github.com/Modernizr/Modernizr/issues/1935

Comment 4 by tkent@chromium.org, May 23 2016

Components: -Blink>PageZoom Blink>Layout

Comment 5 by e...@chromium.org, May 23 2016

Status: WontFix (was: Untriaged)
offsetHeight and offsetWidth returns the snapped height and width respectively and as such will change by up to a pixel depending on the zoom level as the element will need to be rounded (or snapped) to the nearest device pixel.

For stable measurements use getBoundingClientRect instead.

Seems not even getBoundingClientRect gives a stable value of what I would expect at different zoom levels.
Screen Shot 2016-05-28 at 3.13.14 pm.png
26.9 KB View Download

Sign in to add a comment