Bug 1214398 - Add highlight box to doc body if it is available and set z-index. r=yzen
authorEitan Isaacson <eitan@monotonous.org>
Tue, 13 Oct 2015 14:03:00 +0200
changeset 291171 0deafb482bf8fc1584ebb155abb8eb9b717ef3f9
parent 291170 9af9f4f39b28a5ce903f14995e87ca70b452d2f6
child 291172 1fd3c4dcbd396e84bf5cc6561ae5e411c3af9ce3
push idunknown
push userunknown
push dateunknown
reviewersyzen
bugs1214398
milestone44.0a1
Bug 1214398 - Add highlight box to doc body if it is available and set z-index. r=yzen
accessible/jsat/AccessFu.css
accessible/jsat/AccessFu.jsm
--- a/accessible/jsat/AccessFu.css
+++ b/accessible/jsat/AccessFu.css
@@ -5,16 +5,17 @@
 #virtual-cursor-box {
   position: fixed;
   border: 1px solid orange;
   pointer-events: none;
   display: none;
   border-radius: 2px;
   box-shadow: 1px 1px 1px #444;
   display: none;
+  z-index: 10;
 }
 
 #virtual-cursor-box.show {
   display: block;
 }
 
 #virtual-cursor-box > div {
   border-radius: 1px;
--- a/accessible/jsat/AccessFu.jsm
+++ b/accessible/jsat/AccessFu.jsm
@@ -517,42 +517,45 @@ var Output = {
   },
 
   start: function start() {
     Cu.import('resource://gre/modules/Geometry.jsm');
   },
 
   stop: function stop() {
     if (this.highlightBox) {
-      Utils.win.document.documentElement.removeChild(this.highlightBox.get());
+      let doc = Utils.win.document;
+      (doc.body || doc.documentElement).documentElement.removeChild(
+        this.highlightBox.get());
       delete this.highlightBox;
     }
   },
 
   B2G: function B2G(aDetails) {
     Utils.dispatchChromeEvent('accessibility-output', aDetails);
   },
 
   Visual: function Visual(aDetail, aBrowser) {
     switch (aDetail.eventType) {
       case 'viewport-change':
       case 'vc-change':
       {
         let highlightBox = null;
         if (!this.highlightBox) {
+          let doc = Utils.win.document;
           // Add highlight box
           highlightBox = Utils.win.document.
             createElementNS('http://www.w3.org/1999/xhtml', 'div');
-          Utils.win.document.documentElement.appendChild(highlightBox);
+          let parent = doc.body || doc.documentElement;
+          parent.appendChild(highlightBox);
           highlightBox.id = 'virtual-cursor-box';
 
           // Add highlight inset for inner shadow
           highlightBox.appendChild(
-            Utils.win.document.createElementNS(
-              'http://www.w3.org/1999/xhtml', 'div'));
+            doc.createElementNS('http://www.w3.org/1999/xhtml', 'div'));
 
           this.highlightBox = Cu.getWeakReference(highlightBox);
         } else {
           highlightBox = this.highlightBox.get();
         }
 
         let padding = aDetail.padding;
         let r = AccessFu.adjustContentBounds(aDetail.bounds, aBrowser, true);