Commit ee581481 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Ensure OOF is propagated when ellipsizing

This patch ensures OOF within truncated inline-blocks are
propagated when 'text-overflow: ellipsis'.

Bug: 945690
Change-Id: I856469cc76e083ad3be2e82cde8f571a9467478a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539483
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644683}
parent 29ef565b
...@@ -118,11 +118,21 @@ LayoutUnit NGLineTruncator::TruncateLine( ...@@ -118,11 +118,21 @@ LayoutUnit NGLineTruncator::TruncateLine(
void NGLineTruncator::HideChild(NGLineBoxFragmentBuilder::Child* child) { void NGLineTruncator::HideChild(NGLineBoxFragmentBuilder::Child* child) {
DCHECK(child->HasInFlowFragment()); DCHECK(child->HasInFlowFragment());
const NGPhysicalFragment* fragment = nullptr;
if (const NGLayoutResult* layout_result = child->layout_result.get()) {
// Need to propagate OOF descendants in this inline-block child.
if (!layout_result->OutOfFlowPositionedDescendants().IsEmpty()) {
return;
}
fragment = layout_result->PhysicalFragment();
} else {
fragment = child->fragment.get();
}
DCHECK(fragment);
// If this child has self painting layer, not producing fragments will not // If this child has self painting layer, not producing fragments will not
// suppress painting because layers are painted separately. Move it out of the // suppress painting because layers are painted separately. Move it out of the
// clipping area. // clipping area.
const NGPhysicalFragment* fragment = child->PhysicalFragment();
DCHECK(fragment);
if (fragment->HasSelfPaintingLayer()) { if (fragment->HasSelfPaintingLayer()) {
// |available_width_| may not be enough when the containing block has // |available_width_| may not be enough when the containing block has
// paddings, because clipping is at the content box but ellipsizing is at // paddings, because clipping is at the content box but ellipsizing is at
......
<!DOCTYPE html>
<title>Ellipsizing inline blocks that have absolute positioned objects should not crash</title>
<link rel="author" href="kojii@chromium.org">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=945690">
<meta name="assert" content="Ellipsizing inline blocks that have absolute positioned objects should not crash">
<style>
div {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 5ch;
}
.inline-block {
display: inline-block;
}
.abs {
position: absolute;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div>
12345678
<span class="inline-block">
<span class="abs">abs</span>
</span>
</div>
<div>
12345678
<span class="inline-block">
999
<span class="abs">abs</span>
</span>
</div>
<div>
12
<span class="inline-block">
3456789
<span class="abs">abs</span>
</span>
</div>
<script>
test(() => {}, 'No crash or DCHECK failure');
</script>
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