From 661574f9df3e644f1465759ec41dce3f0d31747e Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Sun, 26 Mar 2017 18:40:21 +0900 Subject: [PATCH] Add NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO to represent that an element's descendant has animation. --- components/style/dom.rs | 18 ++++++++++++++++++ components/style/gecko/wrapper.rs | 13 +++++++++++++ .../style/gecko_bindings/structs_debug.rs | 3 +++ .../style/gecko_bindings/structs_release.rs | 3 +++ 4 files changed, 37 insertions(+) diff --git a/components/style/dom.rs b/components/style/dom.rs index ac8ad3bd109..a0c83c88b3f 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -309,6 +309,24 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre /// Only safe to call with exclusive access to the element. unsafe fn unset_dirty_descendants(&self); + /// Similar to the dirty_descendants but for representing a descendant of + /// the element needs to be updated in animation-only traversal. + fn has_animation_only_dirty_descendants(&self) -> bool { + false + } + + /// Flag that this element has a descendant for animation-only restyle processing. + /// + /// Only safe to call with exclusive access to the element. + unsafe fn set_animation_only_dirty_descendants(&self) { + } + + /// Flag that this element has no descendant for animation-only restyle processing. + /// + /// Only safe to call with exclusive access to the element. + unsafe fn unset_animation_only_dirty_descendants(&self) { + } + /// Atomically stores the number of children of this node that we will /// need to process during bottom-up traversal. fn store_children_to_process(&self, n: isize); diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index bcdc81052aa..3b0c5bf6cdb 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -42,6 +42,7 @@ use gecko_bindings::structs; use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode}; use gecko_bindings::structs::{nsIAtom, nsIContent, nsStyleContext}; use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel; +use gecko_bindings::structs::NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO; use gecko_bindings::structs::NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO; use gecko_bindings::structs::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE; use gecko_bindings::sugar::ownership::HasArcFFI; @@ -510,6 +511,18 @@ impl<'le> TElement for GeckoElement<'le> { self.unset_flags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32) } + fn has_animation_only_dirty_descendants(&self) -> bool { + self.flags() & (NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO as u32) != 0 + } + + unsafe fn set_animation_only_dirty_descendants(&self) { + self.set_flags(NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO as u32) + } + + unsafe fn unset_animation_only_dirty_descendants(&self) { + self.unset_flags(NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO as u32) + } + fn store_children_to_process(&self, _: isize) { // This is only used for bottom-up traversal, and is thus a no-op for Gecko. } diff --git a/components/style/gecko_bindings/structs_debug.rs b/components/style/gecko_bindings/structs_debug.rs index 52b8dfc0860..99a64649299 100644 --- a/components/style/gecko_bindings/structs_debug.rs +++ b/components/style/gecko_bindings/structs_debug.rs @@ -15654,6 +15654,9 @@ pub mod root { _bindgen_ty_118::NODE_SHARED_RESTYLE_BIT_2; pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: root::_bindgen_ty_118 = _bindgen_ty_118::NODE_SHARED_RESTYLE_BIT_1; + pub const NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO: + root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_SHARED_RESTYLE_BIT_2; pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: root::_bindgen_ty_118 = _bindgen_ty_118::NODE_TYPE_SPECIFIC_BITS_OFFSET; #[repr(u32)] diff --git a/components/style/gecko_bindings/structs_release.rs b/components/style/gecko_bindings/structs_release.rs index d932c19e403..9ae2d19da52 100644 --- a/components/style/gecko_bindings/structs_release.rs +++ b/components/style/gecko_bindings/structs_release.rs @@ -15102,6 +15102,9 @@ pub mod root { _bindgen_ty_105::NODE_SHARED_RESTYLE_BIT_2; pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: root::_bindgen_ty_105 = _bindgen_ty_105::NODE_SHARED_RESTYLE_BIT_1; + pub const NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO: + root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_SHARED_RESTYLE_BIT_2; pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: root::_bindgen_ty_105 = _bindgen_ty_105::NODE_TYPE_SPECIFIC_BITS_OFFSET; #[repr(u32)]