From dd27ec1fa2557f4172972e60a995903fa7ffa215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 1 Oct 2017 21:24:23 +0200 Subject: [PATCH 1/2] layout_thread: perform_post_main_layout_passes is always called with a root flow. --- components/layout_thread/lib.rs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 76146989fc1f..0b9eb75b8f4d 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -1596,6 +1596,7 @@ impl LayoutThread { }); self.perform_post_main_layout_passes(data, + root_flow, reflow_goal, document, rw_data, @@ -1604,30 +1605,30 @@ impl LayoutThread { fn perform_post_main_layout_passes(&self, data: &Reflow, + mut root_flow: &mut FlowRef, reflow_goal: &ReflowGoal, document: Option<&ServoLayoutDocument>, rw_data: &mut LayoutThreadData, layout_context: &mut LayoutContext) { // Build the display list if necessary, and send it to the painter. - if let Some(mut root_flow) = self.root_flow.borrow().clone() { - self.compute_abs_pos_and_build_display_list(data, - reflow_goal, - document, - FlowRef::deref_mut(&mut root_flow), - &mut *layout_context, - rw_data); - self.first_reflow.set(false); - - if opts::get().trace_layout { - layout_debug::end_trace(self.generation.get()); - } + self.compute_abs_pos_and_build_display_list(data, + reflow_goal, + document, + FlowRef::deref_mut(&mut root_flow), + &mut *layout_context, + rw_data); - if opts::get().dump_flow_tree { - root_flow.print("Post layout flow tree".to_owned()); - } + self.first_reflow.set(false); - self.generation.set(self.generation.get() + 1); + if opts::get().trace_layout { + layout_debug::end_trace(self.generation.get()); } + + if opts::get().dump_flow_tree { + root_flow.print("Post layout flow tree".to_owned()); + } + + self.generation.set(self.generation.get() + 1); } fn reflow_all_nodes(flow: &mut Flow) { From 8976b1aeab5c4b868b083c2cf6abd0f183aaeacc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 1 Oct 2017 21:21:35 +0200 Subject: [PATCH 2/2] layout_thread: Avoid adding the UA sheets multiple times when there's no root flow. Fixes #18631 --- components/layout_thread/lib.rs | 3 +-- tests/wpt/mozilla/meta/MANIFEST.json | 10 ++++++++++ .../tests/mozilla/first-reflow-sheet-assert.html | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/wpt/mozilla/tests/mozilla/first-reflow-sheet-assert.html diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 0b9eb75b8f4d..1bfcf112c451 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -1318,6 +1318,7 @@ impl LayoutThread { &mut layout_context); } + self.first_reflow.set(false); self.respond_to_query_if_necessary(&data.reflow_goal, &mut *rw_data, &mut layout_context, @@ -1618,8 +1619,6 @@ impl LayoutThread { &mut *layout_context, rw_data); - self.first_reflow.set(false); - if opts::get().trace_layout { layout_debug::end_trace(self.generation.get()); } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 75e8b9a0a4ae..8ea282181011 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -14546,6 +14546,12 @@ {} ] ], + "mozilla/first-reflow-sheet-assert.html": [ + [ + "/_mozilla/mozilla/first-reflow-sheet-assert.html", + {} + ] + ], "mozilla/focus_blur.html": [ [ "/_mozilla/mozilla/focus_blur.html", @@ -27925,6 +27931,10 @@ "f2ec5f89521fb4eda64a5e70249bbfb8850c4278", "testharness" ], + "mozilla/first-reflow-sheet-assert.html": [ + "8a0cf9152c3f2421d3e418f824f02c915092d78f", + "testharness" + ], "mozilla/focus_blur.html": [ "2735c5c482e38743b0976789af858075c54408c1", "testharness" diff --git a/tests/wpt/mozilla/tests/mozilla/first-reflow-sheet-assert.html b/tests/wpt/mozilla/tests/mozilla/first-reflow-sheet-assert.html new file mode 100644 index 000000000000..268af6d333f0 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/first-reflow-sheet-assert.html @@ -0,0 +1,16 @@ + + +Issue 18631: Assertion failure when double-adding the UA sheets to the page + + + +