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

Issue 589347 link

Starred by 7 users

Issue metadata

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



Sign in to add a comment

getComputedStyle returns "auto" for left / right / top / bottom

Project Member Reported by timloh@chromium.org, Feb 24 2016

Issue description

(forked from  bug 229280 )

http://jsfiddle.net/xu5b7rLq/

<div id="target"></div>
<style> #target { position: absolute; } </style>
<script>
for (var side of 'top left right bottom'.split(' ')) {
  target.textContent += getComputedStyle(target)[side] + ' ';
}
</script>

Chrome 48 outputs: auto auto auto auto
Firefox 42 ouputs: 27px 8px 275px 669px


https://drafts.csswg.org/cssom/#resolved-values

If the property applies to a positioned element and the resolved value of the display property is not none, the resolved value is the used value. 
 
I have a fix for relatively positioned elements, which I think should work for sticky as well.  Still working on absolute and fixed position, which I believe will involve calling LayoutObject::containerForFixedPosition.  If anybody has any hints or tips, I'd be glad to hear them.
Commit is up for review:  https://codereview.chromium.org/1826423003/
Project Member

Comment 3 by bugdroid1@chromium.org, Apr 6 2016

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

commit 6a2ed97b65b691947eeffbf44ff48a8af2ddff3a
Author: khart <khart@codeaurora.org>
Date: Wed Apr 06 17:25:08 2016

getComputedStyle now returns used values for top, left, bottom, right

getComputedStyle now returns used values for the top, left, bottom, and
right properties of positioned elements, instead of returning computed
values, if the display property is not None.

R=mstensho@opera.com
BUG= 589347 

Review URL: https://codereview.chromium.org/1826423003

Cr-Commit-Position: refs/heads/master@{#385493}

[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/animations/animation-properties-in-keyframe-are-ignored-expected.txt
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/animations/animation-properties-in-keyframe-are-ignored.html
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/animations/change-keyframes.html
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/animations/play-state.html
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values.html
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/fast/css/hover-affects-child.html
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/abspos-dialog-layout-expected.txt
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/abspos-dialog-layout.html
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/fixpos-dialog-layout-expected.txt
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/fixpos-dialog-layout.html
[modify] https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Cc: msten...@opera.com wangxianzhu@chromium.org kh...@codeaurora.org
The CL caused  bug 602934 . Will revert first.
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 13 2016

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

commit f119da74988bf022c2dab4193ed289c988d51a26
Author: wangxianzhu <wangxianzhu@chromium.org>
Date: Wed Apr 13 19:34:11 2016

Revert of fix getComputedStyle positioned element values (patchset #4 id:60001 of https://codereview.chromium.org/1826423003/ )

Reason for revert:
Caused  crbug.com/602934 .

BUG= 602934 , 589347 

Original issue's description:
> getComputedStyle now returns used values for top, left, bottom, right
>
> getComputedStyle now returns used values for the top, left, bottom, and
> right properties of positioned elements, instead of returning computed
> values, if the display property is not None.
>
> R=mstensho@opera.com
> BUG= 589347 
>
> Committed: https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a
> Cr-Commit-Position: refs/heads/master@{#385493}

TBR=mstensho@opera.com,rune@opera.com,timloh@chromium.org,khart@codeaurora.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG= 589347 

Review URL: https://codereview.chromium.org/1888533002

Cr-Commit-Position: refs/heads/master@{#387068}

[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/animations/animation-properties-in-keyframe-are-ignored-expected.txt
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/animations/animation-properties-in-keyframe-are-ignored.html
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/animations/change-keyframes.html
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/animations/play-state.html
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values.html
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/fast/css/hover-affects-child.html
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/abspos-dialog-layout-expected.txt
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/abspos-dialog-layout.html
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/fixpos-dialog-layout-expected.txt
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/fixpos-dialog-layout.html
[modify] https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Project Member

Comment 6 by bugdroid1@chromium.org, Apr 14 2016

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

commit f3b023bb8511c3734d1207e9cf78c61f67826af0
Author: wangxianzhu <wangxianzhu@chromium.org>
Date: Thu Apr 14 05:57:00 2016

Reland of ix getComputedStyle positioned element values (patchset #2 id:250001 of https://codereview.chromium.org/1888533002/ )

Reason for revert:
The bug is actually caused by scripts depending on old 'auto' value.
Revert the bad revert. Sorry for the noise.

Original issue's description:
> Revert of fix getComputedStyle positioned element values (patchset #4 id:60001 of https://codereview.chromium.org/1826423003/ )
>
> Reason for revert:
> Caused  crbug.com/602934 .
>
> BUG= 602934 , 589347 
>
> Original issue's description:
> > getComputedStyle now returns used values for top, left, bottom, right
> >
> > getComputedStyle now returns used values for the top, left, bottom, and
> > right properties of positioned elements, instead of returning computed
> > values, if the display property is not None.
> >
> > R=mstensho@opera.com
> > BUG= 589347 
> >
> > Committed: https://crrev.com/6a2ed97b65b691947eeffbf44ff48a8af2ddff3a
> > Cr-Commit-Position: refs/heads/master@{#385493}
>
> TBR=mstensho@opera.com,rune@opera.com,timloh@chromium.org,khart@codeaurora.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG= 589347 
>
> Committed: https://crrev.com/f119da74988bf022c2dab4193ed289c988d51a26
> Cr-Commit-Position: refs/heads/master@{#387068}

TBR=mstensho@opera.com,rune@opera.com,timloh@chromium.org,khart@codeaurora.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 602934 , 589347 

Review URL: https://codereview.chromium.org/1890743002

Cr-Commit-Position: refs/heads/master@{#387246}

[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/animations/animation-properties-in-keyframe-are-ignored-expected.txt
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/animations/animation-properties-in-keyframe-are-ignored.html
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/animations/change-keyframes.html
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/animations/play-state.html
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values.html
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/fast/css/hover-affects-child.html
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/abspos-dialog-layout-expected.txt
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/abspos-dialog-layout.html
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/fixpos-dialog-layout-expected.txt
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/fixpos-dialog-layout.html
[modify] https://crrev.com/f3b023bb8511c3734d1207e9cf78c61f67826af0/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Status: Fixed (was: Available)
Sorry for the wrong revert which has been reverted. Thanks khart@ for fixing the bug.

Sign in to add a comment