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:
Patrick Walton 2015-03-30 14:09:37 -07:00
parent 88aa07b7e0
commit 6d61468160
12 changed files with 485 additions and 461 deletions

View file

@ -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: