diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index 994f77aa1d5..b8a38247fd7 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -446,6 +446,14 @@ impl<'le> TElement for ServoLayoutElement<'le> { fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool { self.element.has_selector_flags(flags) } + + fn update_animations(&self, _pseudo: Option<&PseudoElement>) { + panic!("this should be only called on gecko"); + } + + fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool { + panic!("this should be only called on gecko"); + } } impl<'le> PartialEq for ServoLayoutElement<'le> { diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index e29d111723e..8c3e87097a6 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -539,6 +539,7 @@ mod bindings { "RawServoDeclarationBlock", "RawGeckoPresContext", "RawGeckoPresContextOwned", + "RawGeckoStyleAnimationList", "GeckoParserExtraData", "RefPtr", "ThreadSafeURIHolder", @@ -636,6 +637,7 @@ mod bindings { "RawGeckoDocument", "RawServoDeclarationBlockStrong", "RawGeckoPresContext", + "RawGeckoStyleAnimationList", ]; let servo_borrow_types = [ "nsCSSValue", diff --git a/components/style/context.rs b/components/style/context.rs index e8adc79faa9..764d68ea1de 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -15,6 +15,7 @@ use euclid::Size2D; use matching::StyleSharingCandidateCache; use parking_lot::RwLock; use properties::ComputedValues; +use selector_parser::PseudoElement; use selectors::matching::ElementSelectorFlags; use servo_config::opts; use std::collections::HashMap; @@ -181,6 +182,10 @@ pub enum SequentialTask { /// Sets selector flags. This is used when we need to set flags on an /// element that we don't have exclusive access to (i.e. the parent). SetSelectorFlags(SendElement, ElementSelectorFlags), + + /// Marks that we need to create/remove/update CSS animations after the + /// first traversal. + UpdateAnimations(SendElement, Option), } impl SequentialTask { @@ -192,6 +197,9 @@ impl SequentialTask { SetSelectorFlags(el, flags) => { unsafe { el.set_selector_flags(flags) }; } + UpdateAnimations(el, pseudo) => { + unsafe { el.update_animations(pseudo.as_ref()) }; + } } } @@ -200,6 +208,12 @@ impl SequentialTask { use self::SequentialTask::*; SetSelectorFlags(unsafe { SendElement::new(el) }, flags) } + + /// Creates a task to update CSS Animations on a given (pseudo-)element. + pub fn update_animations(el: E, pseudo: Option) -> Self { + use self::SequentialTask::*; + UpdateAnimations(unsafe { SendElement::new(el) }, pseudo) + } } /// A thread-local style context. diff --git a/components/style/dom.rs b/components/style/dom.rs index 7a327116746..d4f8d979309 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -335,6 +335,13 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre /// Returns true if the element has all the specified selector flags. fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool; + + /// Creates a task to update CSS Animations on a given (pseudo-)element. + /// Note: Gecko only. + fn update_animations(&self, _pseudo: Option<&PseudoElement>); + + /// Returns true if the element has a CSS animation. + fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool; } /// TNode and TElement aren't Send because we want to be careful and explicit diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 9637b883f3c..53fec86f50e 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -7,11 +7,13 @@ use cssparser::ToCss; use element_state::ElementState; use gecko_bindings::structs::CSSPseudoClassType; +use gecko_bindings::structs::nsIAtom; use selector_parser::{SelectorParser, PseudoElementCascadeType}; use selector_parser::{attr_equals_selector_is_shareable, attr_exists_selector_is_shareable}; use selectors::parser::AttrSelector; use std::borrow::Cow; use std::fmt; +use std::ptr; use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; /// A representation of a CSS pseudo-element. @@ -111,6 +113,12 @@ impl PseudoElement { None } + + /// Returns null or nsIAtom pointer corresponding to a given PseudoElement. + #[inline] + pub fn ns_atom_or_null_from_opt(pseudo: Option<&PseudoElement>) -> *mut nsIAtom { + pseudo.map(|p| p.as_atom().as_ptr()).unwrap_or(ptr::null_mut()) + } } impl ToCss for PseudoElement { diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 09c1d1accd4..d4d0c2dd3db 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -29,16 +29,19 @@ use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement, Gecko_MatchesE use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink, Gecko_Namespace}; use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use gecko_bindings::bindings::Gecko_ClassOrClassList; +use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations; use gecko_bindings::bindings::Gecko_GetAnimationRule; use gecko_bindings::bindings::Gecko_GetHTMLPresentationAttrDeclarationBlock; use gecko_bindings::bindings::Gecko_GetStyleAttrDeclarationBlock; use gecko_bindings::bindings::Gecko_GetStyleContext; +use gecko_bindings::bindings::Gecko_UpdateAnimations; 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_DIRTY_DESCENDANTS_FOR_SERVO; use gecko_bindings::structs::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE; +use gecko_bindings::sugar::ownership::HasArcFFI; use parking_lot::RwLock; use parser::ParserContextExtraData; use properties::{ComputedValues, parse_style_attribute}; @@ -416,7 +419,7 @@ impl<'le> TElement for GeckoElement<'le> { } fn get_animation_rules(&self, pseudo: Option<&PseudoElement>) -> AnimationRules { - let atom_ptr = pseudo.map(|p| p.as_atom().as_ptr()).unwrap_or(ptr::null_mut()); + let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo); unsafe { AnimationRules( Gecko_GetAnimationRule(self.0, atom_ptr, CascadeLevel::Animations).into_arc_opt(), @@ -454,9 +457,8 @@ impl<'le> TElement for GeckoElement<'le> { _existing_values: &'a Arc, pseudo: Option<&PseudoElement>) -> Option<&'a nsStyleContext> { + let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo); unsafe { - let atom_ptr = pseudo.map(|p| p.as_atom().as_ptr()) - .unwrap_or(ptr::null_mut()); let context_ptr = Gecko_GetStyleContext(self.as_node().0, atom_ptr); context_ptr.as_ref() } @@ -505,6 +507,37 @@ impl<'le> TElement for GeckoElement<'le> { let node_flags = selector_flags_to_node_flags(flags); (self.flags() & node_flags) == node_flags } + + fn update_animations(&self, pseudo: Option<&PseudoElement>) { + let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo); + + // We have to update animations even if the element has no computed style + // since it means the element is in a display:none subtree, we should destroy + // all CSS animations in display:none subtree. + let computed_data = self.borrow_data(); + let computed_values = computed_data.as_ref().map(|d| d.styles().primary.values()); + let computed_values_opt = computed_values.map(|v| + *HasArcFFI::arc_as_borrowed(v) + ); + + let parent_element = self.parent_element(); + let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data()); + let parent_values = parent_data.as_ref().map(|d| d.styles().primary.values()); + let parent_values_opt = parent_values.map(|v| + *HasArcFFI::arc_as_borrowed(v) + ); + + unsafe { + Gecko_UpdateAnimations(self.0, atom_ptr, + computed_values_opt, + parent_values_opt); + } + } + + fn has_css_animations(&self, pseudo: Option<&PseudoElement>) -> bool { + let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo); + unsafe { Gecko_ElementHasCSSAnimations(self.0, atom_ptr) } + } } impl<'le> PartialEq for GeckoElement<'le> { diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 13617160f9a..f468ec94ab8 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -14,6 +14,7 @@ use gecko_bindings::structs::RawServoAnimationValue; use gecko_bindings::structs::RawServoDeclarationBlock; use gecko_bindings::structs::RawGeckoPresContext; use gecko_bindings::structs::RawGeckoPresContextOwned; +use gecko_bindings::structs::RawGeckoStyleAnimationList; use gecko_bindings::structs::GeckoParserExtraData; use gecko_bindings::structs::RefPtr; use gecko_bindings::structs::ThreadSafeURIHolder; @@ -232,6 +233,8 @@ pub type RawServoDeclarationBlockStrongBorrowed<'a> = &'a RawServoDeclarationBlo pub type RawServoDeclarationBlockStrongBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlockStrong>; pub type RawGeckoPresContextBorrowed<'a> = &'a RawGeckoPresContext; pub type RawGeckoPresContextBorrowedOrNull<'a> = Option<&'a RawGeckoPresContext>; +pub type RawGeckoStyleAnimationListBorrowed<'a> = &'a RawGeckoStyleAnimationList; +pub type RawGeckoStyleAnimationListBorrowedOrNull<'a> = Option<&'a RawGeckoStyleAnimationList>; pub type nsCSSValueBorrowed<'a> = &'a nsCSSValue; pub type nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>; pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue; @@ -531,6 +534,26 @@ extern "C" { EffectCompositor_CascadeLevel) -> RawServoDeclarationBlockStrong; } +extern "C" { + pub fn Gecko_StyleAnimationsEquals(arg1: + RawGeckoStyleAnimationListBorrowed, + arg2: + RawGeckoStyleAnimationListBorrowed) + -> bool; +} +extern "C" { + pub fn Gecko_UpdateAnimations(aElement: RawGeckoElementBorrowed, + aPseudoTagOrNull: *mut nsIAtom, + aComputedValues: + ServoComputedValuesBorrowedOrNull, + aParentComputedValues: + ServoComputedValuesBorrowedOrNull); +} +extern "C" { + pub fn Gecko_ElementHasCSSAnimations(aElement: RawGeckoElementBorrowed, + aPseudoTagOrNull: *mut nsIAtom) + -> bool; +} extern "C" { pub fn Gecko_Atomize(aString: *const ::std::os::raw::c_char, aLength: u32) -> *mut nsIAtom; diff --git a/components/style/gecko_bindings/structs_debug.rs b/components/style/gecko_bindings/structs_debug.rs index d8c822f842d..fbd1b2f6f3f 100644 --- a/components/style/gecko_bindings/structs_debug.rs +++ b/components/style/gecko_bindings/structs_debug.rs @@ -6044,7 +6044,7 @@ pub mod root { UnstyledChildrenOnly = 1, } pub type CSSPseudoElementTypeBase = u8; - pub const CSSPseudoElementType_AnonBox: + pub const CSSPseudoElementType_InheritingAnonBox: root::mozilla::CSSPseudoElementType = CSSPseudoElementType::Count; #[repr(u8)] @@ -6075,9 +6075,10 @@ pub mod root { placeholder = 22, mozColorSwatch = 23, Count = 24, - XULTree = 25, - NotPseudo = 26, - MAX = 27, + NonInheritingAnonBox = 25, + XULTree = 26, + NotPseudo = 27, + MAX = 28, } pub mod widget { #[allow(unused_imports)] @@ -7836,12 +7837,6 @@ pub mod root { pub type pair_first_type<_T1> = _T1; pub type pair_second_type<_T2> = _T2; #[repr(C)] - pub struct atomic<_Tp> { - pub _base: (), - pub _phantom_0: ::std::marker::PhantomData<_Tp>, - } - pub type atomic___base = [u8; 0usize]; - #[repr(C)] #[derive(Debug, Copy)] pub struct input_iterator_tag { pub _address: u8, @@ -7860,62 +7855,6 @@ pub mod root { fn clone(&self) -> Self { *self } } #[repr(C)] - #[derive(Debug, Copy)] - pub struct forward_iterator_tag { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_forward_iterator_tag() { - assert_eq!(::std::mem::size_of::() , 1usize - , concat ! ( - "Size of: " , stringify ! ( forward_iterator_tag ) )); - assert_eq! (::std::mem::align_of::() , - 1usize , concat ! ( - "Alignment of " , stringify ! ( forward_iterator_tag ) - )); - } - impl Clone for forward_iterator_tag { - fn clone(&self) -> Self { *self } - } - #[repr(C)] - #[derive(Debug, Copy)] - pub struct bidirectional_iterator_tag { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_bidirectional_iterator_tag() { - assert_eq!(::std::mem::size_of::() , - 1usize , concat ! ( - "Size of: " , stringify ! ( bidirectional_iterator_tag - ) )); - assert_eq! (::std::mem::align_of::() , - 1usize , concat ! ( - "Alignment of " , stringify ! ( - bidirectional_iterator_tag ) )); - } - impl Clone for bidirectional_iterator_tag { - fn clone(&self) -> Self { *self } - } - #[repr(C)] - #[derive(Debug, Copy)] - pub struct random_access_iterator_tag { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_random_access_iterator_tag() { - assert_eq!(::std::mem::size_of::() , - 1usize , concat ! ( - "Size of: " , stringify ! ( random_access_iterator_tag - ) )); - assert_eq! (::std::mem::align_of::() , - 1usize , concat ! ( - "Alignment of " , stringify ! ( - random_access_iterator_tag ) )); - } - impl Clone for random_access_iterator_tag { - fn clone(&self) -> Self { *self } - } - #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct iterator<_Category, _Tp, _Distance, _Pointer, _Reference> { pub _address: u8, @@ -7925,209 +7864,250 @@ pub mod root { pub _phantom_3: ::std::marker::PhantomData<_Pointer>, pub _phantom_4: ::std::marker::PhantomData<_Reference>, } + pub type iterator_iterator_category<_Category> = _Category; pub type iterator_value_type<_Tp> = _Tp; pub type iterator_difference_type<_Distance> = _Distance; pub type iterator_pointer<_Pointer> = _Pointer; pub type iterator_reference<_Reference> = _Reference; - pub type iterator_iterator_category<_Category> = _Category; #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct __bit_const_reference<_Cp> { - pub __seg_: root::std::__bit_const_reference___storage_pointer<_Cp>, - pub __mask_: root::std::__bit_const_reference___storage_type<_Cp>, + #[derive(Debug)] + pub struct atomic<_Tp> { + pub _M_i: _Tp, + } + pub mod chrono { + #[allow(unused_imports)] + use self::super::super::super::root; } - pub type __bit_const_reference___storage_type<_Cp> = _Cp; - pub type __bit_const_reference___storage_pointer<_Cp> = _Cp; } - pub type __int64_t = ::std::os::raw::c_longlong; - pub type __darwin_va_list = root::__builtin_va_list; - pub type __darwin_off_t = root::__int64_t; - pub type va_list = root::__darwin_va_list; - pub type fpos_t = root::__darwin_off_t; + pub mod __gnu_cxx { + #[allow(unused_imports)] + use self::super::super::root; + } + pub type __off_t = ::std::os::raw::c_long; + pub type __off64_t = ::std::os::raw::c_long; #[repr(C)] #[derive(Debug, Copy)] - pub struct __sbuf { - pub _base: *mut ::std::os::raw::c_uchar, - pub _size: ::std::os::raw::c_int, + pub struct _IO_FILE { + pub _flags: ::std::os::raw::c_int, + pub _IO_read_ptr: *mut ::std::os::raw::c_char, + pub _IO_read_end: *mut ::std::os::raw::c_char, + pub _IO_read_base: *mut ::std::os::raw::c_char, + pub _IO_write_base: *mut ::std::os::raw::c_char, + pub _IO_write_ptr: *mut ::std::os::raw::c_char, + pub _IO_write_end: *mut ::std::os::raw::c_char, + pub _IO_buf_base: *mut ::std::os::raw::c_char, + pub _IO_buf_end: *mut ::std::os::raw::c_char, + pub _IO_save_base: *mut ::std::os::raw::c_char, + pub _IO_backup_base: *mut ::std::os::raw::c_char, + pub _IO_save_end: *mut ::std::os::raw::c_char, + pub _markers: *mut root::_IO_marker, + pub _chain: *mut root::_IO_FILE, + pub _fileno: ::std::os::raw::c_int, + pub _flags2: ::std::os::raw::c_int, + pub _old_offset: root::__off_t, + pub _cur_column: ::std::os::raw::c_ushort, + pub _vtable_offset: ::std::os::raw::c_char, + pub _shortbuf: [::std::os::raw::c_char; 1usize], + pub _lock: *mut root::_IO_lock_t, + pub _offset: root::__off64_t, + pub __pad1: *mut ::std::os::raw::c_void, + pub __pad2: *mut ::std::os::raw::c_void, + pub __pad3: *mut ::std::os::raw::c_void, + pub __pad4: *mut ::std::os::raw::c_void, + pub __pad5: usize, + pub _mode: ::std::os::raw::c_int, + pub _unused2: [::std::os::raw::c_char; 20usize], } #[test] - fn bindgen_test_layout___sbuf() { - assert_eq!(::std::mem::size_of::<__sbuf>() , 16usize , concat ! ( - "Size of: " , stringify ! ( __sbuf ) )); - assert_eq! (::std::mem::align_of::<__sbuf>() , 8usize , concat ! ( - "Alignment of " , stringify ! ( __sbuf ) )); + fn bindgen_test_layout__IO_FILE() { + assert_eq!(::std::mem::size_of::<_IO_FILE>() , 216usize , concat ! ( + "Size of: " , stringify ! ( _IO_FILE ) )); + assert_eq! (::std::mem::align_of::<_IO_FILE>() , 8usize , concat ! ( + "Alignment of " , stringify ! ( _IO_FILE ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sbuf ) ) . _base as * const _ as + & ( * ( 0 as * const _IO_FILE ) ) . _flags as * const _ as usize } , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( __sbuf ) , "::" , - stringify ! ( _base ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const __sbuf ) ) . _size as * const _ as - usize } , 8usize , concat ! ( - "Alignment of field: " , stringify ! ( __sbuf ) , "::" , - stringify ! ( _size ) )); - } - impl Clone for __sbuf { - fn clone(&self) -> Self { *self } - } - #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct __sFILEX([u8; 0]); - #[repr(C)] - #[derive(Debug, Copy)] - pub struct __sFILE { - pub _p: *mut ::std::os::raw::c_uchar, - pub _r: ::std::os::raw::c_int, - pub _w: ::std::os::raw::c_int, - pub _flags: ::std::os::raw::c_short, - pub _file: ::std::os::raw::c_short, - pub _bf: root::__sbuf, - pub _lbfsize: ::std::os::raw::c_int, - pub _cookie: *mut ::std::os::raw::c_void, - pub _close: ::std::option::Option ::std::os::raw::c_int>, - pub _read: ::std::option::Option ::std::os::raw::c_int>, - pub _seek: ::std::option::Option ::std::os::raw::c_longlong>, - pub _write: ::std::option::Option ::std::os::raw::c_int>, - pub _ub: root::__sbuf, - pub _extra: *mut root::__sFILEX, - pub _ur: ::std::os::raw::c_int, - pub _ubuf: [::std::os::raw::c_uchar; 3usize], - pub _nbuf: [::std::os::raw::c_uchar; 1usize], - pub _lb: root::__sbuf, - pub _blksize: ::std::os::raw::c_int, - pub _offset: root::fpos_t, - } - #[test] - fn bindgen_test_layout___sFILE() { - assert_eq!(::std::mem::size_of::<__sFILE>() , 152usize , concat ! ( - "Size of: " , stringify ! ( __sFILE ) )); - assert_eq! (::std::mem::align_of::<__sFILE>() , 8usize , concat ! ( - "Alignment of " , stringify ! ( __sFILE ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _p as * const _ as - usize } , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _p ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _r as * const _ as - usize } , 8usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _r ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _w as * const _ as - usize } , 12usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _w ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _flags as * const _ as - usize } , 16usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , stringify ! ( _flags ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _file as * const _ as - usize } , 18usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _file ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_read_ptr as * + const _ as usize } , 8usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_read_ptr ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _bf as * const _ as - usize } , 24usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _bf ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_read_end as * + const _ as usize } , 16usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_read_end ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _lbfsize as * const _ - as usize } , 40usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _lbfsize ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_read_base as * + const _ as usize } , 24usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_read_base ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _cookie as * const _ as - usize } , 48usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _cookie ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_write_base as * + const _ as usize } , 32usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_write_base ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _close as * const _ as - usize } , 56usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _close ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_write_ptr as * + const _ as usize } , 40usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_write_ptr ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _read as * const _ as - usize } , 64usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _read ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_write_end as * + const _ as usize } , 48usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_write_end ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _seek as * const _ as - usize } , 72usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _seek ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_buf_base as * + const _ as usize } , 56usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_buf_base ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _write as * const _ as - usize } , 80usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _write ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_buf_end as * const + _ as usize } , 64usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_buf_end ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _ub as * const _ as - usize } , 88usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _ub ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _IO_save_base as * + const _ as usize } , 72usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_save_base ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _extra as * const _ as + & ( * ( 0 as * const _IO_FILE ) ) . _IO_backup_base as * + const _ as usize } , 80usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_backup_base ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . _IO_save_end as * + const _ as usize } , 88usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _IO_save_end ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . _markers as * const _ + as usize } , 96usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _markers ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . _chain as * const _ as usize } , 104usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _extra ) )); + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _chain ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _ur as * const _ as - usize } , 112usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _ur ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _fileno as * const _ + as usize } , 112usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _fileno ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _ubuf as * const _ as - usize } , 116usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _ubuf ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _flags2 as * const _ + as usize } , 116usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _flags2 ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _nbuf as * const _ as - usize } , 119usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _nbuf ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _old_offset as * const + _ as usize } , 120usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _old_offset ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _lb as * const _ as - usize } , 120usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _lb ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _cur_column as * const + _ as usize } , 128usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _cur_column ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _blksize as * const _ - as usize } , 136usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , - stringify ! ( _blksize ) )); + & ( * ( 0 as * const _IO_FILE ) ) . _vtable_offset as * + const _ as usize } , 130usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _vtable_offset ) )); assert_eq! (unsafe { - & ( * ( 0 as * const __sFILE ) ) . _offset as * const _ as - usize } , 144usize , concat ! ( - "Alignment of field: " , stringify ! ( __sFILE ) , "::" , + & ( * ( 0 as * const _IO_FILE ) ) . _shortbuf as * const _ + as usize } , 131usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _shortbuf ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . _lock as * const _ as + usize } , 136usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _lock ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . _offset as * const _ + as usize } , 144usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , stringify ! ( _offset ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . __pad1 as * const _ as + usize } , 152usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( __pad1 ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . __pad2 as * const _ as + usize } , 160usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( __pad2 ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . __pad3 as * const _ as + usize } , 168usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( __pad3 ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . __pad4 as * const _ as + usize } , 176usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( __pad4 ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . __pad5 as * const _ as + usize } , 184usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( __pad5 ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . _mode as * const _ as + usize } , 192usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _mode ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_FILE ) ) . _unused2 as * const _ + as usize } , 196usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_FILE ) , "::" , + stringify ! ( _unused2 ) )); } - impl Clone for __sFILE { + impl Clone for _IO_FILE { + fn clone(&self) -> Self { *self } + } + pub type FILE = root::_IO_FILE; + pub type va_list = root::__builtin_va_list; + pub type _IO_lock_t = ::std::os::raw::c_void; + #[repr(C)] + #[derive(Debug, Copy)] + pub struct _IO_marker { + pub _next: *mut root::_IO_marker, + pub _sbuf: *mut root::_IO_FILE, + pub _pos: ::std::os::raw::c_int, + } + #[test] + fn bindgen_test_layout__IO_marker() { + assert_eq!(::std::mem::size_of::<_IO_marker>() , 24usize , concat ! ( + "Size of: " , stringify ! ( _IO_marker ) )); + assert_eq! (::std::mem::align_of::<_IO_marker>() , 8usize , concat ! ( + "Alignment of " , stringify ! ( _IO_marker ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_marker ) ) . _next as * const _ + as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_marker ) , "::" + , stringify ! ( _next ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_marker ) ) . _sbuf as * const _ + as usize } , 8usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_marker ) , "::" + , stringify ! ( _sbuf ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const _IO_marker ) ) . _pos as * const _ as + usize } , 16usize , concat ! ( + "Alignment of field: " , stringify ! ( _IO_marker ) , "::" + , stringify ! ( _pos ) )); + } + impl Clone for _IO_marker { fn clone(&self) -> Self { *self } } - pub type FILE = root::__sFILE; /** * MozRefCountType is Mozilla's reference count type. * @@ -15334,63 +15314,63 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsDOMMutationObserver([u8; 0]); - pub const NODE_HAS_LISTENERMANAGER: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_LISTENERMANAGER; - pub const NODE_HAS_PROPERTIES: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_PROPERTIES; - pub const NODE_IS_ANONYMOUS_ROOT: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_ANONYMOUS_ROOT; - pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE; - pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_NATIVE_ANONYMOUS_ROOT; - pub const NODE_FORCE_XBL_BINDINGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_FORCE_XBL_BINDINGS; - pub const NODE_MAY_BE_IN_BINDING_MNGR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_MAY_BE_IN_BINDING_MNGR; - pub const NODE_IS_EDITABLE: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_EDITABLE; - pub const NODE_IS_NATIVE_ANONYMOUS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_NATIVE_ANONYMOUS; - pub const NODE_IS_IN_SHADOW_TREE: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_IN_SHADOW_TREE; - pub const NODE_HAS_EMPTY_SELECTOR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_EMPTY_SELECTOR; - pub const NODE_HAS_SLOW_SELECTOR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_SLOW_SELECTOR; - pub const NODE_HAS_EDGE_CHILD_SELECTOR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_EDGE_CHILD_SELECTOR; - pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS; - pub const NODE_ALL_SELECTOR_FLAGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_ALL_SELECTOR_FLAGS; - pub const NODE_NEEDS_FRAME: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_NEEDS_FRAME; - pub const NODE_DESCENDANTS_NEED_FRAMES: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_DESCENDANTS_NEED_FRAMES; - pub const NODE_HAS_ACCESSKEY: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_ACCESSKEY; - pub const NODE_HAS_DIRECTION_RTL: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_DIRECTION_RTL; - pub const NODE_HAS_DIRECTION_LTR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_DIRECTION_LTR; - pub const NODE_ALL_DIRECTION_FLAGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_ALL_DIRECTION_FLAGS; - pub const NODE_CHROME_ONLY_ACCESS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_CHROME_ONLY_ACCESS; - pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS; - pub const NODE_SHARED_RESTYLE_BIT_1: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_SHARED_RESTYLE_BIT_1; - pub const NODE_SHARED_RESTYLE_BIT_2: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_SHARED_RESTYLE_BIT_2; - pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_SHARED_RESTYLE_BIT_1; - pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_TYPE_SPECIFIC_BITS_OFFSET; + pub const NODE_HAS_LISTENERMANAGER: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_LISTENERMANAGER; + pub const NODE_HAS_PROPERTIES: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_PROPERTIES; + pub const NODE_IS_ANONYMOUS_ROOT: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_IS_ANONYMOUS_ROOT; + pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE; + pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_IS_NATIVE_ANONYMOUS_ROOT; + pub const NODE_FORCE_XBL_BINDINGS: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_FORCE_XBL_BINDINGS; + pub const NODE_MAY_BE_IN_BINDING_MNGR: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_MAY_BE_IN_BINDING_MNGR; + pub const NODE_IS_EDITABLE: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_IS_EDITABLE; + pub const NODE_IS_NATIVE_ANONYMOUS: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_IS_NATIVE_ANONYMOUS; + pub const NODE_IS_IN_SHADOW_TREE: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_IS_IN_SHADOW_TREE; + pub const NODE_HAS_EMPTY_SELECTOR: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_EMPTY_SELECTOR; + pub const NODE_HAS_SLOW_SELECTOR: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_SLOW_SELECTOR; + pub const NODE_HAS_EDGE_CHILD_SELECTOR: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_EDGE_CHILD_SELECTOR; + pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS; + pub const NODE_ALL_SELECTOR_FLAGS: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_ALL_SELECTOR_FLAGS; + pub const NODE_NEEDS_FRAME: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_NEEDS_FRAME; + pub const NODE_DESCENDANTS_NEED_FRAMES: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_DESCENDANTS_NEED_FRAMES; + pub const NODE_HAS_ACCESSKEY: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_ACCESSKEY; + pub const NODE_HAS_DIRECTION_RTL: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_DIRECTION_RTL; + pub const NODE_HAS_DIRECTION_LTR: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_HAS_DIRECTION_LTR; + pub const NODE_ALL_DIRECTION_FLAGS: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_ALL_DIRECTION_FLAGS; + pub const NODE_CHROME_ONLY_ACCESS: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_CHROME_ONLY_ACCESS; + pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS; + pub const NODE_SHARED_RESTYLE_BIT_1: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_SHARED_RESTYLE_BIT_1; + pub const NODE_SHARED_RESTYLE_BIT_2: root::_bindgen_ty_118 = + _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_TYPE_SPECIFIC_BITS_OFFSET: root::_bindgen_ty_118 = + _bindgen_ty_118::NODE_TYPE_SPECIFIC_BITS_OFFSET; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] - pub enum _bindgen_ty_28 { + pub enum _bindgen_ty_118 { NODE_HAS_LISTENERMANAGER = 4, NODE_HAS_PROPERTIES = 8, NODE_IS_ANONYMOUS_ROOT = 16, @@ -20169,6 +20149,21 @@ pub mod root { eCSSTokenSerialization_Symbol_Asterisk = 23, eCSSTokenSerialization_Other = 24, } + /** + * An array of objects, similar to AutoTArray but which is memmovable. It + * always has length >= 1. + */ + #[repr(C)] + #[derive(Debug)] + pub struct nsStyleAutoArray { + pub mFirstElement: T, + pub mOtherElements: root::nsTArray, + } + #[repr(i32)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum nsStyleAutoArray_WithSingleInitialElement { + WITH_SINGLE_INITIAL_ELEMENT = 0, + } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsCSSSelector([u8; 0]); @@ -22577,21 +22572,6 @@ pub mod root { "Alignment of field: " , stringify ! ( nsStyleColor ) , "::" , stringify ! ( mColor ) )); } - /** - * An array of objects, similar to AutoTArray but which is memmovable. It - * always has length >= 1. - */ - #[repr(C)] - #[derive(Debug)] - pub struct nsStyleAutoArray { - pub mFirstElement: T, - pub mOtherElements: root::nsTArray, - } - #[repr(i32)] - #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] - pub enum nsStyleAutoArray_WithSingleInitialElement { - WITH_SINGLE_INITIAL_ELEMENT = 0, - } #[repr(C)] #[derive(Debug)] pub struct nsStyleImageLayers { @@ -25510,6 +25490,8 @@ pub mod root { root::nsTArray; pub type RawServoAnimationValueBorrowedList = root::nsTArray<*const root::RawServoAnimationValue>; + pub type RawGeckoStyleAnimationList = + root::nsStyleAutoArray; pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode; pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode; pub type RawGeckoElementBorrowed = *const root::RawGeckoElement; @@ -25528,6 +25510,8 @@ pub mod root { pub type RawGeckoKeyframeListBorrowed = *const root::RawGeckoKeyframeList; pub type RawGeckoComputedKeyframeValuesListBorrowedMut = *mut root::RawGeckoComputedKeyframeValuesList; + pub type RawGeckoStyleAnimationListBorrowed = + *const root::RawGeckoStyleAnimationList; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ElementRuleProcessorData([u8; 0]); diff --git a/components/style/gecko_bindings/structs_release.rs b/components/style/gecko_bindings/structs_release.rs index d535c60010a..341b80b8518 100644 --- a/components/style/gecko_bindings/structs_release.rs +++ b/components/style/gecko_bindings/structs_release.rs @@ -5884,7 +5884,7 @@ pub mod root { UnstyledChildrenOnly = 1, } pub type CSSPseudoElementTypeBase = u8; - pub const CSSPseudoElementType_AnonBox: + pub const CSSPseudoElementType_InheritingAnonBox: root::mozilla::CSSPseudoElementType = CSSPseudoElementType::Count; #[repr(u8)] @@ -5915,9 +5915,10 @@ pub mod root { placeholder = 22, mozColorSwatch = 23, Count = 24, - XULTree = 25, - NotPseudo = 26, - MAX = 27, + NonInheritingAnonBox = 25, + XULTree = 26, + NotPseudo = 27, + MAX = 28, } pub mod widget { #[allow(unused_imports)] @@ -7649,12 +7650,6 @@ pub mod root { pub type pair_first_type<_T1> = _T1; pub type pair_second_type<_T2> = _T2; #[repr(C)] - pub struct atomic<_Tp> { - pub _base: (), - pub _phantom_0: ::std::marker::PhantomData<_Tp>, - } - pub type atomic___base = [u8; 0usize]; - #[repr(C)] #[derive(Debug, Copy)] pub struct input_iterator_tag { pub _address: u8, @@ -7673,62 +7668,6 @@ pub mod root { fn clone(&self) -> Self { *self } } #[repr(C)] - #[derive(Debug, Copy)] - pub struct forward_iterator_tag { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_forward_iterator_tag() { - assert_eq!(::std::mem::size_of::() , 1usize - , concat ! ( - "Size of: " , stringify ! ( forward_iterator_tag ) )); - assert_eq! (::std::mem::align_of::() , - 1usize , concat ! ( - "Alignment of " , stringify ! ( forward_iterator_tag ) - )); - } - impl Clone for forward_iterator_tag { - fn clone(&self) -> Self { *self } - } - #[repr(C)] - #[derive(Debug, Copy)] - pub struct bidirectional_iterator_tag { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_bidirectional_iterator_tag() { - assert_eq!(::std::mem::size_of::() , - 1usize , concat ! ( - "Size of: " , stringify ! ( bidirectional_iterator_tag - ) )); - assert_eq! (::std::mem::align_of::() , - 1usize , concat ! ( - "Alignment of " , stringify ! ( - bidirectional_iterator_tag ) )); - } - impl Clone for bidirectional_iterator_tag { - fn clone(&self) -> Self { *self } - } - #[repr(C)] - #[derive(Debug, Copy)] - pub struct random_access_iterator_tag { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_random_access_iterator_tag() { - assert_eq!(::std::mem::size_of::() , - 1usize , concat ! ( - "Size of: " , stringify ! ( random_access_iterator_tag - ) )); - assert_eq! (::std::mem::align_of::() , - 1usize , concat ! ( - "Alignment of " , stringify ! ( - random_access_iterator_tag ) )); - } - impl Clone for random_access_iterator_tag { - fn clone(&self) -> Self { *self } - } - #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct iterator<_Category, _Tp, _Distance, _Pointer, _Reference> { pub _address: u8, @@ -7738,22 +7677,22 @@ pub mod root { pub _phantom_3: ::std::marker::PhantomData<_Pointer>, pub _phantom_4: ::std::marker::PhantomData<_Reference>, } + pub type iterator_iterator_category<_Category> = _Category; pub type iterator_value_type<_Tp> = _Tp; pub type iterator_difference_type<_Distance> = _Distance; pub type iterator_pointer<_Pointer> = _Pointer; pub type iterator_reference<_Reference> = _Reference; - pub type iterator_iterator_category<_Category> = _Category; #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct __bit_const_reference<_Cp> { - pub __seg_: root::std::__bit_const_reference___storage_pointer<_Cp>, - pub __mask_: root::std::__bit_const_reference___storage_type<_Cp>, + #[derive(Debug)] + pub struct atomic<_Tp> { + pub _M_i: _Tp, } - pub type __bit_const_reference___storage_type<_Cp> = _Cp; - pub type __bit_const_reference___storage_pointer<_Cp> = _Cp; } - pub type __darwin_va_list = root::__builtin_va_list; - pub type va_list = root::__darwin_va_list; + pub mod __gnu_cxx { + #[allow(unused_imports)] + use self::super::super::root; + } + pub type va_list = root::__builtin_va_list; /** * MozRefCountType is Mozilla's reference count type. * @@ -14802,63 +14741,63 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsDOMMutationObserver([u8; 0]); - pub const NODE_HAS_LISTENERMANAGER: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_LISTENERMANAGER; - pub const NODE_HAS_PROPERTIES: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_PROPERTIES; - pub const NODE_IS_ANONYMOUS_ROOT: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_ANONYMOUS_ROOT; - pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE; - pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_NATIVE_ANONYMOUS_ROOT; - pub const NODE_FORCE_XBL_BINDINGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_FORCE_XBL_BINDINGS; - pub const NODE_MAY_BE_IN_BINDING_MNGR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_MAY_BE_IN_BINDING_MNGR; - pub const NODE_IS_EDITABLE: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_EDITABLE; - pub const NODE_IS_NATIVE_ANONYMOUS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_NATIVE_ANONYMOUS; - pub const NODE_IS_IN_SHADOW_TREE: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_IN_SHADOW_TREE; - pub const NODE_HAS_EMPTY_SELECTOR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_EMPTY_SELECTOR; - pub const NODE_HAS_SLOW_SELECTOR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_SLOW_SELECTOR; - pub const NODE_HAS_EDGE_CHILD_SELECTOR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_EDGE_CHILD_SELECTOR; - pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS; - pub const NODE_ALL_SELECTOR_FLAGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_ALL_SELECTOR_FLAGS; - pub const NODE_NEEDS_FRAME: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_NEEDS_FRAME; - pub const NODE_DESCENDANTS_NEED_FRAMES: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_DESCENDANTS_NEED_FRAMES; - pub const NODE_HAS_ACCESSKEY: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_ACCESSKEY; - pub const NODE_HAS_DIRECTION_RTL: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_DIRECTION_RTL; - pub const NODE_HAS_DIRECTION_LTR: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_HAS_DIRECTION_LTR; - pub const NODE_ALL_DIRECTION_FLAGS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_ALL_DIRECTION_FLAGS; - pub const NODE_CHROME_ONLY_ACCESS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_CHROME_ONLY_ACCESS; - pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS; - pub const NODE_SHARED_RESTYLE_BIT_1: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_SHARED_RESTYLE_BIT_1; - pub const NODE_SHARED_RESTYLE_BIT_2: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_SHARED_RESTYLE_BIT_2; - pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_SHARED_RESTYLE_BIT_1; - pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: root::_bindgen_ty_28 = - _bindgen_ty_28::NODE_TYPE_SPECIFIC_BITS_OFFSET; + pub const NODE_HAS_LISTENERMANAGER: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_LISTENERMANAGER; + pub const NODE_HAS_PROPERTIES: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_PROPERTIES; + pub const NODE_IS_ANONYMOUS_ROOT: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_IS_ANONYMOUS_ROOT; + pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE; + pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_IS_NATIVE_ANONYMOUS_ROOT; + pub const NODE_FORCE_XBL_BINDINGS: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_FORCE_XBL_BINDINGS; + pub const NODE_MAY_BE_IN_BINDING_MNGR: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_MAY_BE_IN_BINDING_MNGR; + pub const NODE_IS_EDITABLE: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_IS_EDITABLE; + pub const NODE_IS_NATIVE_ANONYMOUS: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_IS_NATIVE_ANONYMOUS; + pub const NODE_IS_IN_SHADOW_TREE: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_IS_IN_SHADOW_TREE; + pub const NODE_HAS_EMPTY_SELECTOR: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_EMPTY_SELECTOR; + pub const NODE_HAS_SLOW_SELECTOR: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_SLOW_SELECTOR; + pub const NODE_HAS_EDGE_CHILD_SELECTOR: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_EDGE_CHILD_SELECTOR; + pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS; + pub const NODE_ALL_SELECTOR_FLAGS: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_ALL_SELECTOR_FLAGS; + pub const NODE_NEEDS_FRAME: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_NEEDS_FRAME; + pub const NODE_DESCENDANTS_NEED_FRAMES: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_DESCENDANTS_NEED_FRAMES; + pub const NODE_HAS_ACCESSKEY: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_ACCESSKEY; + pub const NODE_HAS_DIRECTION_RTL: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_DIRECTION_RTL; + pub const NODE_HAS_DIRECTION_LTR: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_HAS_DIRECTION_LTR; + pub const NODE_ALL_DIRECTION_FLAGS: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_ALL_DIRECTION_FLAGS; + pub const NODE_CHROME_ONLY_ACCESS: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_CHROME_ONLY_ACCESS; + pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS; + pub const NODE_SHARED_RESTYLE_BIT_1: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_SHARED_RESTYLE_BIT_1; + pub const NODE_SHARED_RESTYLE_BIT_2: root::_bindgen_ty_105 = + _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_TYPE_SPECIFIC_BITS_OFFSET: root::_bindgen_ty_105 = + _bindgen_ty_105::NODE_TYPE_SPECIFIC_BITS_OFFSET; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] - pub enum _bindgen_ty_28 { + pub enum _bindgen_ty_105 { NODE_HAS_LISTENERMANAGER = 4, NODE_HAS_PROPERTIES = 8, NODE_IS_ANONYMOUS_ROOT = 16, @@ -19569,6 +19508,21 @@ pub mod root { eCSSTokenSerialization_Symbol_Asterisk = 23, eCSSTokenSerialization_Other = 24, } + /** + * An array of objects, similar to AutoTArray but which is memmovable. It + * always has length >= 1. + */ + #[repr(C)] + #[derive(Debug)] + pub struct nsStyleAutoArray { + pub mFirstElement: T, + pub mOtherElements: root::nsTArray, + } + #[repr(i32)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum nsStyleAutoArray_WithSingleInitialElement { + WITH_SINGLE_INITIAL_ELEMENT = 0, + } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsCSSSelector([u8; 0]); @@ -21976,21 +21930,6 @@ pub mod root { "Alignment of field: " , stringify ! ( nsStyleColor ) , "::" , stringify ! ( mColor ) )); } - /** - * An array of objects, similar to AutoTArray but which is memmovable. It - * always has length >= 1. - */ - #[repr(C)] - #[derive(Debug)] - pub struct nsStyleAutoArray { - pub mFirstElement: T, - pub mOtherElements: root::nsTArray, - } - #[repr(i32)] - #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] - pub enum nsStyleAutoArray_WithSingleInitialElement { - WITH_SINGLE_INITIAL_ELEMENT = 0, - } #[repr(C)] #[derive(Debug)] pub struct nsStyleImageLayers { @@ -24909,6 +24848,8 @@ pub mod root { root::nsTArray; pub type RawServoAnimationValueBorrowedList = root::nsTArray<*const root::RawServoAnimationValue>; + pub type RawGeckoStyleAnimationList = + root::nsStyleAutoArray; pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode; pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode; pub type RawGeckoElementBorrowed = *const root::RawGeckoElement; @@ -24927,6 +24868,8 @@ pub mod root { pub type RawGeckoKeyframeListBorrowed = *const root::RawGeckoKeyframeList; pub type RawGeckoComputedKeyframeValuesListBorrowedMut = *mut root::RawGeckoComputedKeyframeValuesList; + pub type RawGeckoStyleAnimationListBorrowed = + *const root::RawGeckoStyleAnimationList; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ElementRuleProcessorData([u8; 0]); diff --git a/components/style/matching.rs b/components/style/matching.rs index f47276d83a6..b8d6d567338 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -556,13 +556,12 @@ trait PrivateMatchMethods: TElement { /// Computes values and damage for the primary or pseudo style of an element, /// setting them on the ElementData. fn cascade_primary_or_pseudo<'a>(&self, - context: &StyleContext, + context: &mut StyleContext, data: &mut ElementData, pseudo: Option<&PseudoElement>, possibly_expired_animations: &mut Vec, booleans: CascadeBooleans) { // Collect some values. - let shared_context = context.shared; let (mut styles, restyle) = data.styles_and_restyle_mut(); let mut primary_style = &mut styles.primary; let pseudos = &mut styles.pseudos; @@ -575,31 +574,12 @@ trait PrivateMatchMethods: TElement { &mut pseudo_style, &booleans); // Handle animations. - if booleans.animate && cfg!(feature = "servo") { - if let Some(ref mut old) = old_values { - self.update_animations_for_cascade(shared_context, old, - possibly_expired_animations); - } - - let new_animations_sender = &context.thread_local.new_animations_sender; - let this_opaque = self.as_node().opaque(); - // Trigger any present animations if necessary. - animation::maybe_start_animations(&shared_context, - new_animations_sender, - this_opaque, &new_values); - - // Trigger transitions if necessary. This will reset `new_values` back - // to its old value if it did trigger a transition. - if let Some(ref values) = old_values { - animation::start_transitions_if_applicable( - new_animations_sender, - this_opaque, - self.as_node().to_unsafe(), - &**values, - &mut new_values, - &shared_context.timer, - &possibly_expired_animations); - } + if booleans.animate { + self.process_animations(context, + &mut old_values, + &mut new_values, + pseudo, + possibly_expired_animations); } // Accumulate restyle damage. @@ -615,6 +595,73 @@ trait PrivateMatchMethods: TElement { } } + #[cfg(feature = "gecko")] + fn process_animations(&self, + context: &mut StyleContext, + old_values: &mut Option>, + new_values: &mut Arc, + pseudo: Option<&PseudoElement>, + _possibly_expired_animations: &mut Vec) { + let ref new_box_style = new_values.get_box(); + let has_new_animation_style = new_box_style.animation_name_count() >= 1 && + new_box_style.animation_name_at(0).0.len() != 0; + let has_animations = self.has_css_animations(pseudo); + + let needs_update_animations = + old_values.as_ref().map_or(has_new_animation_style, |ref old| { + let ref old_box_style = old.get_box(); + let old_display_style = old_box_style.clone_display(); + let new_display_style = new_box_style.clone_display(); + // FIXME: Bug 1344581: We still need to compare keyframe rules. + !old_box_style.animations_equals(&new_box_style) || + (old_display_style == display::T::none && + new_display_style != display::T::none && + has_new_animation_style) || + (old_display_style != display::T::none && + new_display_style == display::T::none && + has_animations) + }); + if needs_update_animations { + let task = SequentialTask::update_animations(self.as_node().as_element().unwrap(), + pseudo.cloned()); + context.thread_local.tasks.push(task); + } + } + + #[cfg(feature = "servo")] + fn process_animations(&self, + context: &mut StyleContext, + old_values: &mut Option>, + new_values: &mut Arc, + _pseudo: Option<&PseudoElement>, + possibly_expired_animations: &mut Vec) { + let shared_context = context.shared; + if let Some(ref mut old) = *old_values { + self.update_animations_for_cascade(shared_context, old, + possibly_expired_animations); + } + + let new_animations_sender = &context.thread_local.new_animations_sender; + let this_opaque = self.as_node().opaque(); + // Trigger any present animations if necessary. + animation::maybe_start_animations(&shared_context, + new_animations_sender, + this_opaque, &new_values); + + // Trigger transitions if necessary. This will reset `new_values` back + // to its old value if it did trigger a transition. + if let Some(ref values) = *old_values { + animation::start_transitions_if_applicable( + new_animations_sender, + this_opaque, + self.as_node().to_unsafe(), + &**values, + new_values, + &shared_context.timer, + &possibly_expired_animations); + } + } + /// Computes and applies non-redundant damage. #[cfg(feature = "gecko")] fn accumulate_damage(&self, @@ -1010,7 +1057,7 @@ pub trait MatchMethods : TElement { /// Run the CSS cascade and compute values for the element, potentially /// starting any new transitions or animations. fn cascade_element(&self, - context: &StyleContext, + context: &mut StyleContext, mut data: &mut AtomicRefMut, primary_is_shareable: bool) { diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 4b5e758e06f..bd6f272011f 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1795,6 +1795,10 @@ fn static_assert() { } ${impl_transition_count('property', 'Property')} + pub fn animations_equals(&self, other: &Self) -> bool { + unsafe { bindings::Gecko_StyleAnimationsEquals(&self.gecko.mAnimations, &other.gecko.mAnimations) } + } + pub fn set_animation_name(&mut self, v: longhands::animation_name::computed_value::T) { use nsstring::nsCString; diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 15ca0c5a52f..d50a4c74371 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1431,7 +1431,7 @@ pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSet use style::gecko_bindings::structs::Keyframe; use style::properties::LonghandIdSet; - let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut(); + let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let name = unsafe { Atom::from(name.as_ref().unwrap().as_str_unchecked()) }; let style_timing_function = unsafe { timing_function.as_ref().unwrap() }; let style = ComputedValues::as_arc(&style);