mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
layout: Don't panic if requestAnimationFrame()
is called before first layout.
Closes #7115.
This commit is contained in:
parent
14b921ee29
commit
a516042edb
3 changed files with 40 additions and 9 deletions
|
@ -1276,14 +1276,23 @@ impl LayoutTask {
|
||||||
&self.url,
|
&self.url,
|
||||||
reflow_info.goal);
|
reflow_info.goal);
|
||||||
|
|
||||||
{
|
match rw_data.root_flow.as_ref() {
|
||||||
// Perform an abbreviated style recalc that operates without access to the DOM.
|
None => {
|
||||||
let mut root_flow = (*rw_data.root_flow.as_ref().unwrap()).clone();
|
// We haven't performed a single layout yet! Do nothing.
|
||||||
let animations = &*rw_data.running_animations;
|
return
|
||||||
profile(time::ProfilerCategory::LayoutStyleRecalc,
|
}
|
||||||
self.profiler_metadata(),
|
Some(ref root_flow) => {
|
||||||
self.time_profiler_chan.clone(),
|
// Perform an abbreviated style recalc that operates without access to the DOM.
|
||||||
|| animation::recalc_style_for_animations(root_flow.deref_mut(), animations));
|
let mut root_flow = (*root_flow).clone();
|
||||||
|
let animations = &*rw_data.running_animations;
|
||||||
|
profile(time::ProfilerCategory::LayoutStyleRecalc,
|
||||||
|
self.profiler_metadata(),
|
||||||
|
self.time_profiler_chan.clone(),
|
||||||
|
|| {
|
||||||
|
animation::recalc_style_for_animations(root_flow.deref_mut(),
|
||||||
|
animations)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.perform_post_style_recalc_layout_passes(&reflow_info,
|
self.perform_post_style_recalc_layout_passes(&reflow_info,
|
||||||
|
|
|
@ -767,6 +767,12 @@
|
||||||
"url": "/_mozilla/mozilla/window_performance.html"
|
"url": "/_mozilla/mozilla/window_performance.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"mozilla/window_requestAnimationFrame.html": [
|
||||||
|
{
|
||||||
|
"path": "mozilla/window_requestAnimationFrame.html",
|
||||||
|
"url": "/_mozilla/mozilla/window_requestAnimationFrame.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"mozilla/window_setInterval.html": [
|
"mozilla/window_setInterval.html": [
|
||||||
{
|
{
|
||||||
"path": "mozilla/window_setInterval.html",
|
"path": "mozilla/window_setInterval.html",
|
||||||
|
@ -1040,4 +1046,4 @@
|
||||||
"rev": null,
|
"rev": null,
|
||||||
"url_base": "/_mozilla/",
|
"url_base": "/_mozilla/",
|
||||||
"version": 2
|
"version": 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test throwing an error inside requestAnimationFrame callback</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
async_test(function() {
|
||||||
|
window.requestAnimationFrame(this.step_func_done());
|
||||||
|
// FIXME(#7296)
|
||||||
|
setTimeout(this.step_func_done(), 500);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue