Skip to content

Commit

Permalink
layout_thread: Avoid adding the UA sheets multiple times when there's…
Browse files Browse the repository at this point in the history
… no root flow.

Fixes #18631
  • Loading branch information
emilio committed Oct 1, 2017
1 parent dd27ec1 commit 8976b1a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 1 addition & 2 deletions components/layout_thread/lib.rs
Expand Up @@ -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,
Expand Down Expand Up @@ -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());
}
Expand Down
10 changes: 10 additions & 0 deletions tests/wpt/mozilla/meta/MANIFEST.json
Expand Up @@ -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",
Expand Down Expand Up @@ -27925,6 +27931,10 @@
"f2ec5f89521fb4eda64a5e70249bbfb8850c4278",
"testharness"
],
"mozilla/first-reflow-sheet-assert.html": [
"8a0cf9152c3f2421d3e418f824f02c915092d78f",
"testharness"
],
"mozilla/focus_blur.html": [
"2735c5c482e38743b0976789af858075c54408c1",
"testharness"
Expand Down
16 changes: 16 additions & 0 deletions tests/wpt/mozilla/tests/mozilla/first-reflow-sheet-assert.html
@@ -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>

0 comments on commit 8976b1a

Please sign in to comment.