Commit 4fb8e7be authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Ignore scrollbars in anonymous constraint spaces.

We already did ignore borders and padding, but forgot about scrollbars.

This was quite catastrophic for multicol, if a horizontal scrollbar was
actually taller than the columns. We'd end up pushing the scrollbar in front of
us (in block direction), column after column. Infinite loop (until OOM).

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I5c3038406ccf30eeb0e107b31c6bb783c7089ffd
Reviewed-on: https://chromium-review.googlesource.com/702299Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@opera.com>
Cr-Commit-Position: refs/heads/master@{#506844}
parent 2d9d8fa7
<!DOCTYPE html>
<div style="overflow:scroll; columns:2; column-fill:auto; height:1px;">
<div style="height:2px;"></div>
</div>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(() => { }, "PASS if no freeze, crash or assertion failure");
</script>
......@@ -534,6 +534,11 @@ NGBoxStrut CalculateBorderScrollbarPadding(
const NGConstraintSpace& constraint_space,
const ComputedStyle& style,
const NGBlockNode node) {
// If we are producing an anonymous fragment (e.g. a column), it has no
// borders, padding or scrollbars. Using the ones from the container can only
// cause trouble.
if (constraint_space.IsAnonymous())
return NGBoxStrut();
return ComputeBorders(constraint_space, style) +
ComputePadding(constraint_space, style) + node.GetScrollbarSizes();
}
......
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