Skip to content

Commit

Permalink
layout: Fix trailing collapsible space handling with <ruby>
Browse files Browse the repository at this point in the history
* Trailing collapsible space should not be handled in ruby-base lines
  because such lines are contained by another line.
  This CL introduces `LineBreaker::
  disable_trailing_whitespace_collapsing_`.

* ComputeTrailingCollapsibleSpace() should iterate inside ruby columns
  recursively.

* RemoveTrailingCollapsibleSpace() and TrailingCollapsibleSpaceWidth()
  should compute ruby column widths correctly.

* ruby-intra-level-whitespace-001.html passed accidentally. It requires
  <rb> and table-like pairing.

Bug: 376097115
Change-Id: I55e4559012ec08c9b423ad8a518890c02862d857
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5996911
Commit-Queue: Koji Ishii <[email protected]>
Auto-Submit: Kent Tamura <[email protected]>
Reviewed-by: Koji Ishii <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1379515}
  • Loading branch information
tkent-google authored and chromium-wpt-export-bot committed Nov 7, 2024
1 parent ad13530 commit 6ad1d8a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions css/css-ruby/collapse-trailing-whitespace-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
p {
font: 20px/1 Ahem;
width: 12em;
}
ruby { color: blue; }
rt { color: orange; }
</style>

<p>nihongo |&nbsp;<ruby>n<rt>n</ruby><br><ruby>hon<rt>hon</ruby><ruby>go&nbsp;<rt>go</ruby>|</p>
20 changes: 20 additions & 0 deletions css/css-ruby/collapse-trailing-whitespace.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
<link rel="help" href="https://crbug.com/376097115">
<link rel="stylesheet" href="/fonts/ahem.css">
<link rel="match" href="collapse-trailing-whitespace-ref.html"/>
<meta name="assert" content="A space after '|' should be preserved,
a space after 'n' should be collapsed,
and a space after 'go' should be preserved.">
<style>
p {
font: 20px/1 Ahem;
xtext-align: justify;
xtext-align-last: justify;
width: 12em;
}
ruby { color: blue; }
rt { color: orange; }
</style>

<p>nihongo | <ruby>n <rt>n</ruby><ruby>hon<rt>hon</ruby><ruby>go <rt>go</ruby>|</p>

0 comments on commit 6ad1d8a

Please sign in to comment.