mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Add a InlineFormattingContextBuilder
(#32415)
The main change here is that collapsed and `text-transform`'d text is computed as it's processed by DOM traversal. This single transformed text is stored in the root of the `InlineFormattingContext`. This will eventually allow performing linebreaking and shaping of the entire inline formatting context at once. Allowing for intelligent processing of linebreaking and also shaping across elements. This matches more closely what LayoutNG does. This shouldn't have any (or negligable) behavioral changes, but will allow us to prevent linebreaking inside of clusters in a followup change. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
This commit is contained in:
parent
00b77ce73c
commit
48ab8d8847
12 changed files with 964 additions and 805 deletions
|
@ -440,7 +440,14 @@ pub struct GlyphStore {
|
|||
|
||||
/// Used to check if fast path should be used in glyph iteration.
|
||||
has_detailed_glyphs: bool,
|
||||
|
||||
/// Whether or not this glyph store contains only glyphs for whitespace.
|
||||
is_whitespace: bool,
|
||||
|
||||
/// Whether or not this glyph store contains only a single glyph for a single
|
||||
/// preserved newline.
|
||||
is_single_preserved_newline: bool,
|
||||
|
||||
is_rtl: bool,
|
||||
}
|
||||
|
||||
|
@ -448,7 +455,12 @@ impl<'a> GlyphStore {
|
|||
/// Initializes the glyph store, but doesn't actually shape anything.
|
||||
///
|
||||
/// Use the `add_*` methods to store glyph data.
|
||||
pub fn new(length: usize, is_whitespace: bool, is_rtl: bool) -> GlyphStore {
|
||||
pub fn new(
|
||||
length: usize,
|
||||
is_whitespace: bool,
|
||||
is_single_preserved_newline: bool,
|
||||
is_rtl: bool,
|
||||
) -> GlyphStore {
|
||||
assert!(length > 0);
|
||||
|
||||
GlyphStore {
|
||||
|
@ -458,6 +470,7 @@ impl<'a> GlyphStore {
|
|||
total_word_separators: 0,
|
||||
has_detailed_glyphs: false,
|
||||
is_whitespace,
|
||||
is_single_preserved_newline,
|
||||
is_rtl,
|
||||
}
|
||||
}
|
||||
|
@ -794,4 +807,9 @@ impl GlyphRun {
|
|||
Ordering::Equal
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_single_preserved_newline(&self) -> bool {
|
||||
self.glyph_store.is_single_preserved_newline
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue