From f35941d91d37db583e3c39d9b371ecd4f7850512 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 18 Sep 2014 14:20:08 -0700 Subject: [PATCH] Fix line splitting in `white-space: pre` flows The newline position from one line was getting used repeatedly, causing extra "phantom" newlines in the following lines. Fixes #3413. --- components/layout/inline.rs | 2 +- tests/ref/basic.list | 1 + tests/ref/whitespace_pre.html | 16 ++++++++++++++++ tests/ref/whitespace_pre_ref.html | 13 +++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/ref/whitespace_pre.html create mode 100644 tests/ref/whitespace_pre_ref.html diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 8c86b8fae93..a888378bf19 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -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 diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 7d9a8631935..90193fbdf8b 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -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 diff --git a/tests/ref/whitespace_pre.html b/tests/ref/whitespace_pre.html new file mode 100644 index 00000000000..59420b9c5d3 --- /dev/null +++ b/tests/ref/whitespace_pre.html @@ -0,0 +1,16 @@ + + + + whitespace pre test + + + + +
a + b +c
+ + + diff --git a/tests/ref/whitespace_pre_ref.html b/tests/ref/whitespace_pre_ref.html new file mode 100644 index 00000000000..9f07533e6de --- /dev/null +++ b/tests/ref/whitespace_pre_ref.html @@ -0,0 +1,13 @@ + + + + whitespace pre test + + + +
a
+
  b
+
c
+ + +