aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/lib.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2018-12-08 12:33:23 -0500
committerJosh Matthews <josh@joshmatthews.net>2018-12-10 08:59:17 -0500
commited74b898a5a5a7227ab68ce7ca68a540fc4dde9a (patch)
tree5a709b6d875268fb7d4973450fbbe258490076a9 /components/layout_thread/lib.rs
parent8fb1b567fa87a66d3a962060716e3be794ea66b2 (diff)
downloadservo-ed74b898a5a5a7227ab68ce7ca68a540fc4dde9a.tar.gz
servo-ed74b898a5a5a7227ab68ce7ca68a540fc4dde9a.zip
Cancel animations that affect nodes that do not participate in layout.
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r--components/layout_thread/lib.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 611bbbfac00..fd419bdb10f 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -27,7 +27,7 @@ use crossbeam_channel::{unbounded, Receiver, Sender};
use embedder_traits::resources::{self, Resource};
use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D};
use fnv::FnvHashMap;
-use fxhash::FxHashMap;
+use fxhash::{FxHashMap, FxHashSet};
use gfx::font;
use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context;
@@ -647,6 +647,7 @@ impl LayoutThread {
},
Msg::RegisterPaint(..) => LayoutHangAnnotation::RegisterPaint,
Msg::SetNavigationStart(..) => LayoutHangAnnotation::SetNavigationStart,
+ Msg::GetRunningAnimations(..) => LayoutHangAnnotation::GetRunningAnimations,
};
self.background_hang_monitor
.notify_activity(HangAnnotation::Layout(hang_annotation));
@@ -818,6 +819,9 @@ impl LayoutThread {
Msg::SetNavigationStart(time) => {
self.paint_time_metrics.set_navigation_start(time);
},
+ Msg::GetRunningAnimations(sender) => {
+ let _ = sender.send(self.running_animations.read().len());
+ },
}
true
@@ -1447,6 +1451,7 @@ impl LayoutThread {
Some(&document),
&mut rw_data,
&mut layout_context,
+ FxHashSet::default(),
);
}
@@ -1624,7 +1629,7 @@ impl LayoutThread {
let snapshots = SnapshotMap::new();
let mut layout_context = self.build_layout_context(guards, false, &snapshots);
- {
+ let invalid_nodes = {
// Perform an abbreviated style recalc that operates without access to the DOM.
let animations = self.running_animations.read();
profile(
@@ -1638,8 +1643,8 @@ impl LayoutThread {
&animations,
)
},
- );
- }
+ )
+ };
self.perform_post_style_recalc_layout_passes(
&mut root_flow,
&reflow_info,
@@ -1647,6 +1652,7 @@ impl LayoutThread {
None,
&mut *rw_data,
&mut layout_context,
+ invalid_nodes,
);
assert!(layout_context.pending_images.is_none());
assert!(layout_context.newly_transitioning_nodes.is_none());
@@ -1661,6 +1667,7 @@ impl LayoutThread {
document: Option<&ServoLayoutDocument>,
rw_data: &mut LayoutThreadData,
context: &mut LayoutContext,
+ invalid_nodes: FxHashSet<OpaqueNode>,
) {
{
let mut newly_transitioning_nodes = context
@@ -1675,6 +1682,7 @@ impl LayoutThread {
&self.script_chan,
&mut *self.running_animations.write(),
&mut *self.expired_animations.write(),
+ invalid_nodes,
newly_transitioning_nodes,
&self.new_animations_receiver,
self.id,