Commit b452b17c authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Don't let negative margin + adjacent float miss a layout opportunity.

If a negative margin pulls a new formatting context block child back up
to where there is an adjacent float, but the block is too wide to fit
there beside it, make sure that we don't get pushed further down than
just below the bottom edge of the float. Simply ignoring the top margin
on the child might take us too far down.

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I22de7205518dd3c08d56e4ca8d07e4ae062508fc
Reviewed-on: https://chromium-review.googlesource.com/937503Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539193}
parent e99041f9
...@@ -2169,7 +2169,6 @@ crbug.com/810370 fast/block/float/overhanging-float-remove-from-fixed-position-b ...@@ -2169,7 +2169,6 @@ crbug.com/810370 fast/block/float/overhanging-float-remove-from-fixed-position-b
crbug.com/591099 fast/block/float/overlapping-floats-paint-hittest-order-1.html [ Failure ] crbug.com/591099 fast/block/float/overlapping-floats-paint-hittest-order-1.html [ Failure ]
crbug.com/591099 fast/block/line-layout/floats-do-not-fit-on-line.html [ Failure ] crbug.com/591099 fast/block/line-layout/floats-do-not-fit-on-line.html [ Failure ]
crbug.com/591099 fast/block/line-layout/line-break-removal-near-textarea-crash.html [ Failure ] crbug.com/591099 fast/block/line-layout/line-break-removal-near-textarea-crash.html [ Failure ]
crbug.com/591099 fast/block/margin-collapse/clear-nested-float-more-than-one-previous-sibling-away.html [ Failure ]
crbug.com/591099 fast/block/margin-collapse/webkit-margin-collapse-container.html [ Failure ] crbug.com/591099 fast/block/margin-collapse/webkit-margin-collapse-container.html [ Failure ]
crbug.com/591099 fast/block/margin-collapse/webkit-margin-collapse-separate-position.html [ Failure ] crbug.com/591099 fast/block/margin-collapse/webkit-margin-collapse-separate-position.html [ Failure ]
crbug.com/591099 fast/block/margin-collapse/webkit-margin-collapse-siblings.html [ Failure ] crbug.com/591099 fast/block/margin-collapse/webkit-margin-collapse-siblings.html [ Failure ]
......
...@@ -343,7 +343,6 @@ crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/float/width-update-after-c ...@@ -343,7 +343,6 @@ crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/float/width-update-after-c
crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/margin-collapse/103.html [ Failure ] crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/margin-collapse/103.html [ Failure ]
### virtual/layout_ng/fast/block/margin-collapse ### virtual/layout_ng/fast/block/margin-collapse
crbug.com/635619 virtual/layout_ng/fast/block/margin-collapse/clear-nested-float-more-than-one-previous-sibling-away.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/margin-collapse/webkit-margin-collapse-container.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/margin-collapse/webkit-margin-collapse-container.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/margin-collapse/webkit-margin-collapse-separate-position.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/margin-collapse/webkit-margin-collapse-separate-position.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/margin-collapse/webkit-margin-collapse-siblings.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/margin-collapse/webkit-margin-collapse-siblings.html [ Failure ]
......
...@@ -671,6 +671,12 @@ bool NGBlockLayoutAlgorithm::HandleNewFormattingContext( ...@@ -671,6 +671,12 @@ bool NGBlockLayoutAlgorithm::HandleNewFormattingContext(
child_bfc_offset_estimate = child_data.bfc_offset_estimate.block_offset + child_bfc_offset_estimate = child_data.bfc_offset_estimate.block_offset +
non_adjoining_margin_strut.Sum(); non_adjoining_margin_strut.Sum();
// Make sure that we don't move below the previously found layout
// opportunity. This could otherwise happen if the child has negative
// margins.
child_bfc_offset_estimate = std::min(
child_bfc_offset_estimate, opportunity.rect.start_offset.block_offset);
std::tie(layout_result, opportunity) = LayoutNewFormattingContext( std::tie(layout_result, opportunity) = LayoutNewFormattingContext(
child, child_break_token, child_data, child_bfc_offset_estimate, child, child_break_token, child_data, child_bfc_offset_estimate,
/* abort_if_cleared */ false); /* abort_if_cleared */ false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment