New issue
Advanced search Search tips

Issue 861553 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 13
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[LayoutNG] abspos static position when inline_container is descendant of NGContainerFragmentBuilder

Project Member Reported by atotic@chromium.org, Jul 7

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.

 
Is this about boxes are generated as expected but static position is offset incorrectly to the block flow direction?
No, boxes are not generated at all for position:absolute.
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?
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.


Summary: [LayoutNG] abspos static position is always relative to line box, but should be to inline container if one exists (was: [LayoutNG] abspos needs to always create necessary anonymous boxes inside inline layout)
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|.
Cc: kojii@chromium.org
Owner: atotic@chromium.org
Summary: [LayoutNG] abspos static position when inline_container is descendant of NGContainerFragmentBuilder (was: [LayoutNG] abspos static position is always relative to line box, but should be to inline container if one exists)
Updated the summary and owner as discussed on Hangout.
Status: Fixed (was: Assigned)

Sign in to add a comment