Skip to content

Commit

Permalink
Add initial support for css-text-3 whitespace handling (#29828)
Browse files Browse the repository at this point in the history
* Add initial support for css-text-3 whitespace handling

This adds initial support for whitespace handling from the CSS
specification for Layout 2020. In general, the basics are covered. Since
test output is very sensitive to whitespace handling, this change
incorporates several fixes:

1. Whitespace is collapsed according to the Phase 1 rules of the
   specification, though language-specific unbreaking rules are not
   handled properly yet.
2. Whitespace is mostly trimmed and positioned according to the Phase 2
   rules, but full support for removing whitespace at the end of lines
   is pending on a temporary data structure to hold lines under
   construction.
3. Completely empty box fragments left over immediately after line
   breaks are now trimmed from the fragment tree.
4. This change tries to detect when an inline formatting context
   collapses through.

Fixes #29994.

Co-authored-by: Mukilan Thiyagarajan <me@mukilan.in>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>

* Update test results

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <me@mukilan.in>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
  • Loading branch information
3 people committed Jul 20, 2023
1 parent 59b0b1b commit 4d7eecc
Show file tree
Hide file tree
Showing 129 changed files with 628 additions and 496 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/layout_2020/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ style = { path = "../style", features = ["servo"] }
style_traits = { path = "../style_traits" }
unicode-script = { workspace = true }
webrender_api = { workspace = true }
xi-unicode = { workspace = true }

[dev-dependencies]
lazy_static = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions components/layout_2020/flexbox/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ where
base_fragment_info: (&run.info).into(),
text: run.text.into(),
parent_style: run.info.style,
has_uncollapsible_content: false,
}),
self.text_decoration_line,
),
Expand Down

0 comments on commit 4d7eecc

Please sign in to comment.