Bug 1430014 - Part 3: Add DOMWindowUtils.isOldStyleSystemEnabled. r?xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Fri, 12 Jan 2018 14:04:11 +0800
changeset 720810 e690bba942b4e0f1b44fddb59a28d98d24ad01d9
parent 720809 efc0104f2cccff9fe336ecb92651565f5175bce6
child 720811 f9867ad1fd538a3862f9bcbe9c217e6a0a21c20d
push id95652
push userbmo:cam@mcc.id.au
push dateTue, 16 Jan 2018 09:34:40 +0000
reviewersxidorn
bugs1430014
milestone59.0a1
Bug 1430014 - Part 3: Add DOMWindowUtils.isOldStyleSystemEnabled. r?xidorn MozReview-Commit-ID: 2MWbQzq19Ap
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -4441,16 +4441,27 @@ NS_IMETHODIMP
 nsDOMWindowUtils::GetIsStyledByServo(bool* aStyledByServo)
 {
   nsIDocument* doc = GetDocument();
   *aStyledByServo = doc && doc->IsStyledByServo();
   return NS_OK;
 }
 
 NS_IMETHODIMP
+nsDOMWindowUtils::GetIsOldStyleSystemEnabled(bool* aResult)
+{
+#ifdef MOZ_OLD_STYLE
+  *aResult = true;
+#else
+  *aResult = false;
+#endif
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 nsDOMWindowUtils::AddToStyloBlocklist(const nsACString& aBlockedDomain)
 {
 #ifdef MOZ_STYLO
   nsLayoutUtils::AddToStyloBlocklist(aBlockedDomain);
 #endif
   return NS_OK;
 }
 
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1976,16 +1976,24 @@ interface nsIDOMWindowUtils : nsISupport
   /**
    * Whether the current document is styled by Servo's style engine.
    *
    * This calls nsIDocument::IsStyledByServo().
    */
   readonly attribute boolean isStyledByServo;
 
   /**
+   * Whether the old style system is available.
+   *
+   * This is used to skip some tests that make no sense if we only have
+   * Servo's style system.
+   */
+  readonly attribute boolean isOldStyleSystemEnabled;
+
+  /**
    * Add a domain to the existing stylo blocklist.
    *
    * This calls nsLayoutUtils::AddToStyloBlocklist().
    */
   void addToStyloBlocklist(in ACString aBlockedDomain);
 
   /**
    * Remove a domain from the existing stylo blocklist.