fune/testing/web-platform/tests/css/css-overflow/reference/webkit-line-clamp-008-ref.html
Emilio Cobos Álvarez 3c206e563a Bug 1786147 - Make -webkit-line-clamp create a block container in the appropriate situations. r=dholbert
This is a hack, sorta, similar to Chromium's:

  https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/layout/layout_object.cc;l=356;drc=312b74e385e6aba98ab31fd911238c0dc16b396c

except at computed-value rather than used-value time, because it's both
simpler to reason about and prevents lying in the computed style.

This fixes the relevant test-case, and matches closer what Chromium does,
by not creating anonymous flex items for all elements inside the
line-clamp context.

The behavior change is covered by the test changes. I had to also fix a
couple pre-existing bugs that were caught by tests, now that the
line-clamped block is the -webkit-box-styled element rather than an anonymous
flex item (and thus now had padding).

Depends on D155180

Differential Revision: https://phabricator.services.mozilla.com/D155181
2022-09-07 23:57:18 +00:00

18 lines
315 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reference</title>
<style>
.clamp {
display: block;
font: 16px / 32px serif;
white-space: pre;
padding: 0 4px;
background-color: yellow;
}
</style>
<div class="clamp"><div>Line 1
Line 2
Line 3</div><div>Line A
Line B
Line C</div>Line 一
Line 二…</div>