Skip to content

Commit

Permalink
[line-clamp] Fix DCHECK failure with hidden block-in-inlines
Browse files Browse the repository at this point in the history
When painting a hidden-from-paint block-in-inline (which can happen if
the block-in-inline is after the clamp point in a line-clamp
container), there was a DCHECK failure since
`BoxFragmentPainter::PaintBoxItem` was not expected to be called on
hidden for paint items. This is because, in all other cases, this call
is skipped if the item is hidden, but that was not the case for block
in inlines. This patch fixes this by adding a condition before the
call in
`BoxFragmentPainter::PaintBoxDecorationBackgroundForBlockInInline`.

Bug: 40336192
Change-Id: I9a7a4acbb9e5e1cb42d27865665a5ce37d9bfa57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5987970
Commit-Queue: Andreu Botella <[email protected]>
Reviewed-by: Koji Ishii <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1379688}
  • Loading branch information
andreubotella authored and chromium-wpt-export-bot committed Nov 7, 2024
1 parent 0a05a70 commit 7d50b28
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
29 changes: 29 additions & 0 deletions css/css-overflow/line-clamp/line-clamp-030.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: line-clamp and block-in-inline</title>
<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
<link rel="match" href="reference/webkit-line-clamp-005-ref.html">
<meta name="assert" content="Lines within same-BFC block-in-inlines count for line clamping, and a line clamp can happen inside one. If there is an invisible line box between two block-in-inlines, that does not count.">
<style>
.clamp {
line-clamp: 4;
font: 16px / 32px serif;
background-color: yellow;
padding: 0 4px;
}
</style>
<div class="clamp">
<span>
Line 1
<div>
Line 2 <br>
Line 3
</div>
<div>
Line 4 <br>
Line 5
</div>
Line 6
</span>
</div>
33 changes: 33 additions & 0 deletions css/css-overflow/line-clamp/line-clamp-031.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: line-clamp and block-in-inline</title>
<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
<link rel="match" href="reference/webkit-line-clamp-005-ref.html">
<meta name="assert" content="Block-in-inlines after the clamp point should not be painted, whether they are same-BFC or not.">
<style>
.clamp {
line-clamp: 4;
font: 16px / 32px serif;
background-color: yellow;
padding: 0 4px;
}
.red {
height: 1.5lh;
background-color: red;
}
.ifc {
display: flow-root;
}
</style>
<div class="clamp">
<span>
Line 1 <br>
Line 2 <br>
Line 3 <br>
Line 4 <br>
Line 5
<div class="red"></div>
<div class="red ifc"></div>
</span>
</div>

0 comments on commit 7d50b28

Please sign in to comment.