Bug 1560928 [wpt PR 17428] - [LayoutNG] Fix |ComputeMinMaxSize| not to clear |NeedsLayout|, a=testonly

Automatic update from web-platform-tests
[LayoutNG] Fix |ComputeMinMaxSize| not to clear |NeedsLayout|

This patch fixes |ComputeMinMaxSize| not to clear |NeedsLayout|
when all of following conditions are met:
1. Needs |MinMaxSize|
2. Is an orthogonal flow root.
3. Is legacy layout.
4. Change is applied that dirties the layout.

In this case, |NGBlockNode::ComputeMinMaxSize()| calls
|Layout()|, which goes to |RunLegacyLayout()|, which calls
|LayoutObject::LayoutIfNeeded()|. However, its constraint
space is intermediate that it does not update
|CachedLayoutResult|.

Then when laying it out, because |NeedsLayout()| is cleared,
existing out-of-date |CachedLayoutResult| is used.

This patch fixes:
1. Not to pre-layout orthogonal roots if it has
   |CachedLayoutResult|.
2. Set |NeedsLayout()| if |RunLegacyLayout()| clears it, but
   |CachedLayoutResult| was not updated.

Bug: 976859
Change-Id: Ic2d979a3c4f9479040bfd0e54cf4283b60ed52b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1670146
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671460}

--

wpt-commits: 47b08c15495e05fa73e243736742851109198af1
wpt-pr: 17428
This commit is contained in:
Koji Ishii 2019-07-19 12:39:23 +00:00 коммит произвёл James Graham
Родитель de3dc8b626
Коммит 4d0e2fd4d6
1 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,30 @@
<!DOCTYPE html>
<title>CSS Test: Check computing min-/max-content does not cause crash</title>
<link rel="help" href="https://crbug.com/976859">
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#sizing-values">
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
width: fit-content;
}
#target {
display: block;
writing-mode: vertical-lr;
columns: 2;
}
.after #target {
float: left;
}
</style>
<body>
<div id="target"></div>
<script>
test(() => {
const body = document.body;
body.offsetTop;
body.classList.add("after");
});
</script>
</body>