mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Simplify and improve the correctness of whitespace stripping in
text layout, and unify the inline layout paths for pre- and normally-formatted text. This fixes a lot of "jumpiness" and removes the `new_line_pos` stuff. Closes #2260.
This commit is contained in:
parent
88aa07b7e0
commit
6d61468160
12 changed files with 485 additions and 461 deletions
|
@ -39,7 +39,12 @@ pub fn null_str_as_empty_ref<'a>(s: &'a Option<DOMString>) -> &'a str {
|
|||
const WHITESPACE: &'static [char] = &[' ', '\t', '\x0a', '\x0c', '\x0d'];
|
||||
|
||||
pub fn is_whitespace(s: &str) -> bool {
|
||||
s.chars().all(|c| WHITESPACE.contains(&c))
|
||||
s.chars().all(char_is_whitespace)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn char_is_whitespace(c: char) -> bool {
|
||||
WHITESPACE.contains(&c)
|
||||
}
|
||||
|
||||
/// A "space character" according to:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue