mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Add support for white-space-collapse: break-spaces
(#32388)
This change adds support for `white-space-collapse: break-spaces` and adds initial parsing support for `overflow-wrap` and `word-break`. The later two properties are not fully supported, only in their interaction with `break-spaces`. This is a preliminary change preparing to implement them. In addition, `break_and_shape` is now forked and added to Layout 2020. This function is going to change a lot soon and forking is preparation for this. More code that is only used by Layout 2013 is moved from `gfx` to that crate. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
This commit is contained in:
parent
c0dedf06d6
commit
60b4b6c9f0
96 changed files with 410 additions and 537 deletions
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::sync::Arc;
|
||||
use std::vec::Vec;
|
||||
use std::{fmt, mem, u16};
|
||||
|
||||
|
@ -773,3 +774,24 @@ impl<'a> Iterator for GlyphIterator<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A single series of glyphs within a text run.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct GlyphRun {
|
||||
/// The glyphs.
|
||||
pub glyph_store: Arc<GlyphStore>,
|
||||
/// The byte range of characters in the containing run.
|
||||
pub range: Range<ByteIndex>,
|
||||
}
|
||||
|
||||
impl GlyphRun {
|
||||
pub fn compare(&self, key: &ByteIndex) -> Ordering {
|
||||
if *key < self.range.begin() {
|
||||
Ordering::Greater
|
||||
} else if *key >= self.range.end() {
|
||||
Ordering::Less
|
||||
} else {
|
||||
Ordering::Equal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue