Note: There are a few cases of duplicates in user autocompletion which are being worked on.

'direction' override for 'auto' margins on absolutely positioned elements happens when only one margin is auto

RESOLVED FIXED in mozilla5

Status

()

Core
Layout: R & A Pos
RESOLVED FIXED
10 years ago
a year ago

People

(Reporter: dbaron, Unassigned)

Tracking

(Blocks: 1 bug, {css2})

Trunk
mozilla5
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
In CSS 2.1 sections 10.3.7 and 10.3.8, 'direction' beats 'auto' margins only when both margins are 'auto'.  We implement this behavior when only one margin is 'auto'.  Safari 3 gets it right.  (Opera and IE don't; Opera 9.25 doesn't implement the direction-override at all; IE 7 doesn't implement auto margins.)

Steps to reproduce: load http://dbaron.org/css/test/2008/abs-pos-auto-margin

Expected results:
 1. direction:ltr, wide, margin-left:auto should overflow the yellow box to the right
 2. direction:rtl, wide, margin-right:auto should overflow the yellow box to the left

Actual results:
 1. it overflows to the left
 2. it overflows to the right

This should be a simple fix in nsHTMLReflowState::InitAbsoluteConstraints.
(Reporter)

Comment 1

10 years ago
I actually hard-coded the buggy behavior described in this bug into the reference renderings in layout/reftests/box-properties/abspos-non-replaced-width-offset-margin-ref.html and layout/reftests/box-properties/abspos-replaced-width-offset-margin-ref.html ; these should be fixed when we fix this bug.

Comment 2

8 years ago
Is this still a bug?
(Reporter)

Comment 3

8 years ago
The behavior described is still present; I haven't checked whether the spec has changed in the last 18 months.
(Reporter)

Updated

7 years ago
Blocks: 605520
(Reporter)

Comment 4

7 years ago
Created attachment 493143 [details] [diff] [review]
patch

This fixes the two tests mentioned above (which are also in the CSS 2.1 test suite, with no passing implementations, although every implementation I've checked fails differently).

I still need to (a) write tests for the vertical case (b) figure out whether that FIXME I added in the vertical case should result in a spec change or a code change.
Attachment #493143 - Flags: review?(roc)
Attachment #493143 - Flags: review?(roc) → review+
(Reporter)

Comment 5

7 years ago
https://hg.mozilla.org/projects/birch/rev/52512f6d14c9
Whiteboard: fixed-in-birch
(Reporter)

Comment 6

6 years ago
https://hg.mozilla.org/mozilla-central/rev/52512f6d14c9
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: fixed-in-birch
Target Milestone: --- → mozilla2.2

Comment 7

3 years ago
> I still need to (a) write tests for the vertical case (b) figure out whether that FIXME I
> added in the vertical case should result in a spec change or a code change.

Given that IE and Blink at least are following the spec, I'd say code change.  That's happening in bug 1100073.

Comment 8

a year ago
(In reply to David Baron [:dbaron] ⌚️UTC-7 (review requests must explain patch) from comment #4)
> This fixes the two tests mentioned above (which are also in the CSS 2.1 test
> suite, with no passing implementations, although every implementation I've
> checked fails differently).

http://test.csswg.org/suites/css2.1/nightly-unstable/html4/abspos-non-replaced-width-margin-000.htm

http://test.csswg.org/suites/css2.1/nightly-unstable/html4/reference/abspos-non-replaced-width-margin-000-ref.htm

Firefox 46 and Chrome 50 pass these 2 tests.
You need to log in before you can comment on or make changes to this bug.