Process animation-only traversal.

All traversal processes are like this:

1. Traverse only elements that have this restyle hint (animation-only traversal)
   RESTYLE_CSS_ANIMATIONS is stripped off from restyle hints of the elements
2. Traverse all dirty elements (normal traversal)
3. Create a SequentialTask if we have updated CSS Animations properties in
   the normal traversal
4. Traverse elements that need to have updated animation style as a result of 3
   (second animation-only traversal)
This commit is contained in:
Hiroyuki Ikezoe 2017-03-26 18:47:34 +09:00
parent be332fe5a4
commit e4fe416c9d
2 changed files with 48 additions and 8 deletions

View file

@ -83,8 +83,8 @@ use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
use style::supports::parse_condition_or_declaration;
use style::thread_state;
use style::timer::Timer;
use style::traversal::{ANIMATION_ONLY, UNSTYLED_CHILDREN_ONLY};
use style::traversal::{resolve_style, DomTraversal, TraversalDriver, TraversalFlags};
use style::traversal::UNSTYLED_CHILDREN_ONLY;
use style_traits::ToCss;
use super::stylesheet_loader::StylesheetLoader;
@ -202,6 +202,11 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
_ => TraversalFlags::empty(),
};
if element.has_animation_only_dirty_descendants() ||
element.has_animation_restyle_hints() {
traverse_subtree(element, raw_data, traversal_flags | ANIMATION_ONLY);
}
traverse_subtree(element, raw_data, traversal_flags);
element.has_dirty_descendants() || element.mutate_data().unwrap().has_restyle()
@ -1612,7 +1617,7 @@ pub extern "C" fn Servo_AssertTreeIsClean(root: RawGeckoElementBorrowed) {
let root = GeckoElement(root);
fn assert_subtree_is_clean<'le>(el: GeckoElement<'le>) {
debug_assert!(!el.has_dirty_descendants());
debug_assert!(!el.has_dirty_descendants() && !el.has_animation_only_dirty_descendants());
for child in el.as_node().children() {
if let Some(child) = child.as_element() {
assert_subtree_is_clean(child);