[LayoutNG] abspos static position when inline_container is descendant of NGContainerFragmentBuilder |
||||
Issue description
Failing tests are:
fast/css/abs-pos-child-inside-rel-pos-inline-001.html
fast/css/abs-pos-child-inside-rel-pos-inline-offset-001.html
Abbreviated test case. #abs-pos is positioned too far to the right.
<div id="wrapper">
<span>X</span>
<div id="rel-pos-inline" style="display:inline">
<div id="abs-pos">
</div>
</div>
</div>
The problem is static position in ng_inline_layout_algorithm
- #rel-pos-inline is positioned to the right of "X"
- #abs-pos is added as InlineOutOfFlowChildCandidate to #rel-pos-inline at child_offset(0, 100), which places it to the right and below "X"
What is supposed to happen:
- This is a complex case where abspos is supposed to generate anonymous fragments that would have been there if it was position:static.
Here is the fragment tree if #abs-pos was position:static:
Box (block-flow)(self paint) offset:unplaced size:785x216 LayoutNGBlockFlow HTML
Box (block-flow) LayoutNGBlockFlow BODY
Box (block-flow) LayoutNGBlockFlow DIV id='wrapper'
Box (block-flow children-inline) LayoutNGBlockFlow (anonymous)
LineBox offset:0,0 size:100x100 InkOverflow: 0,0 100x200
Box (inline children-inline) LayoutInline SPAN
Text offset:0,0 size:100x100 start: 0 end: 1
Box (inline children-inline) LayoutInline (relative positioned) DIV id='rel-pos-inline'
Box (block-flow) LayoutNGBlockFlow (anonymous) (relative positioned)
Box (block-flow children-inline) LayoutNGBlockFlow DIV id='abs-pos'
Box (block-flow children-inline) LayoutNGBlockFlow (anonymous)
LineBox offset:0,0 size:0x0
Here is what it looks like if #abs-pos is position:absolute
Box (block-flow) LayoutNGBlockFlow HTML
Box (block-flow) LayoutNGBlockFlow BODY
Box (block-flow children-inline) LayoutNGBlockFlow DIV id='wrapper'
LineBox offset:0,0 size:100x100 InkOverflow: 0,0 100x200
Box (inline children-inline) LayoutInline SPAN
Text offset:0,0 size:100x100 start: 0 end: 1
Box (inline children-inline) LayoutInline (relative positioned) DIV id='rel-pos-inline'
Box (out-of-flow-positioned block-flow children-inline) LayoutNGBlockFlow (positioned) DIV id='abs-pos'
I think we need to generate all the anyonymous boxes in order to position #abs-pos properly.
You are already doing something unusual here, because #abs-pos offset is 0, 100.
This looks like we are trying to pretend #abs-pos is on the next line. This would work, except that inline location wrt linebox to be needs to be 0.
,
Jul 9
No, boxes are not generated at all for position:absolute.
,
Jul 10
For #abs-pos? Isn't it oof algorithm to generate boxes for this? Inline layout algorithm is responsible for #rel-pos-inline, but not for #abs-pos, no? What did I miss?
,
Jul 10
I get confused about this too, sorry for not being clearer. This is about static position. NGContainerFragmentBuilder::AddInlineOutOfFlowChildCandidate( NGBlockNode, const NGLogicalOffset& child_line_offset, TextDirection line_direction, LayoutObject* inline_container); expects child_line_offset to be static position wrt container. In our example, if we keep fragment tree as is, container would be #rel-pos-inline, and child_line_offset should be (-100, 100). In current code, child_line_offset is (0, 100). Could your code figure out that #abs-pos needs to be at the beginning of next line? (-100, 100). The other option is to recreate anonymous blocks. Then static position would be simpler to compute. If this is not clear, feel free to ping me on hangouts.
,
Jul 11
Oh, I see, so the problem is the static position is always relative to the line box, but you want it to be relative to the inline containing block if one exist? That makes sense then, I remember I intentionally made it relative to the line box because we're adding it to the line box builder. I'll see if I can change it relative to |inline_container|.
,
Jul 11
Updated the summary and owner as discussed on Hangout.
,
Jul 13
|
||||
►
Sign in to add a comment |
||||
Comment 1 by kojii@chromium.org
, Jul 9