Commit 5eaa43ce authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Add test for negative inline margin + fit-content

Also fixes a DCHECK that incorrectly hits.

Bug: 1028817
Change-Id: I43cb472031f4d3842eb302a5460e6dea047120e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1941451Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719890}
parent 9124544d
...@@ -1691,7 +1691,11 @@ void NGLineBreaker::HandleOverflow(NGLineInfo* line_info) { ...@@ -1691,7 +1691,11 @@ void NGLineBreaker::HandleOverflow(NGLineInfo* line_info) {
if (item.Type() == NGInlineItem::kText) { if (item.Type() == NGInlineItem::kText) {
DCHECK(item_result->shape_result || DCHECK(item_result->shape_result ||
(item_result->break_anywhere_if_overflow && (item_result->break_anywhere_if_overflow &&
!override_break_anywhere_)); !override_break_anywhere_) ||
// |HandleTextForFastMinContent| can produce an item without
// |ShapeResult|. In this case, it is not breakable.
(mode_ == NGLineBreakerMode::kMinContent &&
!item_result->may_break_inside));
// If space is available, and if this text is breakable, part of the text // If space is available, and if this text is breakable, part of the text
// may fit. Try to break this item. // may fit. Try to break this item.
if (width_to_rewind < 0 && item_result->may_break_inside) { if (width_to_rewind < 0 && item_result->may_break_inside) {
......
<!DOCTYPE html>
<title>CSS Test: Check inline negative margin with fit-content should not cause hang</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://crbug.com/1028817">
<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#inline-width">
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
<style>
div {
width: fit-content;
}
span {
margin-left: -15px;
}
</style>
<body>
<div>| <span>Operation</span></div>
<script>test(() => {});</script>
</body>
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