Closed Bug 743599 Opened 13 years ago Closed 2 years ago

absolutely positioned element at start of relatively-positioned inline doesn't wrap to next line with the first word of that inline

Categories

(Core :: Layout: Positioned, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 489100

People

(Reporter: impressive.webs, Unassigned)

References

(Depends on 2 open bugs)

Details

Attachments

(1 file)

When absolutely positioning a pseudo-element inside of an inline element that starts a new line, the pseudo-element is incorrectly positioned at the end of the previous line.

This happens inside a flow of inline text, where the inline element (such as an anchor or span) resides.

This seems to be an undesired behavior because all other modern browsers (latest Chrome, Opera, IE10 PP2) position the pseudo-element differently from Firefox 11.

Here is a JSBin that demonstrates this:

http://jsbin.com/ucokah/edit#html,live

Hover over the link to see the pseudo-element.
Attached file reporter's testcase
(JSBin really doesn't count as a simplified testcase)
The line-break is happening inside the <a>, not before it (in terms of our resulting box tree).  You can see this pretty clearly if you put a 1px left border on the <a>.

So the containing block for the abspos element ends up being the empty inline box before the line-break (see bug 489100).

That seems to be all that's going on here; in particular, this is not related to pseudo-elements in any way; a normal child element would do the same thing.

I don't know offhand whether other browsers put the linebreak in a different place or whether they don't suffer from bug 489100.
Component: Layout: Block and Inline → Layout: R & A Pos
Depends on: 489100
QA Contact: layout.block-and-inline → layout.r-and-a-pos
Latest stable Chrome and Safari put the left border on the new line, and the child element is positioned as desired. IE10 PP2 is the same.

Latest stable Opera, however, will work as originally expected with no border, but when you add the border, it behaves the same way as Firefox.

In my opinion, it seems nonsensical for the content to be on a new line while the left border is on the previous line. This doesn't happen if I throw a "br" tag in before the parent element, so why should it happen if the line break is automatically inserted?

But hey, what do I know? :)
The linebreak behavior is a bit silly, imo, yes.  The issue is that we start the parent element, then discover the kid won't fit and break before the non-fitting kid... but part of the parent did fit, so stays on the previous line.  I agree that checking for empty boxes there and not creating them would be nice; that's what Opera seems to be doing based on your description.
(Related to, but not duplicate of, bug 389587.)
Well, fixing that would fix this bug too, yes.
Depends on: 389587
Summary: Pseudo-element inside inline element not positioned correctly → auto-positioned absolutely positioned element at start of inline doesn't wrap to next line with the first word of that inline
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 7 → All
Hardware: x86_64 → All
Version: 11 Branch → unspecified
Blocks: 489207
Summary: auto-positioned absolutely positioned element at start of inline doesn't wrap to next line with the first word of that inline → absolutely positioned element at start of relatively-positioned inline doesn't wrap to next line with the first word of that inline
Severity: normal → S3

This is a version of the same thing discussed in bug 489100, which is being hashed out in the CSSWG right now.

Status: NEW → RESOLVED
Closed: 2 years ago
Duplicate of bug: 489100
Resolution: --- → DUPLICATE
See Also: 629059
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: