[LayoutNG] Static position for empty boxes |
||||
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
,
Dec 6 2017
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.
,
Dec 6 2017
,
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
,
May 8 2018
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.
,
May 8 2018
Nice!
,
May 9 2018
Thanks! |
||||
►
Sign in to add a comment |
||||
Comment 1 by kojii@chromium.org
, Dec 4 2017