Commit 5d16b8a5 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Need to lay out legacy objects to figure out their inline size.

NG cannot always calculate the correct size of objects that are laid out
by the legacy engine, so just lay them out if we need to know their
size.

The computed CSS width on a table may not end up as its used value, for
instance.

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: Iaa327ad21055d6c1af96241b5403193c8b4b5ba3
Reviewed-on: https://chromium-review.googlesource.com/937261Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539201}
parent 4d6b3a06
...@@ -948,7 +948,6 @@ crbug.com/714962 external/wpt/css/css-display/display-contents-dynamic-multicol- ...@@ -948,7 +948,6 @@ crbug.com/714962 external/wpt/css/css-display/display-contents-dynamic-multicol-
crbug.com/714962 external/wpt/css/css-display/display-contents-dynamic-multicol-001-none.html [ Failure ] crbug.com/714962 external/wpt/css/css-display/display-contents-dynamic-multicol-001-none.html [ Failure ]
crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-table-001-inline.html [ Failure ] crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-table-001-inline.html [ Failure ]
crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-table-002-inline.html [ Pass ] crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-table-002-inline.html [ Pass ]
crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-table-002-none.html [ Crash ]
crbug.com/591099 external/wpt/css/css-display/display-contents-fieldset-nested-legend.html [ Pass ] crbug.com/591099 external/wpt/css/css-display/display-contents-fieldset-nested-legend.html [ Pass ]
crbug.com/591099 external/wpt/css/css-display/display-contents-list-001.html [ Failure ] crbug.com/591099 external/wpt/css/css-display/display-contents-list-001.html [ Failure ]
crbug.com/714962 external/wpt/css/css-display/display-contents-multicol-001.html [ Failure ] crbug.com/714962 external/wpt/css/css-display/display-contents-multicol-001.html [ Failure ]
...@@ -2155,7 +2154,6 @@ crbug.com/591099 fast/block/block-width-recalc-with-relative-height.html [ Failu ...@@ -2155,7 +2154,6 @@ crbug.com/591099 fast/block/block-width-recalc-with-relative-height.html [ Failu
crbug.com/591099 fast/block/float-avoids-padding-inline-ancestors.html [ Crash ] crbug.com/591099 fast/block/float-avoids-padding-inline-ancestors.html [ Crash ]
crbug.com/810335 fast/block/float/003.html [ Failure ] crbug.com/810335 fast/block/float/003.html [ Failure ]
crbug.com/591099 fast/block/float/element-clears-float-without-clearance.html [ Failure ] crbug.com/591099 fast/block/float/element-clears-float-without-clearance.html [ Failure ]
crbug.com/591099 fast/block/float/float-avoidance.html [ Failure ]
crbug.com/591099 fast/block/float/float-in-float-hit-testing.html [ Failure ] crbug.com/591099 fast/block/float/float-in-float-hit-testing.html [ Failure ]
crbug.com/591099 fast/block/float/float-in-float-painting.html [ Failure ] crbug.com/591099 fast/block/float/float-in-float-painting.html [ Failure ]
crbug.com/591099 fast/block/float/floats-offset-image-strict-line-height.html [ Failure ] crbug.com/591099 fast/block/float/floats-offset-image-strict-line-height.html [ Failure ]
...@@ -5381,7 +5379,6 @@ crbug.com/591099 tables/mozilla_expected_failures/bugs/bug1010.html [ Failure ] ...@@ -5381,7 +5379,6 @@ crbug.com/591099 tables/mozilla_expected_failures/bugs/bug1010.html [ Failure ]
crbug.com/714962 tables/mozilla_expected_failures/bugs/bug1055-2.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug1055-2.html [ Failure ]
crbug.com/714962 tables/mozilla_expected_failures/bugs/bug1128.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug1128.html [ Failure ]
crbug.com/714962 tables/mozilla_expected_failures/bugs/bug14007-1.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug14007-1.html [ Failure ]
crbug.com/591099 tables/mozilla_expected_failures/bugs/bug14489.html [ Failure ]
crbug.com/714962 tables/mozilla_expected_failures/bugs/bug21518.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug21518.html [ Failure ]
crbug.com/714962 tables/mozilla_expected_failures/bugs/bug22122.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug22122.html [ Failure ]
crbug.com/714962 tables/mozilla_expected_failures/bugs/bug2479-5.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug2479-5.html [ Failure ]
......
...@@ -316,7 +316,6 @@ crbug.com/635619 virtual/layout_ng/fast/block/float/element-clears-float-without ...@@ -316,7 +316,6 @@ crbug.com/635619 virtual/layout_ng/fast/block/float/element-clears-float-without
crbug.com/635619 virtual/layout_ng/fast/block/float/float-at-start-of-clean-lines-that-are-subsequently-dirtied-vertical-rl.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/float-at-start-of-clean-lines-that-are-subsequently-dirtied-vertical-rl.html [ Failure ]
crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/float/floats-and-text-indent.html [ Failure ] crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/float/floats-and-text-indent.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/float-at-start-of-clean-lines-that-are-subsequently-dirtied.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/float-at-start-of-clean-lines-that-are-subsequently-dirtied.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/float-avoidance.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/float-in-float-hit-testing.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/float-in-float-hit-testing.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/float-in-float-painting.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/float-in-float-painting.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/float-inserted-into-clean-line.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/float-inserted-into-clean-line.html [ Failure ]
......
<!DOCTYPE html>
<title>Floated table that becomes wider than its specified width, due to wide contents</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#float-width" title="10.3.5 Floating, non-replaced elements">
<link rel="help" href="https://www.w3.org/TR/CSS22/tables.html#auto-table-layout" title="17.5.2.2 Automatic table layout">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width:200px; height:200px; background:red;">
<div style="width:300px;">
<div style="float:left; width:200px; height:100px; margin-right:10px; background:green;"></div>
<div style="float:left; display:table; width:50px; height:10px; background:green;">
<div style="width:200px; height:100px;"></div>
</div>
</div>
</div>
...@@ -143,8 +143,11 @@ LayoutUnit ComputeInlineSizeForUnpositionedFloat( ...@@ -143,8 +143,11 @@ LayoutUnit ComputeInlineSizeForUnpositionedFloat(
// If the float has the same writing mode as the block formatting context we // If the float has the same writing mode as the block formatting context we
// shouldn't perform a full layout just yet. Our position may determine where // shouldn't perform a full layout just yet. Our position may determine where
// we fragment. // we fragment. If we cannot use NG for layout of the node, though, we do have
if (is_same_writing_mode) { // to lay out (and just read out the inline size and then discard the result),
// because NG cannot figure out the size of such objects on its own,
// especially not for tables.
if (is_same_writing_mode && unpositioned_float->node.CanUseNewLayout()) {
WTF::Optional<MinMaxSize> min_max_size; WTF::Optional<MinMaxSize> min_max_size;
if (NeedMinMaxSize(*space.get(), style)) { if (NeedMinMaxSize(*space.get(), style)) {
MinMaxSizeInput zero_input; // Floats do not intrude into floats. MinMaxSizeInput zero_input; // Floats do not intrude into floats.
...@@ -153,18 +156,22 @@ LayoutUnit ComputeInlineSizeForUnpositionedFloat( ...@@ -153,18 +156,22 @@ LayoutUnit ComputeInlineSizeForUnpositionedFloat(
return ComputeInlineSizeForFragment(*space.get(), style, min_max_size); return ComputeInlineSizeForFragment(*space.get(), style, min_max_size);
} }
// If we are performing layout on a float to determine its inline size it
// should never have fragmented.
DCHECK(!unpositioned_float->token);
// A float which has a different writing mode can't fragment, and we // A float which has a different writing mode can't fragment, and we
// (probably) need to perform a full layout in order to correctly determine // (probably) need to perform a full layout in order to correctly determine
// its inline size. We are able to cache this result on the // its inline size. We are able to cache this result on the unpositioned_float
// unpositioned_float at this stage. // at this stage. If the writing mode is the same, on the other hand, we
unpositioned_float->layout_result = unpositioned_float->node.Layout(*space); // cannot keep the result around, since the node may fragment (and we need to
// find its final block position before we can do so).
auto result = unpositioned_float->node.Layout(*space);
if (!is_same_writing_mode) {
// If we are performing layout on a float to determine its inline size it
// should never have fragmented.
DCHECK(!unpositioned_float->token);
unpositioned_float->layout_result = result;
}
DCHECK(unpositioned_float->layout_result->PhysicalFragment()); DCHECK(result->PhysicalFragment());
const auto& fragment = *unpositioned_float->layout_result->PhysicalFragment(); const auto& fragment = *result->PhysicalFragment();
DCHECK(fragment.BreakToken()->IsFinished()); DCHECK(fragment.BreakToken()->IsFinished());
......
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