Skip to content

Commit

Permalink
[line-clamp] Make line-clamp create a new BFC
Browse files Browse the repository at this point in the history
Although `-webkit-line-clamp` has always created an independent
formatting context, our prototype implementation of `line-clamp`
initially made it so the `line-clamp` property (but not
`-webkit-line-clamp`) didn't necessarily create one.

However, in the course of implementing this proposal, the fact that it
did not necessarily create a new BFC raised issues, such as how nested
line-clamps should work, or how floats inside a line-clamp container
should affect floats outside it. These problems go away by having
line-clamp create a new BFC, and this CL takes that route.

This patch also removes
`BlockLineClampData::is_original_line_clamp_context`, which was needed
to be able to distinguish whether `(-webkit-)line-clamp` was specified
on the current block element, or whether it inherited its line clamp
data from its parent. With this change, checking if the current block
is a new BFC is enough.

Bug: 40336192
Change-Id: I8a16ec18ce1653caaf1c7d06280a2a7e4604a946
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5453431
Commit-Queue: Andreu Botella <abotella@igalia.com>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1287280}
  • Loading branch information
andreubotella authored and chromium-wpt-export-bot committed Apr 15, 2024
1 parent 947b3eb commit 85681c6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion css/css-overflow/line-clamp-with-floats-005.tentative.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: float in line-clamp before clamp point which overflows</title>
<title>CSS Overflow: float in line-clamp before clamp point which extends past it</title>
<link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
<link rel="match" href="reference/line-clamp-with-floats-005-ref.html">
Expand Down
2 changes: 1 addition & 1 deletion css/css-overflow/line-clamp-with-floats-006.tentative.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: float in line-clamp before clamp point which overflows</title>
<title>CSS Overflow: float in line-clamp before clamp point which extends past it</title>
<link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
<link rel="match" href="reference/line-clamp-with-floats-006-ref.html">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<title>CSS Reference</title>
<style>
.clamp {
display: flow-root;
font: 16px / 32px serif;
padding: 0 4px;
white-space: pre;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<title>CSS Reference</title>
<style>
.clamp {
display: flow-root;
font: 16px / 32px serif;
padding: 0 4px;
background-color: yellow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<title>CSS Reference</title>
<style>
.clamp {
display: flow-root;
font: 16px / 32px serif;
padding: 0 4px;
white-space: pre;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
border: 1px solid black;
}
.clamp {
display: flow-root;
padding: 0 4px;
white-space: pre;
background-color: yellow;
Expand Down

0 comments on commit 85681c6

Please sign in to comment.