Bug 1334036 - Part 3: Support pseudo for finding properties overriding animatinos. draft
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 17 Feb 2017 02:03:45 +0800
changeset 487074 ee8d3b43a5bee157209daeac062a173852d6b4f3
parent 487073 deeff64faa46daa2397d916fe65ec81b785cf653
child 487075 c07795691a07038597b6612a6cb61e8919eabb2c
push id46122
push userbmo:boris.chiou@gmail.com
push dateMon, 20 Feb 2017 16:08:18 +0000
bugs1334036
milestone54.0a1
Bug 1334036 - Part 3: Support pseudo for finding properties overriding animatinos. MozReview-Commit-ID: BPd1le2mp9e
dom/animation/EffectCompositor.cpp
layout/style/ServoBindingList.h
servo/components/style/gecko_bindings/bindings.rs
servo/ports/geckolib/glue.rs
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -794,16 +794,17 @@ EffectCompositor::GetOverriddenPropertie
 
   if (aStyleContext->PresContext()->RestyleManager()->IsGecko()) {
     nsRuleNode::ComputePropertiesOverridingAnimation(propertiesToTrack,
                                                      aStyleContext,
                                                      aPropertiesOverridden);
   } else {
     MOZ_ASSERT(aElement);
     Servo_GetProperties_Overriding_Animation(aElement,
+                                             aStyleContext->GetPseudo(),
                                              &propertiesToTrack,
                                              &aPropertiesOverridden);
   }
 }
 
 /* static */ void
 EffectCompositor::UpdateCascadeResults(EffectSet& aEffectSet,
                                        Element* aElement,
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -101,17 +101,17 @@ SERVO_BINDING_FUNC(Servo_StyleRule_GetSe
 // Animations API
 SERVO_BINDING_FUNC(Servo_ParseProperty,
                    RawServoDeclarationBlockStrong,
                    const nsACString* property, const nsACString* value,
                    const nsACString* base_url, ThreadSafeURIHolder* base,
                    ThreadSafeURIHolder* referrer,
                    ThreadSafePrincipalHolder* principal)
 SERVO_BINDING_FUNC(Servo_GetProperties_Overriding_Animation, void,
-                   RawGeckoElementBorrowed,
+                   RawGeckoElementBorrowed, nsIAtom*,
                    nsTArrayBorrowed_nsCSSPropertyID,
                    nsCSSPropertyIDSetBorrowedMut)
 
 // AnimationValues handling
 SERVO_BINDING_FUNC(Servo_AnimationValues_Populate, void,
                    RawGeckoAnimationValueListBorrowedMut,
                    RawServoDeclarationBlockBorrowed,
                    ServoComputedValuesBorrowed,
--- a/servo/components/style/gecko_bindings/bindings.rs
+++ b/servo/components/style/gecko_bindings/bindings.rs
@@ -1323,19 +1323,20 @@ extern "C" {
                                base: *mut ThreadSafeURIHolder,
                                referrer: *mut ThreadSafeURIHolder,
                                principal: *mut ThreadSafePrincipalHolder)
      -> RawServoDeclarationBlockStrong;
 }
 extern "C" {
     pub fn Servo_GetProperties_Overriding_Animation(arg1:
                                                         RawGeckoElementBorrowed,
-                                                    arg2:
+                                                    arg2: *mut nsIAtom,
+                                                    arg3:
                                                         nsTArrayBorrowed_nsCSSPropertyID,
-                                                    arg3:
+                                                    arg4:
                                                         nsCSSPropertyIDSetBorrowedMut);
 }
 extern "C" {
     pub fn Servo_AnimationValues_Populate(arg1:
                                               RawGeckoAnimationValueListBorrowedMut,
                                           arg2:
                                               RawServoDeclarationBlockBorrowed,
                                           arg3: ServoComputedValuesBorrowed,
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -796,21 +796,30 @@ pub extern "C" fn Servo_ParseProperty(pr
     Arc::new(RwLock::new(PropertyDeclarationBlock {
         declarations: results,
         important_count: 0,
     })).into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetProperties_Overriding_Animation(element: RawGeckoElementBorrowed,
+                                                           pseudo_tag: *mut nsIAtom,
                                                            list: nsTArrayBorrowed_nsCSSPropertyID,
                                                            set: nsCSSPropertyIDSetBorrowedMut) {
     let element = GeckoElement(element);
     let elementData = element.borrow_data().unwrap();
-    let overridden = elementData.styles().primary.rules.get_properties_overriding_animations();
+    let overridden = if pseudo_tag.is_null() {
+        elementData.styles().primary.rules.get_properties_overriding_animations()
+    } else {
+        let pseudoElement = PseudoElement::from_atom_unchecked(Atom::from(pseudo_tag), false);
+        let pseudoStyle = elementData.styles().pseudos
+                                     .get(&pseudoElement)
+                                     .expect("Should have pseudo style");
+        pseudoStyle.rules.get_properties_overriding_animations()
+    };
 
     for p in list.iter() {
         if overridden.contains(p) {
             unsafe { Gecko_AddPropertyToSet(set, *p) };
         }
     }
 }