mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Auto merge of #18696 - emilio:ua-sheets-reflow, r=jdm
layout_thread: Avoid adding the UA sheets multiple times when there's no root flow. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18696) <!-- Reviewable:end -->
This commit is contained in:
commit
3dc4614991
3 changed files with 43 additions and 17 deletions
|
@ -1318,6 +1318,7 @@ impl LayoutThread {
|
||||||
&mut layout_context);
|
&mut layout_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.first_reflow.set(false);
|
||||||
self.respond_to_query_if_necessary(&data.reflow_goal,
|
self.respond_to_query_if_necessary(&data.reflow_goal,
|
||||||
&mut *rw_data,
|
&mut *rw_data,
|
||||||
&mut layout_context,
|
&mut layout_context,
|
||||||
|
@ -1596,6 +1597,7 @@ impl LayoutThread {
|
||||||
});
|
});
|
||||||
|
|
||||||
self.perform_post_main_layout_passes(data,
|
self.perform_post_main_layout_passes(data,
|
||||||
|
root_flow,
|
||||||
reflow_goal,
|
reflow_goal,
|
||||||
document,
|
document,
|
||||||
rw_data,
|
rw_data,
|
||||||
|
@ -1604,19 +1606,18 @@ impl LayoutThread {
|
||||||
|
|
||||||
fn perform_post_main_layout_passes(&self,
|
fn perform_post_main_layout_passes(&self,
|
||||||
data: &Reflow,
|
data: &Reflow,
|
||||||
|
mut root_flow: &mut FlowRef,
|
||||||
reflow_goal: &ReflowGoal,
|
reflow_goal: &ReflowGoal,
|
||||||
document: Option<&ServoLayoutDocument>,
|
document: Option<&ServoLayoutDocument>,
|
||||||
rw_data: &mut LayoutThreadData,
|
rw_data: &mut LayoutThreadData,
|
||||||
layout_context: &mut LayoutContext) {
|
layout_context: &mut LayoutContext) {
|
||||||
// Build the display list if necessary, and send it to the painter.
|
// 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,
|
self.compute_abs_pos_and_build_display_list(data,
|
||||||
reflow_goal,
|
reflow_goal,
|
||||||
document,
|
document,
|
||||||
FlowRef::deref_mut(&mut root_flow),
|
FlowRef::deref_mut(&mut root_flow),
|
||||||
&mut *layout_context,
|
&mut *layout_context,
|
||||||
rw_data);
|
rw_data);
|
||||||
self.first_reflow.set(false);
|
|
||||||
|
|
||||||
if opts::get().trace_layout {
|
if opts::get().trace_layout {
|
||||||
layout_debug::end_trace(self.generation.get());
|
layout_debug::end_trace(self.generation.get());
|
||||||
|
@ -1628,7 +1629,6 @@ impl LayoutThread {
|
||||||
|
|
||||||
self.generation.set(self.generation.get() + 1);
|
self.generation.set(self.generation.get() + 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn reflow_all_nodes(flow: &mut Flow) {
|
fn reflow_all_nodes(flow: &mut Flow) {
|
||||||
debug!("reflowing all nodes!");
|
debug!("reflowing all nodes!");
|
||||||
|
|
|
@ -14546,6 +14546,12 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"mozilla/first-reflow-sheet-assert.html": [
|
||||||
|
[
|
||||||
|
"/_mozilla/mozilla/first-reflow-sheet-assert.html",
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"mozilla/focus_blur.html": [
|
"mozilla/focus_blur.html": [
|
||||||
[
|
[
|
||||||
"/_mozilla/mozilla/focus_blur.html",
|
"/_mozilla/mozilla/focus_blur.html",
|
||||||
|
@ -27925,6 +27931,10 @@
|
||||||
"f2ec5f89521fb4eda64a5e70249bbfb8850c4278",
|
"f2ec5f89521fb4eda64a5e70249bbfb8850c4278",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
|
"mozilla/first-reflow-sheet-assert.html": [
|
||||||
|
"8a0cf9152c3f2421d3e418f824f02c915092d78f",
|
||||||
|
"testharness"
|
||||||
|
],
|
||||||
"mozilla/focus_blur.html": [
|
"mozilla/focus_blur.html": [
|
||||||
"2735c5c482e38743b0976789af858075c54408c1",
|
"2735c5c482e38743b0976789af858075c54408c1",
|
||||||
"testharness"
|
"testharness"
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Issue 18631: Assertion failure when double-adding the UA sheets to the page</title>
|
||||||
|
<style>
|
||||||
|
* { display: none }
|
||||||
|
</style>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script>
|
||||||
|
// Trigger two forced reflows.
|
||||||
|
test(function() {
|
||||||
|
document.documentElement.offsetTop;
|
||||||
|
document.documentElement.offsetTop;
|
||||||
|
assert_true(true, "Didn't assert");
|
||||||
|
}, "Passes if it doesn't assert");
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue