add RenderBox::is_whitespace()

This commit is contained in:
Brian J. Burg 2012-10-13 18:14:12 -07:00
parent d1c6e186bf
commit b5c05307e0

View file

@ -101,6 +101,7 @@ trait RenderBoxMethods {
pure fn is_replaced() -> bool; pure fn is_replaced() -> bool;
pure fn can_split() -> bool; pure fn can_split() -> bool;
pure fn is_whitespace_only() -> bool;
pure fn can_merge_with_box(@self, other: @RenderBox) -> bool; pure fn can_merge_with_box(@self, other: @RenderBox) -> bool;
pure fn requires_inline_spacers() -> bool; pure fn requires_inline_spacers() -> bool;
pure fn content_box() -> Rect<au>; pure fn content_box() -> Rect<au>;
@ -149,6 +150,13 @@ impl RenderBox : RenderBoxMethods {
} }
} }
pure fn is_whitespace_only() -> bool {
match self {
UnscannedTextBox(_, raw_text) => raw_text.is_whitespace(),
_ => false
}
}
pure fn can_merge_with_box(@self, other: @RenderBox) -> bool { pure fn can_merge_with_box(@self, other: @RenderBox) -> bool {
assert !core::box::ptr_eq(self, other); assert !core::box::ptr_eq(self, other);