Skip to content

Commit c748846

Browse files
Aleks Toticchromium-wpt-export-bot
authored andcommitted
[LayoutNG] Fix for DCHECK(NeedsLayout) for fixed
All tests pass, and crashes no longer happen. I believe that code will not longer crash, but there might be futher instances of incorrect positioning. Fix #1 LayoutDescendantCandidates did not sweep newly discovered candidates. This was done manually once inside NGOutOfFlowLayoutPart::Run, and sweep was not performed for LayoutDescendantCandidates found in Legacy. Fix is to make LayoutDescendantCandidates perform sweep instead. Fix #2 fix #1 exposed a bug where duplicate fragments were generated for a single layout object. This happened when NG was generating fragments not inside ContainingBlock. Fix one instance of this inside NGOutOfFlowLayoutPart::IsContainingBlockForDescendant by making sure that OOF with inline containers are only positioned inside its ContainingBlock() Fix #3 NGOutOfFlowLayoutPart::LayoutDescendant offset adjustment. Bug: 935805 Change-Id: I9f7ebbc7223f40fbbf6ba3739d9385bfd59e3641 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1517093 Commit-Queue: Aleks Totic <[email protected]> Reviewed-by: Morten Stenshorne <[email protected]> Reviewed-by: Koji Ishii <[email protected]> Cr-Commit-Position: refs/heads/master@{#641628}
1 parent dce324a commit c748846

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

css/css-position/position-absolute-crash-chrome-002.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<title>CSS Position Absolute: Chrome chrash</title>
2+
<title>CSS Position Absolute: Chrome crash</title>
33
<link rel="author" href="mailto:[email protected]">
44
<script src="/resources/testharness.js"></script>
55
<script src="/resources/testharnessreport.js"></script>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<title>CSS Position Absolute: Chrome crash</title>
3+
<link rel="author" href="mailto:[email protected]">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=935805">
7+
<meta name="assert" content="Nested abs/fixed/flex do not crash">
8+
<style>
9+
#flex {
10+
display: flex;
11+
}
12+
.abs {
13+
position: absolute;
14+
}
15+
#fixed {
16+
position: fixed;
17+
}
18+
</style>
19+
<div class="abs">
20+
<div id="flex">
21+
<div class="abs">
22+
<div id="fixed"></div>
23+
</div>
24+
</div>
25+
</div>
26+
<script>
27+
test(() => {
28+
}, 'test passes if it does not crash');
29+
</script>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Absolute inside inline container location should be correct</title>
5+
<link rel="author" href="mailto:[email protected]">
6+
<link rel="help" href="https://www.w3.org/TR/css-position-3/#def-cb">
7+
<script src="/resources/testharness.js"></script>
8+
<script src="/resources/testharnessreport.js"></script>
9+
</head>
10+
<!-- There should be a green square below -->
11+
<body style="margin:0">
12+
<span id="container" style="position:relative;">
13+
<div style="width:100px; height:100px; background:red;"></div>
14+
<div id="target" style="position:absolute; left:0; top:0; width:100px; height:100px; background:green;"></div>
15+
</span>
16+
<script>
17+
test(_ => {
18+
let bounds = document.querySelector("#target").getBoundingClientRect();
19+
let container_bounds = document.querySelector("#container").getBoundingClientRect();
20+
assert_equals(bounds.x, container_bounds.x);
21+
assert_equals(bounds.y, container_bounds.y);
22+
}, "absolute inside inline container location should be correct.");
23+
</script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)