mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
layout: Add initial support for text-transform
(#31396)
This adds basic support for `text-transform` in a way that is more complete than legacy layout. There are still many missing elements of proper `text-transform` support such as: 1. Support for `full-width` and `full-size-kana` 2. Support for grapheme based uppercasing, lowercasing, and capitalization. These are all done per-code point right now. 3. Support for the language-specific `SpecialCasing.txt` cases for case mapping such as the ones for Irish and Turkish. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
This commit is contained in:
parent
f60e5e767b
commit
d8b326528b
105 changed files with 181 additions and 292 deletions
|
@ -1578,6 +1578,9 @@ impl InlineFormattingContext {
|
|||
// > (It is invisible, but retains its soft wrap opportunity, if any.)
|
||||
let mut last_inline_box_ended_with_white_space = false;
|
||||
|
||||
// For the purposes of `text-transform: capitalize` the start of the IFC is a word boundary.
|
||||
let mut on_word_boundary = true;
|
||||
|
||||
crate::context::with_thread_local_font_context(layout_context, |font_context| {
|
||||
let mut linebreaker = None;
|
||||
self.foreach(|iter_item| match iter_item {
|
||||
|
@ -1589,6 +1592,7 @@ impl InlineFormattingContext {
|
|||
&mut linebreaker,
|
||||
&mut ifc_fonts,
|
||||
&mut last_inline_box_ended_with_white_space,
|
||||
&mut on_word_boundary,
|
||||
);
|
||||
},
|
||||
InlineFormattingContextIterItem::Item(InlineLevelBox::InlineBox(inline_box)) => {
|
||||
|
@ -1601,6 +1605,7 @@ impl InlineFormattingContext {
|
|||
},
|
||||
InlineFormattingContextIterItem::Item(InlineLevelBox::Atomic(_)) => {
|
||||
last_inline_box_ended_with_white_space = false;
|
||||
on_word_boundary = true;
|
||||
},
|
||||
_ => {},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue