getBoundingClientRect values way off if element has a scaled child
Reported by
monfera....@gmail.com,
Mar 7 2016
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36 Steps to reproduce the problem: 1. Create a div (parent) 2. Put a div underneath it with inline CSS transform: scale(6,1) 3. Compare parent.getBoundingClientRect().width with parent.offsetWidth What is the expected behavior? I'd expect parent.getBoundingClientRect().width to be around parent.offsetWidth, sans rounding and maybe some other small differences What went wrong? parent.getBoundingClientRect().width reports 25.35 when offsetWidth is 160 (correct range). Cause appears to be the presence of CSS scaling on child element. Number is around 1/6.32 times what it should be. Did this work before? N/A Chrome version: 48.0.2564.116 Channel: stable OS Version: OS X 10.11.3 Flash Version: Shockwave Flash 20.0 r0 See the screenshot. Most values suggest around 160 pixels width for the selected DIV, but its getBoundingClientRect().width erroneously reports 25.35. The factor of difference is incredibly close to the X scaling value on the child element.
,
Mar 9 2016
Removing OS=Mac, since this does not look Mac-specific. Still needs triage, moving to Blink>Layout for triage.
,
Mar 19 2016
getBoundingClientRect takes transforms into account, offsetWidth does not. This is intentional and as per spec. |
|||
►
Sign in to add a comment |
|||
Comment 1 by monfera....@gmail.com
, Mar 7 2016