New issue
Advanced search Search tips

Issue 791531 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task

Blocking:
issue 591099
issue 636993



Sign in to add a comment

[LayoutNG] Static position for empty boxes

Project Member Reported by kojii@chromium.org, Dec 4 2017

Issue description

From atotic@'s test case, I'm filing this issue because this needs 3 different expertise; inline, abspos, and margin collapsing.

With this CSS:
.rel { position: relative; }
.abs { position: absolute; }

The following HTML:

  <div><span class="rel"><span class="abs"></span></div>

is a "certain zero-height line boxes" that allows margin collapsing[1]. For LayoutNG, this means that BFC offset is not resolved for this <div>, but it needs a static position. Also, getBoundingClientRect() must return something for the <span class="rel">.

Test: the first 4 are empty line boxes, the last 2 are non-empty.
http://jsbin.com/kilibix/edit?html,output

Options:
A. Make this line box not empty. Easiest for the current architecture, but no browsers do this.
B. Give (0, 0) for the static position. Gecko does this.
C. Give the top of the next BFC offset. Blink/Edge/WebKit do this.

C looks most reasonable, but this looks like a challenge to our BFC/margin collapsing code.

Ian, any idea how to do this, or do we prefer other options?

[1] https://drafts.csswg.org/css2/box.html#x28
 

Comment 1 by kojii@chromium.org, Dec 4 2017

Blocking: 636993

Comment 2 by kojii@chromium.org, Dec 6 2017

Summary: [LayoutNG] Static position for empty boxes (was: [LayoutNG] Static position for empty line boxes)
Turned out that this isn't only about inline, but also empty block boxes.

  <div class="rel"><div class="abs"></div></div>
  <p>a</p>

The outer div does not prevent collapsing, but still gives the static position of the next element (<p>).

All 4 browsers implement this, and there is at least one test in our LayoutTests.

Comment 3 by kojii@chromium.org, Dec 6 2017

Blocking: 591099

Comment 4 by kojii@chromium.org, Dec 21 2017

Affected tests so far we have confirmed are:

fast/inline/absolute-positioned-inline-in-centred-block.html
fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html
The two test cases in #4 now pass, and the initial JSBin example looks correct too. My guess is that this bug has been fixed.

Comment 6 by e...@chromium.org, May 8 2018

Status: Fixed (was: Available)
Nice! 

Comment 7 by kojii@chromium.org, May 9 2018

Thanks!

Sign in to add a comment