Commit bd3f3079 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Fix max-content size when floats are outside of content box

This patch fixes max-content size when the line has floats
outside of its content box.

In such case, ComputeContentSize computes a negative value
for |floats_inline_size|. Such |floats_inline_size| should
not affect max-content size.

Bug: 636993
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ie3076c1a135a8bf00a264f7275abb19ef1392864
Reviewed-on: https://chromium-review.googlesource.com/1113094Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570350}
parent 00446508
...@@ -417,7 +417,6 @@ crbug.com/591099 fast/css/getComputedStyle/computed-style-percentage-top-with-po ...@@ -417,7 +417,6 @@ crbug.com/591099 fast/css/getComputedStyle/computed-style-percentage-top-with-po
crbug.com/591099 fast/css/getComputedStyle/getComputedStyle-margin-auto.html [ Failure ] crbug.com/591099 fast/css/getComputedStyle/getComputedStyle-margin-auto.html [ Failure ]
crbug.com/591099 fast/css/getComputedStyle/getComputedStyle-margin-percentage.html [ Failure ] crbug.com/591099 fast/css/getComputedStyle/getComputedStyle-margin-percentage.html [ Failure ]
crbug.com/591099 fast/css/import_with_baseurl.html [ Failure ] crbug.com/591099 fast/css/import_with_baseurl.html [ Failure ]
crbug.com/591099 fast/css/negative-text-indent-in-inline-block.html [ Failure ]
crbug.com/591099 fast/css/opacity-float.html [ Pass ] crbug.com/591099 fast/css/opacity-float.html [ Pass ]
crbug.com/591099 fast/css/outline-narrowLine.html [ Failure ] crbug.com/591099 fast/css/outline-narrowLine.html [ Failure ]
crbug.com/591099 fast/css/text-overflow-ellipsis-vertical-hittest.html [ Failure ] crbug.com/591099 fast/css/text-overflow-ellipsis-vertical-hittest.html [ Failure ]
......
...@@ -266,10 +266,16 @@ base::Optional<MinMaxSize> NGBlockLayoutAlgorithm::ComputeMinMaxSize( ...@@ -266,10 +266,16 @@ base::Optional<MinMaxSize> NGBlockLayoutAlgorithm::ComputeMinMaxSize(
// A float adds to its inline size to the current "line". The new max // A float adds to its inline size to the current "line". The new max
// inline contribution is just the sum of all the floats on that "line". // inline contribution is just the sum of all the floats on that "line".
LayoutUnit float_inline_size = child_sizes.max_size + margins.InlineSum(); LayoutUnit float_inline_size = child_sizes.max_size + margins.InlineSum();
if (child_style.Floating() == EFloat::kLeft)
float_left_inline_size += float_inline_size; // float_inline_size is negative when the float is completely outside of
else // the content area, by e.g., negative margins. Such floats do not affect
float_right_inline_size += float_inline_size; // the content size.
if (float_inline_size > 0) {
if (child_style.Floating() == EFloat::kLeft)
float_left_inline_size += float_inline_size;
else
float_right_inline_size += float_inline_size;
}
max_inline_contribution = max_inline_contribution =
float_left_inline_size + float_right_inline_size; float_left_inline_size + float_right_inline_size;
......
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