Skip to content

Commit

Permalink
Fix white-space property(pre)
Browse files Browse the repository at this point in the history
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)
<div>
test1

test2

</div>

To handle empty line, added empty box to pending line.
  • Loading branch information
deokjinkim committed Jan 28, 2014
1 parent 78e0545 commit 765e1f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/components/main/layout/box_.rs
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions src/components/main/layout/inline.rs
Expand Up @@ -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!"),
}
}
_ => {}
Expand Down

5 comments on commit 765e1f2

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from metajack
at deokjinkim@765e1f2

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging deokjinkim/servo/fix_white_space = 765e1f2 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deokjinkim/servo/fix_white_space = 765e1f2 merged ok, testing candidate = d47df08

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = d47df08

Please sign in to comment.