Bug 1374881 Part 1: Implement nsDOMWindowUtils::GetUnanimatedComputedStyle for servo. draft
authorBrad Werth <bwerth@mozilla.com>
Tue, 18 Jul 2017 17:34:45 -0700
changeset 613243 a225fb5fdfb42d5b0df8b41b36e2bc7da8eb3c07
parent 613242 dbd91694246bbc1c2a70c4276513f6ae3df6a119
child 638644 0534bdcd7f7b8489eb2f2578d07f5b8e87712660
push id69764
push userbwerth@mozilla.com
push dateFri, 21 Jul 2017 19:37:21 +0000
bugs1374881
milestone56.0a1
Bug 1374881 Part 1: Implement nsDOMWindowUtils::GetUnanimatedComputedStyle for servo. MozReview-Commit-ID: 7tXAAbvWvU8
dom/base/nsDOMWindowUtils.cpp
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2895,24 +2895,28 @@ nsDOMWindowUtils::GetUnanimatedComputedS
     return NS_ERROR_FAILURE;
   }
 
   nsIAtom* pseudo = nsCSSPseudoElements::GetPseudoAtom(aPseudoElement);
   RefPtr<nsStyleContext> styleContext =
     nsComputedDOMStyle::GetUnanimatedStyleContextNoFlush(element,
                                                          pseudo, shell);
 
-  // We will support Servo in bug 1311257.
-  if (shell->StyleSet()->IsServo()) {
-    return NS_ERROR_NOT_IMPLEMENTED;
+  if (styleContext->IsServo()) {
+    RefPtr<RawServoAnimationValue> value =
+      Servo_ComputedValues_ExtractAnimationValue(styleContext->AsServo(),
+                                                 propertyID).Consume();
+    Servo_AnimationValue_Serialize(value, propertyID, &aResult);
+    return NS_OK;
   }
 
   StyleAnimationValue computedValue;
   if (!StyleAnimationValue::ExtractComputedValue(propertyID,
-                                                 styleContext, computedValue)) {
+                                                 styleContext,
+                                                 computedValue)) {
     return NS_ERROR_FAILURE;
   }
 
   // Note: ExtractComputedValue can return 'unset', 'initial', or 'inherit' in
   // its "computedValue" outparam, even though these technically aren't valid
   // computed values. (It has this behavior for discretely-animatable
   // properties, e.g. 'align-content', when these keywords are explicitly
   // specified or when there is no specified value.)  But we need to return a