From 765e1f2a36c3fc18ba1eb466f0071c7d06eb9926 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Fri, 24 Jan 2014 16:40:14 +0900 Subject: [PATCH] Fix white-space property(pre) If html has empty line, it is not handled currently. Because pending line is empty in such case, flushing current line doesn't care empty line. For example, below html has two empty line(line 2 and line 4)
test1 test2
To handle empty line, added empty box to pending line. --- src/components/main/layout/box_.rs | 4 +--- src/components/main/layout/inline.rs | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/components/main/layout/box_.rs b/src/components/main/layout/box_.rs index 1403fc9d39b..3203d90301b 100644 --- a/src/components/main/layout/box_.rs +++ b/src/components/main/layout/box_.rs @@ -1283,14 +1283,12 @@ impl Box { let right_range = Range::new(text_box_info.range.begin() + cur_new_line_pos + 1, text_box_info.range.length() - (cur_new_line_pos + 1)); // Left box is for left text of first founded new-line character. - let left_box = if left_range.length() > 0 { + let left_box = { let new_text_box_info = ScannedTextBoxInfo::new(text_box_info.run.clone(), left_range); let new_metrics = new_text_box_info.run.get().metrics_for_range(&left_range); let mut new_box = self.transform(new_metrics.bounding_box.size, ScannedTextBox(new_text_box_info)); new_box.new_line_pos = ~[]; Some(new_box) - } else { - None }; // Right box is for right text of first founded new-line character. diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs index b592d108449..839b6686dbb 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/main/layout/inline.rs @@ -327,10 +327,7 @@ impl LineboxScanner { (Some(left_box), None) => { self.push_box_to_line(left_box); } - (None, Some(right_box)) => { - self.work_list.push_front(right_box); - } - (None, None) => error!("LineboxScanner: This split case makes no sense!"), + _ => error!("LineboxScanner: This split case makes no sense!"), } } _ => {}