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

Issue 601030 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

getComputedStyle on absolute position element with padding on parent returns incorrect measurement

Reported by desandro...@gmail.com, Apr 6 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36

Steps to reproduce the problem:
See http://codepen.io/desandro/pen/vGWMrV/

A container element is sized to 400px wide, with 10% horizontal padding. Its child item element is absolutely positioned in it, with 10% left.

What is the expected behavior?
getComputedStyle( item ).left should be 40px (400px * 10%)

What went wrong?
getComputedStyle( item ).left returns 20.5 px

Did this work before? No 

Chrome version: 49.0.2623.110  Channel: stable
OS Version: OS X 10.11.3
Flash Version: Shockwave Flash 21.0 r0

Firefox v45 correctly returns 40px
 

Comment 1 by kojii@chromium.org, Apr 7 2016

Components: -Blink Blink>CSS
Labels: -OS-Mac Hotlist-Interop OS-All
Status: Available (was: Unconfirmed)
I'd like to work on this issue.
Cc: deokjin8...@samsung.com
Owner: alancutter@chromium.org
Status: Started (was: Available)
Owned by deokjin81.kim@samsung.com but is not currently a project member and can't be assigned as owner in crbug.

Currently in progress: https://codereview.chromium.org/1876123002
Project Member

Comment 5 by bugdroid1@chromium.org, May 12 2016

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

commit 9908f45b70b65fc242e050d33c67294fe870a1cb
Author: deokjin81.kim <deokjin81.kim@samsung.com>
Date: Thu May 12 21:23:59 2016

Absolute positioned child with percent should include containing block padding

The padding box of the containing block is to be used for absolutely
positioned descendants. But this rule is not applied yet. This CL
fixes 2 issue.
1. getComputedStyle on absolute positioned child with percent-based
left has to use containing block which includes padding box.
2. Absolute positioned child with percent-based padding also has to
use containing block which includes padding box.

BUG= 601030 

Review-Url: https://codereview.chromium.org/1876123002
Cr-Commit-Position: refs/heads/master@{#393358}

[add] https://crrev.com/9908f45b70b65fc242e050d33c67294fe870a1cb/third_party/WebKit/LayoutTests/fast/css/absolute-child-with-percent-padding-inside-relative-parent-expected.html
[add] https://crrev.com/9908f45b70b65fc242e050d33c67294fe870a1cb/third_party/WebKit/LayoutTests/fast/css/absolute-child-with-percent-padding-inside-relative-parent.html
[add] https://crrev.com/9908f45b70b65fc242e050d33c67294fe870a1cb/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-absolute-child-with-percent-left-inside-relative-parent-expected.txt
[add] https://crrev.com/9908f45b70b65fc242e050d33c67294fe870a1cb/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-absolute-child-with-percent-left-inside-relative-parent.html
[modify] https://crrev.com/9908f45b70b65fc242e050d33c67294fe870a1cb/third_party/WebKit/Source/core/layout/LayoutBox.cpp
[modify] https://crrev.com/9908f45b70b65fc242e050d33c67294fe870a1cb/third_party/WebKit/Source/core/layout/LayoutTable.cpp

Status: Fixed (was: Started)

Sign in to add a comment