diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-10-10 04:34:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-10 04:34:47 -0500 |
commit | 55a7fd75b4c081a92ebdac932afbc9b19b91e87c (patch) | |
tree | 3461f348a3cf4e01c1f787a78ef2047b1a327100 | |
parent | 27cb13314e5d4a0653887768c374cbc81d7f098b (diff) | |
parent | fd2ccee84ded5256565fa5ad3f8c7c663455aeab (diff) | |
download | servo-55a7fd75b4c081a92ebdac932afbc9b19b91e87c.tar.gz servo-55a7fd75b4c081a92ebdac932afbc9b19b91e87c.zip |
Auto merge of #18738 - hiikezoe:use-atom-for-animation-name-property, r=xidorn
Use atom for animation name property
<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1329169
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18738)
<!-- Reviewable:end -->
-rw-r--r-- | components/style/gecko/generated/bindings.rs | 18 | ||||
-rw-r--r-- | components/style/gecko/generated/structs.rs | 109 | ||||
-rw-r--r-- | components/style/properties/gecko.mako.rs | 31 | ||||
-rw-r--r-- | components/style/values/mod.rs | 11 | ||||
-rw-r--r-- | ports/geckolib/glue.rs | 4 |
5 files changed, 100 insertions, 73 deletions
diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index 57f08684e8f..2dd2506136b 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -235,6 +235,7 @@ use gecko_bindings::structs::UpdateAnimationsTasks; use gecko_bindings::structs::ParsingMode; use gecko_bindings::structs::InheritTarget; use gecko_bindings::structs::URLMatchingFunction; +use gecko_bindings::structs::StyleAnimation; use gecko_bindings::structs::StyleRuleInclusion; use gecko_bindings::structs::nsStyleTransformMatrix::MatrixTransformOperator; unsafe impl Send for nsStyleTransformMatrix::MatrixTransformOperator {} @@ -281,8 +282,6 @@ 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 RawGeckoXBLBindingBorrowed<'a> = &'a RawGeckoXBLBinding; pub type RawGeckoXBLBindingBorrowedOrNull<'a> = Option<&'a RawGeckoXBLBinding>; pub type nsCSSPropertyIDSetBorrowed<'a> = &'a nsCSSPropertyIDSet; @@ -333,6 +332,10 @@ pub type RawGeckoServoAnimationValueListBorrowed<'a> = &'a RawGeckoServoAnimatio pub type RawGeckoServoAnimationValueListBorrowedOrNull<'a> = Option<&'a RawGeckoServoAnimationValueList>; pub type RawGeckoServoAnimationValueListBorrowedMut<'a> = &'a mut RawGeckoServoAnimationValueList; pub type RawGeckoServoAnimationValueListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoServoAnimationValueList>; +pub type RawGeckoStyleAnimationListBorrowed<'a> = &'a RawGeckoStyleAnimationList; +pub type RawGeckoStyleAnimationListBorrowedOrNull<'a> = Option<&'a RawGeckoStyleAnimationList>; +pub type RawGeckoStyleAnimationListBorrowedMut<'a> = &'a mut RawGeckoStyleAnimationList; +pub type RawGeckoStyleAnimationListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoStyleAnimationList>; pub type RawGeckoStyleChildrenIteratorBorrowed<'a> = &'a RawGeckoStyleChildrenIterator; pub type RawGeckoStyleChildrenIteratorBorrowedOrNull<'a> = Option<&'a RawGeckoStyleChildrenIterator>; pub type RawGeckoStyleChildrenIteratorBorrowedMut<'a> = &'a mut RawGeckoStyleChildrenIterator; @@ -789,6 +792,15 @@ extern "C" { -> bool; } extern "C" { + pub fn Gecko_CopyAnimationNames(aDest: + RawGeckoStyleAnimationListBorrowedMut, + aSrc: RawGeckoStyleAnimationListBorrowed); +} +extern "C" { + pub fn Gecko_SetAnimationName(aStyleAnimation: *mut StyleAnimation, + aAtom: *mut nsAtom); +} +extern "C" { pub fn Gecko_UpdateAnimations(aElementOrPseudo: RawGeckoElementBorrowed, aOldComputedValues: ServoStyleContextBorrowedOrNull, @@ -2066,7 +2078,7 @@ extern "C" { } extern "C" { pub fn Servo_StyleSet_GetKeyframesForName(set: RawServoStyleSetBorrowed, - property: *const nsACString, + name: *mut nsAtom, timing_function: nsTimingFunctionBorrowed, keyframe_list: diff --git a/components/style/gecko/generated/structs.rs b/components/style/gecko/generated/structs.rs index 69253f300a6..4d0c256f69d 100644 --- a/components/style/gecko/generated/structs.rs +++ b/components/style/gecko/generated/structs.rs @@ -4517,7 +4517,7 @@ pub mod root { } #[test] fn bindgen_test_layout_GeckoDisplay() { - assert_eq!(::std::mem::size_of::<GeckoDisplay>() , 424usize , + assert_eq!(::std::mem::size_of::<GeckoDisplay>() , 416usize , concat ! ( "Size of: " , stringify ! ( GeckoDisplay ) )); assert_eq! (::std::mem::align_of::<GeckoDisplay>() , 8usize , @@ -6229,7 +6229,7 @@ pub mod root { pub mTimingFunction: root::nsTimingFunction, pub mDuration: f32, pub mDelay: f32, - pub mName: ::nsstring::nsStringRepr, + pub mName: root::RefPtr<root::nsAtom>, pub mDirection: root::mozilla::dom::PlaybackDirection, pub mFillMode: root::mozilla::dom::FillMode, pub mPlayState: u8, @@ -6237,7 +6237,7 @@ pub mod root { } #[test] fn bindgen_test_layout_StyleAnimation() { - assert_eq!(::std::mem::size_of::<StyleAnimation>() , 56usize , + assert_eq!(::std::mem::size_of::<StyleAnimation>() , 48usize , concat ! ( "Size of: " , stringify ! ( StyleAnimation ) )); assert_eq! (::std::mem::align_of::<StyleAnimation>() , 8usize , @@ -6266,22 +6266,22 @@ pub mod root { ) , "::" , stringify ! ( mName ) )); assert_eq! (unsafe { & ( * ( 0 as * const StyleAnimation ) ) . mDirection - as * const _ as usize } , 48usize , concat ! ( + as * const _ as usize } , 40usize , concat ! ( "Alignment of field: " , stringify ! ( StyleAnimation ) , "::" , stringify ! ( mDirection ) )); assert_eq! (unsafe { & ( * ( 0 as * const StyleAnimation ) ) . mFillMode as - * const _ as usize } , 49usize , concat ! ( + * const _ as usize } , 41usize , concat ! ( "Alignment of field: " , stringify ! ( StyleAnimation ) , "::" , stringify ! ( mFillMode ) )); assert_eq! (unsafe { & ( * ( 0 as * const StyleAnimation ) ) . mPlayState - as * const _ as usize } , 50usize , concat ! ( + as * const _ as usize } , 42usize , concat ! ( "Alignment of field: " , stringify ! ( StyleAnimation ) , "::" , stringify ! ( mPlayState ) )); assert_eq! (unsafe { & ( * ( 0 as * const StyleAnimation ) ) . - mIterationCount as * const _ as usize } , 52usize , + mIterationCount as * const _ as usize } , 44usize , concat ! ( "Alignment of field: " , stringify ! ( StyleAnimation ) , "::" , stringify ! ( mIterationCount ) )); @@ -13511,7 +13511,7 @@ pub mod root { pub const nsStyleDisplay_kHasFinishStyle: bool = false; #[test] fn bindgen_test_layout_nsStyleDisplay() { - assert_eq!(::std::mem::size_of::<nsStyleDisplay>() , 424usize , concat + assert_eq!(::std::mem::size_of::<nsStyleDisplay>() , 416usize , concat ! ( "Size of: " , stringify ! ( nsStyleDisplay ) )); assert_eq! (::std::mem::align_of::<nsStyleDisplay>() , 8usize , concat ! ( "Alignment of " , stringify ! ( nsStyleDisplay ) )); @@ -13746,54 +13746,54 @@ pub mod root { assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . mAnimationTimingFunctionCount as * const _ as usize } , - 368usize , concat ! ( + 360usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationTimingFunctionCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . - mAnimationDurationCount as * const _ as usize } , 372usize + mAnimationDurationCount as * const _ as usize } , 364usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationDurationCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . - mAnimationDelayCount as * const _ as usize } , 376usize , + mAnimationDelayCount as * const _ as usize } , 368usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationDelayCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . - mAnimationNameCount as * const _ as usize } , 380usize , + mAnimationNameCount as * const _ as usize } , 372usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationNameCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . mAnimationDirectionCount as * const _ as usize } , - 384usize , concat ! ( + 376usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationDirectionCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . - mAnimationFillModeCount as * const _ as usize } , 388usize + mAnimationFillModeCount as * const _ as usize } , 380usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationFillModeCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . mAnimationPlayStateCount as * const _ as usize } , - 392usize , concat ! ( + 384usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationPlayStateCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . mAnimationIterationCountCount as * const _ as usize } , - 396usize , concat ! ( + 388usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mAnimationIterationCountCount ) )); assert_eq! (unsafe { & ( * ( 0 as * const nsStyleDisplay ) ) . mShapeOutside as - * const _ as usize } , 400usize , concat ! ( + * const _ as usize } , 392usize , concat ! ( "Alignment of field: " , stringify ! ( nsStyleDisplay ) , "::" , stringify ! ( mShapeOutside ) )); } @@ -26280,6 +26280,8 @@ pub mod root { *const root::RawGeckoPropertyValuePairList; pub type RawGeckoComputedKeyframeValuesListBorrowedMut = *mut root::RawGeckoComputedKeyframeValuesList; + pub type RawGeckoStyleAnimationListBorrowedMut = + *mut root::RawGeckoStyleAnimationList; pub type RawGeckoStyleAnimationListBorrowed = *const root::RawGeckoStyleAnimationList; pub type RawGeckoFontFaceRuleListBorrowedMut = @@ -32597,7 +32599,7 @@ pub mod root { root::nsTArray<root::mozilla::gfx::FontVariation> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_214690_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_214713_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsCSSSelector>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -32845,7 +32847,7 @@ pub mod root { #[test] fn __bindgen_test_layout_nsStyleAutoArray_open0_StyleAnimation_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsStyleAutoArray<root::mozilla::StyleAnimation>>() - , 64usize , concat ! ( + , 56usize , concat ! ( "Size of template specialization: " , stringify ! ( root::nsStyleAutoArray<root::mozilla::StyleAnimation> ) )); assert_eq!(::std::mem::align_of::<root::nsStyleAutoArray<root::mozilla::StyleAnimation>>() @@ -32986,7 +32988,7 @@ pub mod root { ::nsstring::nsStringRepr ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_216503_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_216526_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::StyleSheet>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -33151,7 +33153,7 @@ pub mod root { root::JS::DeletePolicy ) )); } #[test] - fn __bindgen_test_layout_iterator_open0_input_iterator_tag_UniquePtr_open1_JSErrorNotes_Note_DeletePolicy_open2_JSErrorNotes_Note_close2_close1_long__bindgen_ty_id_222100__bindgen_ty_id_222107_close0_instantiation() { + fn __bindgen_test_layout_iterator_open0_input_iterator_tag_UniquePtr_open1_JSErrorNotes_Note_DeletePolicy_open2_JSErrorNotes_Note_close2_close1_long__bindgen_ty_id_222123__bindgen_ty_id_222130_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::std::iterator>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -33546,7 +33548,7 @@ pub mod root { root::RefPtr<root::mozilla::StyleSheet> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_224662_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_224685_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::dom::Element>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -33614,7 +33616,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_224967_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_224990_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::dom::Element>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -33726,7 +33728,7 @@ pub mod root { root::RefPtr<root::mozilla::URLExtraData> ) )); } #[test] - fn __bindgen_test_layout_NotNull_open0__bindgen_ty_id_225518_close0_instantiation() { + fn __bindgen_test_layout_NotNull_open0__bindgen_ty_id_225541_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::mozilla::NotNull<*const root::mozilla::Encoding>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -34161,7 +34163,7 @@ pub mod root { root::RefPtr<root::mozilla::StyleSheet> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_225947_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_225970_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::StyleSheet>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -34277,7 +34279,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_226361_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_226384_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::StyleSheet>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -34422,7 +34424,7 @@ pub mod root { ::nsstring::nsStringRepr ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_227320_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_227343_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::StyleSheet>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -34511,7 +34513,7 @@ pub mod root { root::RefPtr<root::nsCSSFontFaceRule> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_227630_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_227653_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -34522,7 +34524,7 @@ pub mod root { root::nsTArray<*mut root::nsIContent> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_227635_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_227658_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -34579,7 +34581,7 @@ pub mod root { root::RefPtr<root::mozilla::CSSStyleSheet> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_228112_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_228135_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::StyleSheet>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -35227,7 +35229,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_230800_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_230823_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut ::std::os::raw::c_void>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -35306,7 +35308,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_236844_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_236867_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::dom::AudioContext>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -35396,7 +35398,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_239153_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_239176_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsISupports>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -35451,6 +35453,17 @@ pub mod root { root::nsTArray<root::mozilla::ServoAttrSnapshot> ) )); } #[test] + fn __bindgen_test_layout_RefPtr_open0_nsAtom_close0_instantiation_9() { + assert_eq!(::std::mem::size_of::<root::RefPtr<root::nsAtom>>() , + 8usize , concat ! ( + "Size of template specialization: " , stringify ! ( + root::RefPtr<root::nsAtom> ) )); + assert_eq!(::std::mem::align_of::<root::RefPtr<root::nsAtom>>() , + 8usize , concat ! ( + "Alignment of template specialization: " , stringify ! ( + root::RefPtr<root::nsAtom> ) )); + } + #[test] fn __bindgen_test_layout_nsTArray_open0_PropertyValuePair_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<root::mozilla::PropertyValuePair>>() , 8usize , concat ! ( @@ -35541,7 +35554,7 @@ pub mod root { #[test] fn __bindgen_test_layout_nsStyleAutoArray_open0_StyleAnimation_close0_instantiation_1() { assert_eq!(::std::mem::size_of::<root::nsStyleAutoArray<root::mozilla::StyleAnimation>>() - , 64usize , concat ! ( + , 56usize , concat ! ( "Size of template specialization: " , stringify ! ( root::nsStyleAutoArray<root::mozilla::StyleAnimation> ) )); assert_eq!(::std::mem::align_of::<root::nsStyleAutoArray<root::mozilla::StyleAnimation>>() @@ -35677,7 +35690,7 @@ pub mod root { root::nsTArray<f64> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_241307_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_241338_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::dom::Element>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -35747,7 +35760,7 @@ pub mod root { ::nsstring::nsStringRepr ) )); } #[test] - fn __bindgen_test_layout_RefPtr_open0_nsAtom_close0_instantiation_9() { + fn __bindgen_test_layout_RefPtr_open0_nsAtom_close0_instantiation_10() { assert_eq!(::std::mem::size_of::<root::RefPtr<root::nsAtom>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -35793,7 +35806,7 @@ pub mod root { root::nsRefPtrHashKey<root::nsAtom> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_243679_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_243710_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::CounterStyle>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -36509,7 +36522,7 @@ pub mod root { ::nsstring::nsStringRepr ) )); } #[test] - fn __bindgen_test_layout_RefPtr_open0_nsAtom_close0_instantiation_10() { + fn __bindgen_test_layout_RefPtr_open0_nsAtom_close0_instantiation_11() { assert_eq!(::std::mem::size_of::<root::RefPtr<root::nsAtom>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -36669,7 +36682,7 @@ pub mod root { root::RefPtr<root::nsStyleImageRequest> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_246027_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_246058_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsISupports>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -36840,7 +36853,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_249916_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_249947_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -36851,7 +36864,7 @@ pub mod root { root::nsTArray<*mut root::nsIContent> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_249921_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_249952_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -36939,7 +36952,7 @@ pub mod root { root::RefPtr<root::mozilla::dom::ShadowRoot> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_250034_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_250065_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -37200,7 +37213,7 @@ pub mod root { root::nsRefPtrHashKey<root::mozilla::dom::Element> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_251760_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_251791_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -37222,7 +37235,7 @@ pub mod root { root::RefPtr<root::mozilla::dom::Element> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_251918_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_251949_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -37233,7 +37246,7 @@ pub mod root { root::nsTArray<*mut root::nsIContent> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_251923_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_251954_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::nsIContent>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -37398,7 +37411,7 @@ pub mod root { root::nsTArray<root::mozilla::gfx::FontVariation> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_254366_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_254403_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::css::DocumentRule>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -37409,7 +37422,7 @@ pub mod root { root::nsTArray<*mut root::mozilla::css::DocumentRule> ) )); } #[test] - fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_254372_close0_instantiation() { + fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_254409_close0_instantiation() { assert_eq!(::std::mem::size_of::<root::nsTArray<*mut root::mozilla::css::DocumentRule>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -37420,7 +37433,7 @@ pub mod root { root::nsTArray<*mut root::mozilla::css::DocumentRule> ) )); } #[test] - fn __bindgen_test_layout_RefPtr_open0_nsAtom_close0_instantiation_11() { + fn __bindgen_test_layout_RefPtr_open0_nsAtom_close0_instantiation_12() { assert_eq!(::std::mem::size_of::<root::RefPtr<root::nsAtom>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index c20470a27aa..e1625ff7491 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3215,42 +3215,33 @@ fn static_assert() { where I: IntoIterator<Item = longhands::animation_name::computed_value::single_value::T>, I::IntoIter: ExactSizeIterator { - let v = v.into_iter(); debug_assert!(v.len() != 0); unsafe { self.gecko.mAnimations.ensure_len(v.len()) }; self.gecko.mAnimationNameCount = v.len() as u32; for (servo, gecko) in v.zip(self.gecko.mAnimations.iter_mut()) { - // TODO This is inefficient. We should fix this in bug 1329169. - gecko.mName.assign(match servo.0 { - Some(ref name) => name.as_atom().as_slice(), - None => &[], // Empty string for 'none' - }); + let atom = match servo.0 { + None => atom!(""), + Some(ref name) => name.as_atom().clone(), + }; + unsafe { bindings::Gecko_SetAnimationName(gecko, atom.into_addrefed()); } } } pub fn animation_name_at(&self, index: usize) -> longhands::animation_name::computed_value::SingleComputedValue { use properties::longhands::animation_name::single_value::SpecifiedValue as AnimationName; - // XXX: Is there any effective ways? - let atom = &self.gecko.mAnimations[index].mName; - if atom.is_empty() { + + let atom = self.gecko.mAnimations[index].mName.mRawPtr; + if atom == atom!("").as_ptr() { AnimationName(None) } else { - AnimationName(Some(KeyframesName::from_ident(&atom.to_string()))) + AnimationName(Some(KeyframesName::from_atom(atom.into()))) } } pub fn copy_animation_name_from(&mut self, other: &Self) { - unsafe { self.gecko.mAnimations.ensure_len(other.gecko.mAnimations.len()) }; - - let count = other.gecko.mAnimationNameCount; - self.gecko.mAnimationNameCount = count; - - // The length of mAnimations is often greater than mAnimationXXCount, - // don't copy values over the count. - for (index, animation) in self.gecko.mAnimations.iter_mut().enumerate().take(count as usize) { - animation.mName.assign(&*other.gecko.mAnimations[index].mName); - } + self.gecko.mAnimationNameCount = other.gecko.mAnimationNameCount; + unsafe { bindings::Gecko_CopyAnimationNames(&mut self.gecko.mAnimations, &other.gecko.mAnimations); } } pub fn reset_animation_name(&mut self, other: &Self) { diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index 15978aa04a3..f338cb357c0 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -146,6 +146,17 @@ impl KeyframesName { } } + /// Create a new KeyframesName from Atom. + #[cfg(feature = "gecko")] + pub fn from_atom(atom: Atom) -> Self { + debug_assert_ne!(atom, atom!("")); + + // FIXME: We might want to preserve <string>, but currently Gecko + // stores both of <custom-ident> and <string> into nsAtom, so + // we can't tell it. + KeyframesName::Ident(CustomIdent(atom)) + } + /// The name as an Atom pub fn as_atom(&self) -> &Atom { match *self { diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 8e5751c5c89..e41ff305d59 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -3625,14 +3625,14 @@ fn fill_in_missing_keyframe_values( #[no_mangle] pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetBorrowed, - name: *const nsACString, + name: *mut nsAtom, inherited_timing_function: nsTimingFunctionBorrowed, keyframes: RawGeckoKeyframeListBorrowedMut) -> bool { debug_assert!(keyframes.len() == 0, "keyframes should be initially empty"); let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); - let name = unsafe { Atom::from(name.as_ref().unwrap().as_str_unchecked()) }; + let name = Atom::from(name); let animation = match data.stylist.get_animation(&name) { Some(animation) => animation, |