Fix: absolutely positioned block too wide in LegacyLayout

example:
<style type="text/css">
  div#green-overlapping-test
    {
      border-left: green solid 25px;
      border-right: green solid 75px;
      height: 100px;
      left: auto;
      position: absolute;
      right: auto;
      width: auto;
      writing-mode: horizontal-tb;
    }

     div#red-overlapped-reference
    {
      background-color: red;
      height: 100px;
      width: 100px;
    }

</style>
  <div id="green-overlapping-test"></div>
  <div id="red-overlapped-reference"></div>

cause:
Inside ng_block_layout_algorithm, we set initial inline length to
width of containing space.
inline_length comes from ResolveInlineLength.
As containing_space does not have ShrinkToFit flag, ResolveInlineLength defaults
to width of containing box.
I believe containing_space should have ShrinkToFit flag set.

This flag is set here:
 NGConstraintSpace::CreateFromLayoutObject
   .SetIsShrinkToFit(
          box.sizesLogicalWidthToFitContent(box.styleRef().logicalWidth()))

My guess is that sizesLogicalWidthToFitContent should return true for
out_of_flow blocks, but with old layout, one can never be sure.
I've ran the full LayoutTests suite, and it works with the patch.

BUG=635619

Review-Url: https://codereview.chromium.org/2673583005
Cr-Commit-Position: refs/heads/master@{#448123}
1 file changed