Last Comment Bug 419100 - 'direction' override for 'auto' margins on absolutely positioned elements happens when only one margin is auto
: 'direction' override for 'auto' margins on absolutely positioned elements hap...
Status: RESOLVED FIXED
: css2
Product: Core
Classification: Components
Component: Layout: R & A Pos (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: mozilla5
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
http://dbaron.org/css/test/2008/abs-p...
Depends on:
Blocks: css2.1-tests
  Show dependency treegraph
 
Reported: 2008-02-22 14:33 PST by David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch)
Modified: 2016-05-05 11:40 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (17.43 KB, patch)
2010-11-24 16:30 PST, David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch)
roc: review+
Details | Diff | Splinter Review

Description David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 2008-02-22 14:33:31 PST
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.
Comment 1 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 2008-02-22 14:38:20 PST
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 Anders G. Jørgensen 2009-08-04 10:59:39 PDT
Is this still a bug?
Comment 3 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 2009-08-04 11:40:24 PDT
The behavior described is still present; I haven't checked whether the spec has changed in the last 18 months.
Comment 4 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 2010-11-24 16:30:34 PST
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.
Comment 5 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 2011-03-03 19:05:23 PST
https://hg.mozilla.org/projects/birch/rev/52512f6d14c9
Comment 6 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 2011-03-23 13:44:59 PDT
https://hg.mozilla.org/mozilla-central/rev/52512f6d14c9
Comment 7 Boris Zbarsky [:bz] 2014-11-20 11:01:23 PST
> 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 Gérard Talbot 2016-05-05 11:40:13 PDT
(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.

Note You need to log in before you can comment on or make changes to this bug.