Bug 1518487 - ensure that accessible audit can be performed without requiring highlighting. r=pbro
authorYura Zenevich <yura.zenevich@gmail.com>
Tue, 12 Feb 2019 19:39:09 +0000
changeset 458783 f1c16e2af72f
parent 458782 586348ccba9b
child 458784 7fe5ccd66c8f
push id35548
push useropoprus@mozilla.com
push dateWed, 13 Feb 2019 09:48:26 +0000
treeherdermozilla-central@93e37c529818 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1518487
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518487 - ensure that accessible audit can be performed without requiring highlighting. r=pbro MozReview-Commit-ID: CUFTQIS9WPv Differential Revision: https://phabricator.services.mozilla.com/D19048
devtools/server/actors/accessibility/accessible.js
devtools/server/actors/accessibility/walker.js
devtools/shared/specs/accessibility.js
--- a/devtools/server/actors/accessibility/accessible.js
+++ b/devtools/server/actors/accessibility/accessible.js
@@ -383,21 +383,25 @@ const AccessibleActor = ActorClassWithSp
    * Calculate the contrast ratio of the given accessible.
    */
   async _getContrastRatio() {
     if (!this._isValidTextLeaf(this.rawAccessible)) {
       return null;
     }
 
     const { DOMNode: rawNode } = this.rawAccessible;
+    const win = rawNode.ownerGlobal;
+    this.walker.loadTransitionDisablingStyleSheet(win);
     const contrastRatio = await getContrastRatioFor(rawNode.parentNode, {
       bounds: this.bounds,
-      win: rawNode.ownerGlobal,
+      win,
     });
 
+    this.walker.removeTransitionDisablingStyleSheet(win);
+
     return contrastRatio;
   },
 
   /**
    * Audit the state of the accessible object.
    *
    * @return {Object|null}
    *         Audit results for the accessible object.
--- a/devtools/server/actors/accessibility/walker.js
+++ b/devtools/server/actors/accessibility/walker.js
@@ -532,31 +532,21 @@ const AccessibleWalkerActor = ActorClass
 
     this._highlightingAccessible = accessible;
     const { bounds } = accessible;
     if (!bounds) {
       return false;
     }
 
     const { DOMNode: rawNode } = accessible.rawAccessible;
-    const win = rawNode.ownerGlobal;
-    this.loadTransitionDisablingStyleSheet(win);
     const audit = await accessible.audit();
     if (this._highlightingAccessible !== accessible) {
-      if (!this._highlightingAccessible) {
-        // Unhilight might have been called while waiting for audit, remove style sheet
-        // (re-enable transitions) if so.
-        this.removeTransitionDisablingStyleSheet(win);
-      }
-
       return false;
     }
 
-    this.removeTransitionDisablingStyleSheet(win);
-
     const { name, role } = accessible;
     const shown = this.highlighter.show({ rawNode },
                                         { ...options, ...bounds, name, role, audit });
     this._highlightingAccessible = null;
 
     return shown;
   },
 
--- a/devtools/shared/specs/accessibility.js
+++ b/devtools/shared/specs/accessibility.js
@@ -75,16 +75,22 @@ const accessibleSpec = generateActorSpec
     },
     "index-in-parent-change": {
       type: "indexInParentChange",
       indexInParent: Arg(0, "number"),
     },
   },
 
   methods: {
+    audit: {
+      request: {},
+      response: {
+        audit: RetVal("nullable:json"),
+      },
+    },
     children: {
       request: {},
       response: {
         children: RetVal("array:accessible"),
       },
     },
     getRelations: {
       request: {},