New issue
Advanced search Search tips

Issue 776803 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Absolute position element reports different offsetWidth values based on left value

Reported by kwea...@tpctraining.com, Oct 20 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
1. View the fiddle: https://fiddle.jshell.net/n93pz3ve/4/
2. Click the two buttons to adjust the div's left value between 100px and 100.5px
3. Notice that the offsetWidth of the div will change from 115 to 114.

What is the expected behavior?
An element with a width and height of an exact em value should always report the same offsetWidth value, regardless of positioning.

What went wrong?
This seems to occur in some situations where the following conditions exist:
1. Element has a non-integer font-size (has decimal value)
2. Element has an em width.
3. Element is position:absolute and switches between an integer and non-integer left value.

On a strange side note, the issue was not occurring when using position:relative. Have not done extensive testing on that, though.

Did this work before? Yes 20

Does this work in other browsers? Yes

Chrome version: 61.0.3163.100  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 27.0 r0

This also occurred in Safari version 6.2 to 8. Every other version and every other browser I tested could not replicate the issue.

Is it even worth mentioning the regression when it was over 40 versions ago?
 
Components: Blink>Layout
Labels: -Type-Bug-Regression M-64 Needs-Milestone OS-Linux OS-Mac Type-Bug
Status: Untriaged (was: Unconfirmed)
Able to reproduce this issue on Mac 10.12.6, Win-10 and Ubuntu 14.04 using chrome stable version #62.0.3202.62 and latest canary #63.0.3226.0.
This is a non-regression issue as it is observed from M50 old builds. 

Hence, marking it as untriaged to get more inputs from dev team.

Thanks...!!

Comment 2 by e...@chromium.org, Oct 30 2017

Status: WontFix (was: Untriaged)
This is by design, offsetWidth (and height) return pixel-grid aligned values which are dependent on the left (and top) position. See https://trac.webkit.org/wiki/LayoutUnit for details.

For the full precision, position agnostic size use getBoundingClientRect().width instead.

Comment 3 by phistuck@gmail.com, Oct 30 2017

#2 - but if Chrome is the only browser that behaves this way now, perhaps it is worth a reconsideration?

Sign in to add a comment