Bug 1305325 - Part 5: Add AnimationUtils::IsCoreAPIEnabled. r=birtles
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Sun, 04 Dec 2016 08:07:40 +0900
changeset 325227 2b47c26e76ea4361ebbca32abffb0a4a367c621c
parent 325226 a0406b8c234e82e4b2f983a7f01606a87d798079
child 325228 76b0afbf9a3a704683a1b635670e2b9dbcf18b9b
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbirtles
bugs1305325
milestone53.0a1
Bug 1305325 - Part 5: Add AnimationUtils::IsCoreAPIEnabled. r=birtles To check simulateComputeValuesFailure flag in chrome privilege, we will need to know the core Web Animations API preference is enabled in chrome privilege. MozReview-Commit-ID: GYRMc9Od4Bm
dom/animation/AnimationUtils.cpp
dom/animation/AnimationUtils.h
--- a/dom/animation/AnimationUtils.cpp
+++ b/dom/animation/AnimationUtils.cpp
@@ -59,23 +59,29 @@ AnimationUtils::IsOffscreenThrottlingEna
     Preferences::AddBoolVarCache(&sOffscreenThrottlingEnabled,
                                  "dom.animations.offscreen-throttling");
   }
 
   return sOffscreenThrottlingEnabled;
 }
 
 /* static */ bool
-AnimationUtils::IsCoreAPIEnabledForCaller()
+AnimationUtils::IsCoreAPIEnabled()
 {
   static bool sCoreAPIEnabled;
   static bool sPrefCached = false;
 
   if (!sPrefCached) {
     sPrefCached = true;
     Preferences::AddBoolVarCache(&sCoreAPIEnabled,
                                  "dom.animations-api.core.enabled");
   }
 
-  return sCoreAPIEnabled || nsContentUtils::IsCallerChrome();
+  return sCoreAPIEnabled;
+}
+
+/* static */ bool
+AnimationUtils::IsCoreAPIEnabledForCaller()
+{
+  return IsCoreAPIEnabled() || nsContentUtils::IsCallerChrome();
 }
 
 } // namespace mozilla
--- a/dom/animation/AnimationUtils.h
+++ b/dom/animation/AnimationUtils.h
@@ -58,17 +58,22 @@ public:
   /**
    * Checks if offscreen animation throttling is enabled.
    */
   static bool
   IsOffscreenThrottlingEnabled();
 
   /**
    * Returns true if the preference to enable the core Web Animations API is
+   * true.
+   */
+  static bool IsCoreAPIEnabled();
+
+  /**
+   * Returns true if the preference to enable the core Web Animations API is
    * true or the caller is chrome.
    */
-  static bool
-  IsCoreAPIEnabledForCaller();
+  static bool IsCoreAPIEnabledForCaller();
 };
 
 } // namespace mozilla
 
 #endif