Closed Bug 943558 Opened 11 years ago Closed 11 years ago

getComputedStyle returns incorrect right & bottom properties in absolutely positioned, static sized element with defined left & top properties

Categories

(Core :: CSS Parsing and Computation, defect)

25 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: darsain, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36

Steps to reproduce:

Set all position properties (left, right, top, bottom) on an element that is absolutely positioned, and with a static size (either via width & height, or max-width & max-height).

Replicated here: http://jsfiddle.net/LnazR/


Actual results:

getComputedStyle computes right & bottom properties as the distance from the nearest relative edge instead of a length defined in CSS.


Expected results:

right & bottom properties from getComputedStyle should match the length defined in CSS.

Chrome & IE both return the values defined in CSS, making this behavior - if nothing else - inconsistent with the rest of the browsers.
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
See the equation in 10.3.7 and the text below:
http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width
"If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value."

When you specify all of left/right/width you're creating an over-constrained situation
that cannot be solved.  So we ignore the specified 'right' value and replace it with
a value that satisfies the equation, that is, so that it sums up to the width of the
containing block.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Indeed.  Further, the spec at http://dev.w3.org/csswg/cssom/#resolved-value says that the resolved value for these properties is the used value in this case, so the Chrome and IE behaviors are definitely wrong.  Please do report their bugs to them?
You need to log in before you can comment on or make changes to this bug.