-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[line-clamp] [RubyLB] Make sure ruby isn't visible in clamped lines
With RubyLB, in some cases ruby annotations would not be hidden even though the line containing them would be. This is because when a line is after the clamp point, the line box and its logical line items would be marked as hidden for paint, but in RubyLB the line's ruby annotations and their line items are stored in the logical ruby columns. This patch fixes this in `FragmentItemsBuilder::AddLine`, when `FragmentItem`s are created for a line's multiple annotations, by marking every item in the annotations as hidden for paint if the line's fragment is marked as such. Aside from adding a test for this issue, this patch also adds a test that the sizing of a clamped block box properly takes into account any ruby annotations that add leading to a line. This already worked as expected, presumably due to https://crrev.com/c/5683304 storing the `PreviousInflowPosition` at the clamp point, but the effect on ruby had not been tested in that CL. Bug: 40336192 Change-Id: I95fe796bb887d1d205dd43c2644095b6c6f225e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5695646 Reviewed-by: Kent Tamura <tkent@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Andreu Botella <abotella@igalia.com> Cr-Commit-Position: refs/heads/main@{#1326551}
- Loading branch information
1 parent
ce8be75
commit 56eea69
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Overflow: ruby annotations after the clamp point are not rendered</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-026-ref.html"> | ||
<meta name="assert" content="Ruby annotations are part of a line box's content, and therefore must not be rendered if the line box wouldn't be"> | ||
<style> | ||
.clamp { | ||
line-clamp: 3; | ||
|
||
font: 16px / 32px serif; | ||
white-space: pre-wrap; | ||
} | ||
.ruby-under ruby { | ||
ruby-position: under; | ||
} | ||
</style> | ||
<div class="clamp"><ruby>一<rt>いち</ruby><ruby>行<rt>ぎょう</ruby><ruby>目<rt>め</ruby> | ||
<span class="ruby-under"><ruby>ニ<rt>に</ruby><ruby>行<rt>ぎょう</ruby><ruby>目<rt>め</ruby></span> | ||
<ruby>三<rt><ruby>さん<rt>san</ruby></ruby><ruby>行<rt><ruby>ぎょう<rt>gyou</ruby></ruby><ruby>目<rt><ruby>め<rt>me</ruby></ruby> | ||
<ruby>四<rt>よん</ruby><ruby>行<rt>ぎょう</ruby><ruby>目<rt>め</ruby> | ||
<span class="ruby-under"><ruby>五<rt>ご</ruby><ruby>行<rt>ぎょう</ruby><ruby>目<rt>め</ruby></span> | ||
<ruby>六<rt><ruby>ろく<rt>roku</ruby></ruby><ruby>行<rt><ruby>ぎょう<rt>gyou</ruby></ruby><ruby>目<rt><ruby>め<rt>me</ruby></ruby></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Overflow: sizing of line-clamp elements with ruby annotations</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-027-ref.html"> | ||
<meta name="assert" content="The sizing of a line-clamp element should be exactly as if it had no content after clamp, even if there are ruby annotations involved."> | ||
<style> | ||
.clamp { | ||
line-clamp: 3; | ||
font-size: 16px / 16px serif; | ||
white-space: pre-wrap; | ||
background-color: yellow; | ||
} | ||
ruby.under { | ||
ruby-position: under; | ||
} | ||
.large { | ||
font-size: 3em; | ||
} | ||
</style> | ||
<div class="clamp">Line 1 | ||
Line 2 | ||
<ruby class="under">Line 3<rt>ruby</ruby> | ||
<ruby>Line 4<rt class="large">ruby</ruby> | ||
Line 5 | ||
<ruby class="under">Line 6<rt class="large">ruby</ruby></div> |
15 changes: 15 additions & 0 deletions
15
css/css-overflow/line-clamp/reference/line-clamp-026-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Reference</title> | ||
<style> | ||
.clamp { | ||
font: 16px / 32px serif; | ||
white-space: pre-wrap; | ||
} | ||
.ruby-under ruby { | ||
ruby-position: under; | ||
} | ||
</style> | ||
<div class="clamp"><ruby>一<rt>いち</ruby><ruby>行<rt>ぎょう</ruby><ruby>目<rt>め</ruby> | ||
<span class="ruby-under"><ruby>ニ<rt>に</ruby><ruby>行<rt>ぎょう</ruby><ruby>目<rt>め</ruby></span> | ||
<ruby>三<rt><ruby>さん<rt>san</ruby></ruby><ruby>行<rt><ruby>ぎょう<rt>gyou</ruby></ruby><ruby>目<rt><ruby>め<rt>me</ruby></ruby>…</div> |
16 changes: 16 additions & 0 deletions
16
css/css-overflow/line-clamp/reference/line-clamp-027-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Reference</title> | ||
<style> | ||
.clamp { | ||
font-size: 16px / 16px serif; | ||
white-space: pre-wrap; | ||
background-color: yellow; | ||
} | ||
ruby.under { | ||
ruby-position: under; | ||
} | ||
</style> | ||
<div class="clamp">Line 1 | ||
Line 2 | ||
<ruby class="under">Line 3<rt>ruby</ruby>…</div> |