absolutely positioned child of relative inline positioned relative to only first line of inline

NEW
Unassigned

Status

()

defect
10 years ago
2 months ago

People

(Reporter: rn214, Unassigned)

Tracking

(Depends on 1 bug, Blocks 3 bugs)

Trunk
Points:
---
Dependency tree / graph
Bug Flags:
blocking1.9.2 -
wanted1.9.2 -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

Reporter

Description

10 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.8) Gecko/2009033117 Mandriva/1.9.0.8-0.1mdv2009.0 (2009.0) Firefox/3.0.8
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.8) Gecko/2009033117 Mandriva/1.9.0.8-0.1mdv2009.0 (2009.0) Firefox/3.0.8

The child element of an inline div is misplaced. It is actually positioned with respect to the top line of that div, rather than the bottom. Both Opera and Konqueror behave differently, so this is probably a genuine bug.

Reproducible: Always

Steps to Reproduce:
Look at the following HTML. (I'll attach screenshots shortly)


<h2>Firefox</h2>
BEFORE
	<div style="position:relative; display:inline; background-color:#0F0">
    		This is an inline div.<br>Here is the second line<br>And a third line<br>And now a fourth and final line
    		<div style="position:absolute; left: 0; bottom: 0; display:inline; background-color:#F00">
    			x
  		</div>
  	</div>
AFTER
Actual Results:  
The red 'x' is positioned at the TOP of the parent div. It should be placed at the bottom.

Both Firefox 3.5 and Firefox 3.6a1 (today's nightly) show the same behaviour. But Opera and Konqueror show different behaviour.

Expected Results:  
The inner div has "bottom: 0", therefore the bottom of the 'x' should be aligned with the bottom of the parent div.
Reporter

Comment 1

10 years ago
Here is a tarball of 3 png files, showing the rendering in Firefox, Konqueror (3.5) and Opera (9.64) respectively.

The HTML source of all of them is exactly the same (excepting that I changed the <h2> to show the correct name)
Component: General → Layout: Block and Inline
Product: Firefox → Core
QA Contact: general → layout.block-and-inline
Version: unspecified → Trunk
dupe of bug 5016, I think
Reporter

Comment 3

10 years ago
I think you're probably right. 10 years, and half-a-million bugs later ;-)

Any chance of a fix? Web designers now tend to regard Firefox as the de-facto implementation of the standards, and test here first.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 5016
Reopening per bug 5016 comment 32.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Posted file testcase
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a1pre) Gecko/20090202 Minefield/3.2a1pre

Confirmed.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: wanted1.9.2?
Flags: blocking1.9.2?
OS: Linux → All
Hardware: x86_64 → All
Summary: Child of inline div is positioned incorrectly. → absolutely positioned child of relative inline positioned relative to only first line of inline
There is an explanation of what needs to be done to fix this starting from bug 5016 comment 17.
Flags: wanted1.9.2?
Flags: wanted1.9.2-
Flags: blocking1.9.2?
Flags: blocking1.9.2-
We should also figure out what the spec says about bidi issues:  see http://lists.w3.org/Archives/Public/www-style/2011Jan/0538.html

Comment 10

6 years ago
Issue 215
Summary
    Make it undefined what containing block is formed by a relpos inline that splits across multiple lines
 URI
    http://test.csswg.org/suites/css2.1/20110111/html4/containing-block-032.htm
(which was removed from /latest/ and /nightly/ :
http://test.csswg.org/suites/css2.1/latest/html4/containing-block-032.htm
http://test.csswg.org/suites/css2.1/nightly/html4/containing-block-032.htm
)
Resolution
    Make undefined.
Status
    Closed.
http://wiki.csswg.org/spec/css2.1#issue-215

"
If the element has 'position: absolute', the containing block is established by the nearest ancestor with a 'position' of 'absolute', 'relative' or 'fixed', in the following way:

    In the case that the ancestor is an inline element, the containing block is the bounding box around the padding boxes of the first and the last inline boxes generated for that element. In CSS 2.1, if the inline element is split across multiple lines, **_the containing block is undefined_**. 
"
CSS2.1, §10.1 Definition of "containing block"
http://www.w3.org/TR/CSS21/visudet.html#containing-block-details

So, I'd say this bug is not valid for CSS 2.1.


CSS3 is a bit different:

"
If the element has ‘position: absolute’, the containing block is established by the nearest ancestor with a ‘position’ other than ‘static’, in the following way:

    In the case that the ancestor is inline-level, the containing block depends on the ‘direction’ property of the ancestor:
        If the ‘direction’ is ‘ltr’, the top and left of the containing block are the top and left content edges of the first box generated by the ancestor, and the bottom and right are the bottom and right content edges of the last box of the ancestor. 
"
CSS Positioned Layout Module Level 3, Working Draft 7 February 2012
§3.1. Definition of containing block
http://www.w3.org/TR/css3-positioning/#def-containing-blocks

as it now refers to content edges (and not padding edges) and it does not specify what happens if the positioned ancestor inline box is split in multiple line boxes.

Comment 11

5 years ago
Is there any push at all to implement this? It's inconsistent with all major browsers causing me quite a few headaches. It's been half a year since this was last discussed which is quite alarming.

Comment 12

4 years ago
Still experiencing this bug, and can confirm it is still inconsistent with Chrome and IE implementation.
Duplicate of this bug: 1133525

Comment 14

3 years ago
Firefox 49.0.2 fails this test:

http://www.gtalbot.org/BrowserBugsSection/css21testsuite/containing-block-017-GT.html

as far as CSS2.1 and CSS2.2 are involved.

Note that there is only 1 line box in such test. Opera 12.16 (Presto engine), Chrome 54.0.2840.90, Chrome 56.0.2902.0, IE11 and Edge pass this test.

- - - - - - -

If the positioned ancestor is an inline element split across multiple lines, then Firefox complies with CSS2.x since, in such case, "the containing block is undefined". And all the tests we had with such multiple lines have been removed from CSS2.1 test suite.

- - - - - - -

(In reply to matt from comment #11)
> Is there any push at all to implement this? It's inconsistent with all major
> browsers 

(In reply to tdmalone from comment #12)
> Still experiencing this bug, and can confirm it is still inconsistent with
> Chrome and IE implementation.

Chrome (all versions), IE11 and Edge (all versions) do not comply with CSS3 (and never did) when the positioned ancestor is an inline element *_split across multiple lines_*. Only Opera 12.16 (Presto engine) complies, otherwise passes the tests we have.


Regarding CSS Positioned Layout Module Level 3, section 3.1. Definition of containing block

https://www.w3.org/TR/css-position-3/#def-cb

there will be a CSSWG discussion this month to decide on a proposed modification of CSS3.

More info:  https://github.com/w3c/csswg-drafts/issues/609
https://github.com/w3c/csswg-drafts/issues/609 proposes changes to the spec here, although probably only a minor adjustment to what we need to do to fix this.
In today's teleconference the CSS WG accepted the proposal in https://github.com/w3c/csswg-drafts/issues/609#issuecomment-259058527
Component: Layout: Block and Inline → Layout: R & A Pos
Duplicate of this bug: 1408069
Just poking through quickly now, but there may be more information on this in bug 5016 and bug 255139.
Duplicate of this bug: 1451269
Duplicate of this bug: 1527265

Updated

4 months ago
Blocks: 1533151
See Also: → 255139
See Also: → 1544146
See Also: 1544146
You need to log in before you can comment on or make changes to this bug.