Add flag that represents the traversal is only for animation-only restyle.

We will set the flag when the root node of the traversal has
has-animation-only-dirty-descendants flag or has animation restyle hints.
Also we will use this flag to detect whether we need to trigger CSS transitions
or not.
This commit is contained in:
Hiroyuki Ikezoe 2017-03-26 18:47:16 +09:00
parent 499d1c4117
commit be332fe5a4
4 changed files with 20 additions and 3 deletions

View file

@ -125,7 +125,8 @@ pub extern "C" fn Servo_Shutdown() {
}
fn create_shared_context<'a>(guard: &'a SharedRwLockReadGuard,
per_doc_data: &PerDocumentStyleDataImpl) -> SharedStyleContext<'a> {
per_doc_data: &PerDocumentStyleDataImpl,
animation_only: bool) -> SharedStyleContext<'a> {
let local_context_data =
ThreadLocalStyleContextCreationInfo::new(per_doc_data.new_animations_sender.clone());
@ -140,6 +141,7 @@ fn create_shared_context<'a>(guard: &'a SharedRwLockReadGuard,
timer: Timer::new(),
// FIXME Find the real QuirksMode information for this document
quirks_mode: QuirksMode::NoQuirks,
animation_only_restyle: animation_only,
}
}
@ -166,7 +168,8 @@ fn traverse_subtree(element: GeckoElement, raw_data: RawServoStyleSetBorrowed,
let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read();
let shared_style_context = create_shared_context(&guard, &per_doc_data);
let shared_style_context = create_shared_context(&guard, &per_doc_data,
traversal_flags.for_animation_only());
let traversal_driver = if global_style_data.style_thread_pool.is_none() {
TraversalDriver::Sequential
@ -1509,7 +1512,7 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
}
// We don't have the style ready. Go ahead and compute it as necessary.
let shared = create_shared_context(&guard, &mut doc_data.borrow_mut());
let shared = create_shared_context(&guard, &mut doc_data.borrow_mut(), false);
let mut tlc = ThreadLocalStyleContext::new(&shared);
let mut context = StyleContext {
shared: &shared,