Skip to content

Commit

Permalink
Fix line splitting in white-space: pre flows
Browse files Browse the repository at this point in the history
The newline position from one line was getting used repeatedly, causing extra
"phantom" newlines in the following lines.  Fixes #3413.
  • Loading branch information
mbrubeck committed Sep 18, 2014
1 parent 5e5f77a commit f35941d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/layout/inline.rs
Expand Up @@ -499,7 +499,7 @@ impl LineBreaker {
debug!("LineBreaker: Deferring the fragment to the inline_end of the new-line \
character to the line.");
let mut inline_end = split_fragment(inline_end);
inline_end.new_line_pos = in_fragment.new_line_pos.clone();
inline_end.new_line_pos.remove(0);
self.work_list.push_front(inline_end);
}
false
Expand Down
1 change: 1 addition & 0 deletions tests/ref/basic.list
Expand Up @@ -95,6 +95,7 @@ experimental == vertical-lr-blocks.html vertical-lr-blocks_ref.html
== table_auto_width.html table_auto_width_ref.html
== inline_whitespace_b.html inline_whitespace_ref.html
== inline_whitespace_a.html inline_whitespace_ref.html
== whitespace_pre.html whitespace_pre_ref.html
== line_height_a.html line_height_ref.html
== block_replaced_content_a.html block_replaced_content_ref.html
== block_replaced_content_b.html block_replaced_content_ref.html
Expand Down
16 changes: 16 additions & 0 deletions tests/ref/whitespace_pre.html
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>whitespace pre test</title>
<style>
div { white-space: pre; }
</style>
</head>
<body>

<div>a
b
c</div>

</body>
</html>
13 changes: 13 additions & 0 deletions tests/ref/whitespace_pre_ref.html
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>whitespace pre test</title>
</head>
<body>

<div>a</div>
<div>&nbsp;&nbsp;b</div>
<div>c</div>

</body>
</html>

0 comments on commit f35941d

Please sign in to comment.