Bug 1519952, replace calls to boxobject screenX and screenY with the equivalent on XULElement, r=paolo
authorNeil Deakin <neil@mozilla.com>
Fri, 15 Feb 2019 15:26:17 -0500
changeset 459653 b980d74e702db481501dad76d4705c60062c3b69
parent 459652 41da7f72eb6eb912a702170e912db116195f6beb
child 459654 4414af4d7368360eaee6f416e04e8e444b7a727d
push id35564
push userccoroiu@mozilla.com
push dateSat, 16 Feb 2019 09:37:16 +0000
treeherdermozilla-central@7ab4a0c9980f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1519952
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 1519952, replace calls to boxobject screenX and screenY with the equivalent on XULElement, r=paolo
accessible/tests/crashtests/471493.xul
browser/base/content/browser.js
browser/base/content/tabbrowser.xml
browser/components/customizableui/PanelMultiView.jsm
browser/components/extensions/test/browser/browser_ext_popup_select.js
browser/components/places/content/menu.xml
browser/tools/mozscreenshots/browser_boundingbox.js
browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
dom/tests/mochitest/chrome/test_bug1224790-1.xul
dom/tests/mochitest/chrome/test_bug1224790-2.xul
dom/tests/mochitest/general/test_innerScreen.xul
layout/generic/test/plugin_clipping_helper.xhtml
layout/generic/test/plugin_clipping_helper2.xhtml
layout/generic/test/plugin_clipping_helper_table.xhtml
layout/generic/test/plugin_clipping_helper_transformed.xhtml
layout/generic/test/plugin_clipping_lib.js
layout/generic/test/test_plugin_position.xhtml
toolkit/content/tests/chrome/test_bug624329.xul
toolkit/content/tests/chrome/test_popup_moveToAnchor.xul
toolkit/content/tests/chrome/test_popup_scaled.xul
toolkit/content/tests/chrome/test_popupincontent.xul
toolkit/content/tests/chrome/window_panel.xul
--- a/accessible/tests/crashtests/471493.xul
+++ b/accessible/tests/crashtests/471493.xul
@@ -25,18 +25,18 @@
     }
 
     function doTest()
     {
       var accService = SpecialPowers.Cc["@mozilla.org/accessibilityService;1"].
         getService(SpecialPowers.Ci.nsIAccessibilityService);
 
       var treecol = document.getElementById("col");
-      var x = treecol.boxObject.screenX;
-      var y = treecol.boxObject.screenY;
+      var x = treecol.screenX;
+      var y = treecol.screenY;
 
       var tree = document.getElementById("tree");
       addA11yLoadEvent(accService, () => {
         var treeAcc = accService.getAccessibleFor(tree);
         treeAcc.getChildAtPoint(x + 1, y + 1);
         document.documentElement.removeAttribute("class");
       });
     }
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4640,17 +4640,17 @@ var XULBrowserWindow = {
     }
 
     // The x,y coordinates are relative to the <browser> element using
     // the chrome zoom level.
     let elt = document.getElementById("remoteBrowserTooltip");
     elt.label = tooltip;
     elt.style.direction = direction;
 
-    elt.openPopupAtScreen(browser.boxObject.screenX + x, browser.boxObject.screenY + y, false, null);
+    elt.openPopupAtScreen(browser.screenX + x, browser.screenY + y, false, null);
   },
 
   hideTooltip() {
     let elt = document.getElementById("remoteBrowserTooltip");
     elt.hidePopup();
   },
 
   getTabCount() {
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -625,24 +625,24 @@
           let tabWidth = draggedTab.getBoundingClientRect().width;
           let shiftWidth = tabWidth * movingTabs.length;
           draggedTab._dragData.tabWidth = tabWidth;
 
           // Move the dragged tab based on the mouse position.
 
           let leftTab = tabs[0];
           let rightTab = tabs[tabs.length - 1];
-          let rightMovingTabScreenX = movingTabs[movingTabs.length - 1].boxObject.screenX;
-          let leftMovingTabScreenX = movingTabs[0].boxObject.screenX;
+          let rightMovingTabScreenX = movingTabs[movingTabs.length - 1].screenX;
+          let leftMovingTabScreenX = movingTabs[0].screenX;
           let translateX = screenX - draggedTab._dragData.screenX;
           if (!pinned) {
             translateX += this.arrowScrollbox.scrollbox.scrollLeft - draggedTab._dragData.scrollX;
           }
-          let leftBound = leftTab.boxObject.screenX - leftMovingTabScreenX;
-          let rightBound = (rightTab.boxObject.screenX + rightTab.boxObject.width) -
+          let leftBound = leftTab.screenX - leftMovingTabScreenX;
+          let rightBound = (rightTab.screenX + rightTab.boxObject.width) -
                            (rightMovingTabScreenX + tabWidth);
           translateX = Math.min(Math.max(translateX, leftBound), rightBound);
 
           for (let tab of movingTabs) {
             tab.style.transform = "translateX(" + translateX + "px)";
           }
 
           draggedTab._dragData.translateX = translateX;
@@ -667,21 +667,20 @@
           let oldIndex = "animDropIndex" in draggedTab._dragData ?
                          draggedTab._dragData.animDropIndex : movingTabs[0]._tPos;
           let low = 0;
           let high = tabs.length - 1;
           while (low <= high) {
             let mid = Math.floor((low + high) / 2);
             if (tabs[mid] == draggedTab && ++mid > high)
               break;
-            let boxObject = tabs[mid].boxObject;
-            screenX = boxObject.screenX + getTabShift(tabs[mid], oldIndex);
+            screenX = tabs[mid].screenX + getTabShift(tabs[mid], oldIndex);
             if (screenX > tabCenter) {
               high = mid - 1;
-            } else if (screenX + boxObject.width < tabCenter) {
+            } else if (screenX + tabs[mid].getBoundingClientRect().width < tabCenter) {
               low = mid + 1;
             } else {
               newIndex = tabs[mid]._tPos;
               break;
             }
           }
           if (newIndex >= oldIndex)
             newIndex++;
@@ -993,37 +992,37 @@
 
       <method name="_getDragTargetTab">
         <parameter name="event"/>
         <parameter name="isLink"/>
         <body><![CDATA[
           let tab = event.target.localName == "tab" ? event.target : null;
           if (tab && isLink) {
             let boxObject = tab.boxObject;
-            if (event.screenX < boxObject.screenX + boxObject.width * .25 ||
-                event.screenX > boxObject.screenX + boxObject.width * .75)
+            if (event.screenX < tab.screenX + boxObject.width * .25 ||
+                event.screenX > tab.screenX + boxObject.width * .75)
               return null;
           }
           return tab;
         ]]></body>
       </method>
 
       <method name="_getDropIndex">
         <parameter name="event"/>
         <parameter name="isLink"/>
         <body><![CDATA[
           var tabs = this.children;
           var tab = this._getDragTargetTab(event, isLink);
           if (!RTL_UI) {
             for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
-              if (event.screenX < tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
+              if (event.screenX < tabs[i].screenX + tabs[i].boxObject.width / 2)
                 return i;
           } else {
             for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
-              if (event.screenX > tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
+              if (event.screenX > tabs[i].screenX + tabs[i].boxObject.width / 2)
                 return i;
           }
           return tabs.length;
         ]]></body>
       </method>
 
       <method name="_getDropEffectForTabDrag">
         <parameter name="event"/>
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -1052,32 +1052,34 @@ var PanelMultiView = class extends Assoc
     }
   }
 
   _calculateMaxHeight() {
     // While opening the panel, we have to limit the maximum height of any
     // view based on the space that will be available. We cannot just use
     // window.screen.availTop and availHeight because these may return an
     // incorrect value when the window spans multiple screens.
-    let anchorBox = this._panel.anchorNode.boxObject;
-    let screen = this._screenManager.screenForRect(anchorBox.screenX,
-                                                   anchorBox.screenY,
+    let anchor = this._panel.anchorNode;
+    let anchorBox = anchor.boxObject;
+
+    let screen = this._screenManager.screenForRect(anchor.screenX,
+                                                   anchor.screenY,
                                                    anchorBox.width,
                                                    anchorBox.height);
     let availTop = {}, availHeight = {};
     screen.GetAvailRect({}, availTop, {}, availHeight);
     let cssAvailTop = availTop.value / screen.defaultCSSScaleFactor;
 
     // The distance from the anchor to the available margin of the screen is
     // based on whether the panel will open towards the top or the bottom.
     let maxHeight;
     if (this._panel.alignmentPosition.startsWith("before_")) {
-      maxHeight = anchorBox.screenY - cssAvailTop;
+      maxHeight = anchor.screenY - cssAvailTop;
     } else {
-      let anchorScreenBottom = anchorBox.screenY + anchorBox.height;
+      let anchorScreenBottom = anchor.screenY + anchorBox.height;
       let cssAvailHeight = availHeight.value / screen.defaultCSSScaleFactor;
       maxHeight = cssAvailTop + cssAvailHeight - anchorScreenBottom;
     }
 
     // To go from the maximum height of the panel to the maximum height of
     // the view stack, we need to subtract the height of the arrow and the
     // height of the opposite margin, but we cannot get their actual values
     // because the panel is not visible yet. However, we know that this is
--- a/browser/components/extensions/test/browser/browser_ext_popup_select.js
+++ b/browser/components/extensions/test/browser/browser_ext_popup_select.js
@@ -63,23 +63,22 @@ add_task(async function testPopupSelectP
 
     let elemRect = await ContentTask.spawn(browser, null, async function() {
       let elem = content.document.getElementById("select");
       let r = elem.getBoundingClientRect();
 
       return {left: r.left, bottom: r.bottom};
     });
 
-    let {boxObject} = browser;
     let popupRect = selectPopup.getOuterScreenRect();
 
-    is(Math.floor(boxObject.screenX + elemRect.left), popupRect.left,
+    is(Math.floor(browser.screenX + elemRect.left), popupRect.left,
        "Select popup has the correct x origin");
 
-    is(Math.floor(boxObject.screenY + elemRect.bottom), popupRect.top,
+    is(Math.floor(browser.screenY + elemRect.bottom), popupRect.top,
        "Select popup has the correct y origin");
 
     // Close the select popup before proceeding to the next test.
     const onPopupHidden = BrowserTestUtils.waitForEvent(selectPopup, "popuphidden");
     selectPopup.hidePopup();
     await onPopupHidden;
   }
 
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -433,20 +433,20 @@
           return;
         }
 
         // We should display the drop indicator relative to the arrowscrollbox.
         let scrollbox = this._scrollBox.scrollBoxObject;
         let newMarginTop = 0;
         if (scrollDir == 0) {
           let elt = this.firstElementChild;
-          while (elt && event.screenY > elt.boxObject.screenY +
+          while (elt && event.screenY > elt.screenY +
                                         elt.boxObject.height / 2)
             elt = elt.nextElementSibling;
-          newMarginTop = elt ? elt.boxObject.screenY - scrollbox.screenY :
+          newMarginTop = elt ? elt.screenY - this._scrollBox.screenY :
                                scrollbox.height;
         } else if (scrollDir == 1)
           newMarginTop = scrollbox.height;
 
         // Set the new marginTop based on arrowscrollbox.
         newMarginTop += scrollbox.y - this._scrollBox.boxObject.y;
         this._indicatorBar.firstElementChild.style.marginTop = newMarginTop + "px";
         this._indicatorBar.hidden = false;
--- a/browser/tools/mozscreenshots/browser_boundingbox.js
+++ b/browser/tools/mozscreenshots/browser_boundingbox.js
@@ -4,24 +4,24 @@
 
 "use strict";
 
 add_task(async function() {
   const scale = window.docShell
                       .QueryInterface(Ci.nsIBaseWindow)
                       .devicePixelsPerDesktopPixel;
   let {bounds, rects} = TestRunner._findBoundingBox(["#tabbrowser-tabs"]);
-  let element = document.querySelector("#tabbrowser-tabs");
-  let tabBar = element.ownerDocument.getBoxObjectFor(element);
+  let tabBar = document.querySelector("#tabbrowser-tabs");
+  let tabBarRect = tabBar.getBoundingClientRect();
 
   // Calculate expected values
   let expectedLeft = scale * (tabBar.screenX - TestRunner.croppingPadding);
   let expectedTop = scale * (tabBar.screenY - TestRunner.croppingPadding);
-  let expectedRight = scale * (tabBar.width + TestRunner.croppingPadding * 2) + expectedLeft;
-  let expectedBottom = scale * (tabBar.height + TestRunner.croppingPadding * 2) + expectedTop;
+  let expectedRight = scale * (tabBarRect.width + TestRunner.croppingPadding * 2) + expectedLeft;
+  let expectedBottom = scale * (tabBarRect.height + TestRunner.croppingPadding * 2) + expectedTop;
 
   // Calculate browser region
   let windowLeft = window.screenX * scale;
   let windowTop = window.screenY * scale;
   let windowRight = window.outerWidth * scale + windowLeft;
   let windowBottom = window.outerHeight * scale + windowTop;
 
   // Adjust values based on browser window
@@ -43,31 +43,31 @@ add_task(async function() {
     "Checking _findBoundingBox union.top and rect.top is the same for a single selector");
   is(bounds.bottom, rects[0].bottom,
     "Checking _findBoundingBox union.bottom and rect.bottom is the same for a single selector");
 
   let result = TestRunner._findBoundingBox(["#forward-button", "#TabsToolbar"]);
   bounds = result.bounds;
   rects = result.rects;
 
-  element = document.querySelector("#TabsToolbar");
-  let tabToolbar = element.ownerDocument.getBoxObjectFor(element);
-  element = document.querySelector("#forward-button");
-  let fButton = element.ownerDocument.getBoxObjectFor(element);
+  let tabToolbar = document.querySelector("#TabsToolbar");
+  let tabToolbarRect = tabToolbar.getBoundingClientRect();
+  let fButton = document.querySelector("#forward-button");
+  let fButtonRect = fButton.getBoundingClientRect();
 
   // Calculate expected values
   expectedLeft = scale * (Math.min(tabToolbar.screenX, fButton.screenX)
                               - TestRunner.croppingPadding);
   expectedTop = scale * (Math.min(tabToolbar.screenY, fButton.screenY)
                               - TestRunner.croppingPadding);
-  expectedRight = scale * (Math.max(tabToolbar.width + tabToolbar.screenX,
-                                    fButton.width + fButton.screenX)
+  expectedRight = scale * (Math.max(tabToolbarRect.width + tabToolbar.screenX,
+                                    fButtonRect.width + fButton.screenX)
                               + TestRunner.croppingPadding);
-  expectedBottom = scale * (Math.max(tabToolbar.height + tabToolbar.screenY,
-                                     fButton.height + fButton.screenY)
+  expectedBottom = scale * (Math.max(tabToolbarRect.height + tabToolbar.screenY,
+                                     fButtonRect.height + fButton.screenY)
                               + TestRunner.croppingPadding );
 
   // Adjust values based on browser window
   expectedLeft = Math.max(expectedLeft, windowLeft);
   expectedTop = Math.max(expectedTop, windowTop);
   expectedRight = Math.min(expectedRight, windowRight);
   expectedBottom = Math.min(expectedBottom, windowBottom);
 
@@ -76,23 +76,23 @@ add_task(async function() {
      "Checking _findBoundingBox union width calculation");
   // Check height calculation on union
   is(bounds.height, expectedBottom - expectedTop,
      "Checking _findBoundingBox union height calculation");
   // Check single selector's left position
   is(rects[0].left, Math.max(scale * (fButton.screenX - TestRunner.croppingPadding), windowLeft),
     "Checking single selector's left position when _findBoundingBox has multiple selectors");
   // Check single selector's right position
-  is(rects[0].right, Math.min(scale * (fButton.width + fButton.screenX + TestRunner.croppingPadding), windowRight),
+  is(rects[0].right, Math.min(scale * (fButtonRect.width + fButton.screenX + TestRunner.croppingPadding), windowRight),
     "Checking single selector's right position when _findBoundingBox has multiple selectors");
   // Check single selector's top position
   is(rects[0].top, Math.max(scale * (fButton.screenY - TestRunner.croppingPadding), windowTop),
     "Checking single selector's top position when _findBoundingBox has multiple selectors");
   // Check single selector's bottom position
-  is(rects[0].bottom, Math.min(scale * (fButton.height + fButton.screenY + TestRunner.croppingPadding), windowBottom),
+  is(rects[0].bottom, Math.min(scale * (fButtonRect.height + fButton.screenY + TestRunner.croppingPadding), windowBottom),
     "Checking single selector's bottom position when _findBoundingBox has multiple selectors");
 
     // Check that nonexistent selectors throws an exception
   Assert.throws(() => {
     TestRunner._findBoundingBox(["#does_not_exist"]);
   }, /No element for '#does_not_exist' found/, "Checking that nonexistent selectors throws an exception");
 
   // Check that no selectors throws an exception
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
@@ -252,19 +252,19 @@ var TestRunner = {
         element = browserWindow.document.querySelector(selector);
       }
 
       if (!element) {
         throw `No element for '${selector}' found.`;
       }
 
       // Calculate box region, convert to Rect
-      let box = element.ownerDocument.getBoxObjectFor(element);
-      let rect = new Rect(box.screenX * scale, box.screenY * scale,
-                             box.width * scale, box.height * scale);
+      let elementRect = element.getBoundingClientRect();
+      let rect = new Rect(element.screenX * scale, element.screenY * scale,
+                             elementRect.width * scale, elementRect.height * scale);
       rect.inflateFixed(this.croppingPadding * scale);
       rect.left = Math.max(rect.left, windowLeft);
       rect.top = Math.max(rect.top, windowTop);
       rect.right = Math.min(rect.right, windowLeft + windowWidth);
       rect.bottom = Math.min(rect.bottom, windowTop + windowHeight);
       rects.push(rect);
 
       if (!bounds) {
--- a/dom/tests/mochitest/chrome/test_bug1224790-1.xul
+++ b/dom/tests/mochitest/chrome/test_bug1224790-1.xul
@@ -32,18 +32,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   var timer = null;
   function gotFocus() {
     var button = document.getElementById('button');
     synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
     function click() {
       // The bug is not reproducible with synthesizeMouseAtCenter.
       // Need to emulate native mouse event.
-      synthesizeNativeOSXClick(button.boxObject.screenX + button.boxObject.width / 2,
-                               button.boxObject.screenY + button.boxObject.height / 2);
+      synthesizeNativeOSXClick(button.screenX + button.boxObject.width / 2,
+                               button.screenY + button.boxObject.height / 2);
     }
     click();
     // On debug build, it's possible that the click event handler is not
     // triggered by the first click in case the click is dispatched too early
     // before Firefox gets ready for input.
     // Click the button again after 1 sec when we don't get click event.
     timer = setTimeout(click, 1000);
   }
--- a/dom/tests/mochitest/chrome/test_bug1224790-2.xul
+++ b/dom/tests/mochitest/chrome/test_bug1224790-2.xul
@@ -33,18 +33,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   var timer = null;
   function gotFocus() {
     var button = document.getElementById('button');
     synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
     function click() {
       // The bug is not reproducible with synthesizeMouseAtCenter.
       // Need to emulate native mouse event.
-      synthesizeNativeOSXClick(button.boxObject.screenX + button.boxObject.width / 2,
-                               button.boxObject.screenY + button.boxObject.height / 2);
+      synthesizeNativeOSXClick(button.screenX + button.boxObject.width / 2,
+                               button.screenY + button.boxObject.height / 2);
     }
     click();
     // On debug build, it's possible that the click event handler is not
     // triggered by the first click in case the click is dispatched too early
     // before Firefox gets ready for input.
     // Click the button again after 1 sec when we don't get click event.
     timer = setTimeout(click, 1000);
   }
--- a/dom/tests/mochitest/general/test_innerScreen.xul
+++ b/dom/tests/mochitest/general/test_innerScreen.xul
@@ -35,20 +35,20 @@ function doTests()
   catch(ex) { }
   ok(!readable, "window pixels per css pixel shouldn't be readable to content");
 
   var domWindowUtils = window.windowUtils;
   var devPxPerCSSPx = domWindowUtils.screenPixelsPerCSSPixel;
 
   is(window.devicePixelRatio, devPxPerCSSPx, "window.devicePixelRatio");
 
-  var windowBO = document.documentElement.boxObject;
-  isRounded(window.mozInnerScreenX*devPxPerCSSPx, windowBO.screenX,
+  var rootElement = document.documentElement;
+  isRounded(window.mozInnerScreenX*devPxPerCSSPx, rootElement.screenX,
             "window screen X");
-  isRounded(window.mozInnerScreenY*devPxPerCSSPx, windowBO.screenY,
+  isRounded(window.mozInnerScreenY*devPxPerCSSPx, rootElement.screenY,
             "window screen Y");
 
   var f = document.getElementById("f");
   var fBounds = f.getBoundingClientRect();
 
   var fshell = f.contentWindow.docShell;
   var fmudv = fshell.contentViewer;
 
--- a/layout/generic/test/plugin_clipping_helper.xhtml
+++ b/layout/generic/test/plugin_clipping_helper.xhtml
@@ -4,17 +4,17 @@
 <head>
   <style>
   embed { width:200px; height:200px; display:block; }
   iframe { border:none; }
   </style>
 </head>
 <body>
 
-<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
+<!-- Use a XUL element here so we can get its screenX/Y -->
 <hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <hbox style="width:100px;"></hbox><hbox id="h2"/>
 </hbox>
 
 <!-- Non-clipped plugin -->
 <embed id="p1" type="application/x-test" wmode="window"
        style="position:absolute; left:300px; top:0"></embed>
--- a/layout/generic/test/plugin_clipping_helper2.xhtml
+++ b/layout/generic/test/plugin_clipping_helper2.xhtml
@@ -3,17 +3,17 @@
 <html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Dynamic Tests">
 <head>
   <style>
   embed { width:300px; height:200px; display:block; }
   </style>
 </head>
 <body>
 
-<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
+<!-- Use a XUL element here so we can get its screenX/Y -->
 <hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <hbox style="width:100px;"></hbox><hbox id="h2"/>
 </hbox>
 
 <div id="d1" style="width:200px; overflow:hidden; position:absolute; top:0; left:0;">
   <embed id="p1" type="application/x-test" wmode="window" style="position:relative"></embed>
 </div>
--- a/layout/generic/test/plugin_clipping_helper_table.xhtml
+++ b/layout/generic/test/plugin_clipping_helper_table.xhtml
@@ -3,17 +3,17 @@
 <html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Plugins and Tables">
 <head>
   <style>
   embed { width:300px; height:200px; display:block; }
   </style>
 </head>
 <body>
 
-<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
+<!-- Use a XUL element here so we can get its screenX/Y -->
 <hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <hbox style="width:100px;"></hbox><hbox id="h2"/>
 </hbox>
 
 <embed id="p1" type="application/x-test" wmode="window"
        style="position:absolute; top:0; left:0;"></embed>
 <table style="width:300px; height:100px; position:absolute; top:100px; left:0; background:white;">
--- a/layout/generic/test/plugin_clipping_helper_transformed.xhtml
+++ b/layout/generic/test/plugin_clipping_helper_transformed.xhtml
@@ -3,17 +3,17 @@
 <html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Plugins in Transforms">
 <head>
   <style>
   embed { width:300px; height:200px; display:block; }
   </style>
 </head>
 <body>
 
-<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
+<!-- Use a XUL element here so we can get its screenX/Y -->
 <hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <hbox style="width:100px;"></hbox><hbox id="h2"/>
 </hbox>
 
 <div style="width:200px; position:absolute; top:0; left:0; -moz-transform:rotate(90deg)">
   <embed id="p1" type="application/x-test" wmode="window"></embed>
 </div>
--- a/layout/generic/test/plugin_clipping_lib.js
+++ b/layout/generic/test/plugin_clipping_lib.js
@@ -126,35 +126,35 @@ checkClipRegionForFrame = function check
 
 checkClipRegionNoBounds = function checkClipRegionNoBounds(id, rects) {
   checkClipRegionWithDoc(document, 0, 0, id, rects, false);
 }
 
 function loaded() {
   var h1 = document.getElementById("h1");
   var h2 = document.getElementById("h2");
-  var hwidth = h2.boxObject.screenX - h1.boxObject.screenX;
+  var hwidth = h2.screenX - h1.screenX;
   if (hwidth != 100) {
     // Maybe it's a DPI issue
     todo(false, "Unexpected DPI?");
     finish();
     window.close();
     return;
   }
 
   if (!document.getElementById("p1").identifierToStringTest) {
     todo(false, "Test plugin not available");
     finish();
     window.close();
     return;
   }
 
   var bounds = h1.getBoundingClientRect();
-  windowFrameX = h1.boxObject.screenX - bounds.left - window.screenX;
-  windowFrameY = h1.boxObject.screenY - bounds.top - window.screenY;
+  windowFrameX = h1.screenX - bounds.left - window.screenX;
+  windowFrameY = h1.screenY - bounds.top - window.screenY;
 
   // Run actual test code
   runTests();
 }
 
 // Need to run 'loaded' after painting is unsuppressed, or we'll set clip
 // regions to empty.  The timeout must be non-zero on X11 so that
 // gtk_container_idle_sizer runs after the GtkSocket gets the plug_window.
--- a/layout/generic/test/test_plugin_position.xhtml
+++ b/layout/generic/test/test_plugin_position.xhtml
@@ -1,17 +1,17 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 <html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Positioning">
 <head>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
 
-<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
+<!-- Use a XUL element here so we can get its screenX/Y -->
 <hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <hbox style="width:100px;"></hbox><hbox id="h2"/>
 </hbox>
 
 <embed id="p" type="application/x-test" width="200" height="200" wmode="window"></embed>
 <embed id="p2" type="application/x-test" wmode="window"
        style="outline:5px solid blue; width:200px; height:200px;
@@ -36,33 +36,33 @@ function checkGeometry(id, x, y, w, h) {
   is(pY, windowFrameY + bounds.top + y, id + " plugin Y");
   is(pWidth, w, id + " plugin width");
   is(pHeight, h, id + " plugin height");
 }
 
 function runTests() {
   var h1 = document.getElementById("h1");
   var h2 = document.getElementById("h2");
-  var hwidth = h2.boxObject.screenX - h1.boxObject.screenX;
+  var hwidth = h2.screenX - h1.screenX;
   if (hwidth != 100) {
     // Maybe it's a DPI issue
     todo(false, "Unexpected DPI?");
     SimpleTest.finish();
     return;
   }
 
   if (!document.getElementById("p").identifierToStringTest) {
     todo(false, "Test plugin not available");
     SimpleTest.finish();
     return;
   }
 
   var bounds = h1.getBoundingClientRect();
-  windowFrameX = h1.boxObject.screenX - bounds.left - window.screenX;
-  windowFrameY = h1.boxObject.screenY - bounds.top - window.screenY;
+  windowFrameX = h1.screenX - bounds.left - window.screenX;
+  windowFrameY = h1.screenY - bounds.top - window.screenY;
 
   checkGeometry("p", 0, 0, 200, 200);
   // This one tests widget positioning in the presence of borders and padding
   checkGeometry("p2", 9, 7, 182, 186);
 
   SimpleTest.finish();
 }
 
--- a/toolkit/content/tests/chrome/test_bug624329.xul
+++ b/toolkit/content/tests/chrome/test_bug624329.xul
@@ -72,39 +72,38 @@ function childResized() {
     openContextMenu();
 }
 
 function openContextMenu() {
     var mouseX = win.innerWidth - 10;
     var mouseY = 10;
 
     menu = win.document.getElementById("menu");
-    var screenX = menu.boxObject.screenX;
-    var screenY = menu.boxObject.screenY;
+    var screenX = menu.screenX;
+    var screenY = menu.screenY;
     var utils = win.windowUtils;
 
     utils.sendMouseEvent("contextmenu", mouseX, mouseY, 2, 0, 0);
 
     var interval = setInterval(checkMoved, 200);
     function checkMoved() {
-        if (menu.boxObject.screenX != screenX ||
-            menu.boxObject.screenY != screenY) {
+        if (menu.screenX != screenX ||
+            menu.screenY != screenY) {
             clearInterval(interval);
             // Wait further to check that the window does not move again.
             setTimeout(checkPosition, 1000);
         }
     }
 
     function checkPosition() {
-        var menubox = menu.boxObject;
-        var winbox = win.document.documentElement.boxObject;
+        var rootElement = win.document.documentElement;
         var platformIsMac = navigator.userAgent.indexOf("Mac") > -1;
 
-        var x = menubox.screenX - winbox.screenX;
-        var y = menubox.screenY - winbox.screenY;
+        var x = menu.screenX - rootElement.screenX;
+        var y = menu.screenY - rootElement.screenY;
 
         if (platformIsMac)
         {
           // This check is alterered slightly for OSX which adds padding to the top
           // and bottom of its context menus. The menu position calculation must
           // be changed to allow for the pointer to be outside this padding
           // when the menu opens.
           // (Bug 1075089)
@@ -117,17 +116,17 @@ function openContextMenu() {
              "menu top " + y + " should be below click point " + mouseY);
         }
         
         ok(y <= mouseY + 20,
            "menu top " + y + " should not be too far below click point " + mouseY);
 
         ok(x < mouseX,
            "menu left " + x + " should be left of click point " + mouseX);
-        var right = x + menubox.width;
+        var right = x + menu.boxObject.width;
 
         if (platformIsMac) {
           // Rather than be constrained by the right hand screen edge, OSX menus flip
           // horizontally and appear to the left of the mouse pointer
           ok(right < mouseX,
              "menu right " + right + " should be left of click point " + mouseX);
         }
         else {
--- a/toolkit/content/tests/chrome/test_popup_moveToAnchor.xul
+++ b/toolkit/content/tests/chrome/test_popup_moveToAnchor.xul
@@ -47,17 +47,17 @@ function popupshown()
   checkCoords(popup, button2rect.left, button2rect.top - popupheight, "move button2");
 
   popup.moveToAnchor($("button1"), "end_before");
   checkCoords(popup, button1rect.right, button1rect.top, "move anchor end_before");
 
   popup.moveToAnchor($("button2"), "after_start", 5, 4);
   checkCoords(popup, button2rect.left + 5, button2rect.bottom + 4, "move button2 left + 5, top + 4");
 
-  popup.moveTo($("button1").boxObject.screenX + 10, $("button1").boxObject.screenY + 12);
+  popup.moveTo($("button1").screenX + 10, $("button1").screenY + 12);
   checkCoords(popup, button1rect.left + 10, button1rect.top + 12, "move to button1 screen with offset");
 
   popup.moveToAnchor($("button1"), "after_start", 1, 2);
   checkCoords(popup, button1rect.left + 1, button1rect.bottom + 2, "move button2 after screen");
 
   popup.hidePopup();
 }
 
--- a/toolkit/content/tests/chrome/test_popup_scaled.xul
+++ b/toolkit/content/tests/chrome/test_popup_scaled.xul
@@ -41,48 +41,48 @@ function runTests()
 function setScale(win, scale)
 {
   var docViewer = win.docShell.contentViewer;
   docViewer.fullZoom = scale;
 }
 
 function shown()
 {
+  var popup = $("popup");
   if (screenTest) {
-    var box = $("popup").boxObject;
-    is(box.screenX, screenx, "screen left position");
-    is(box.screenY, screeny, "screen top position");
+    is(popup.screenX, screenx, "screen left position");
+    is(popup.screenY, screeny, "screen top position");
   }
   else {
     var anchor = $("frame").contentDocument.getElementById("two");
 
     is(Math.round(anchor.getBoundingClientRect().left * 2),
-       Math.round($("popup").getBoundingClientRect().left), "anchored left position");
+       Math.round(popup.getBoundingClientRect().left), "anchored left position");
     is(Math.round(anchor.getBoundingClientRect().bottom * 2),
-       Math.round($("popup").getBoundingClientRect().top), "anchored top position");
+       Math.round(popup.getBoundingClientRect().top), "anchored top position");
   }
 
-  $("popup").hidePopup();
+  popup.hidePopup();
 }
 
 function nextTest()
 {
   if (screenTest) {
     setScale(window, 1);
     SimpleTest.finish();
   }
   else {
     screenTest = true;
-    var box = document.documentElement.boxObject;
+    var rootElement = document.documentElement;
 
     // - the iframe is at 4×, but out here css pixels are only 2× device pixels
     // - the popup manager rounds off (or truncates) the coordinates to
     //   integers, so ensure we pass in even numbers to openPopupAtScreen
-    screenx = (x = even(box.screenX + 120))/2;
-    screeny = (y = even(box.screenY + 120))/2;
+    screenx = (x = even(rootElement.screenX + 120))/2;
+    screeny = (y = even(rootElement.screenY + 120))/2;
     setScale(window, 2);
     $("popup").openPopupAtScreen(x, y);
   }
 }
 
 function even(n)
 {
   return (n % 2) ? n+1 : n;
--- a/toolkit/content/tests/chrome/test_popupincontent.xul
+++ b/toolkit/content/tests/chrome/test_popupincontent.xul
@@ -55,18 +55,17 @@ function nextTest()
       popup.setAttribute("left", "800");
       popup.setAttribute("top", "2900");
       synthesizeMouse(menu, 2, 2, { });
       break;
     case "left and top":
       step = "open near bottom";
       // request that the menu be opened with a target point near the bottom of the window,
       // so that the menu's top margin will push it completely outside the window.
-      var bo = document.documentElement.boxObject;
-      popup.setAttribute("top", bo.screenY + window.innerHeight - 5);
+      popup.setAttribute("top", document.documentElement.screenY + window.innerHeight - 5);
       synthesizeMouse(menu, 2, 2, { });
       break;
     case "open near bottom":
       step = "large menu";
       popup.removeAttribute("left");
       popup.removeAttribute("top");
       for (var i = 0; i < 80; i++)
         menu.appendItem("Test", "");
--- a/toolkit/content/tests/chrome/window_panel.xul
+++ b/toolkit/content/tests/chrome/window_panel.xul
@@ -76,17 +76,17 @@ function popupShowing(event)
 }
 
 var waitSteps = 0;
 function popupShown(event)
 {
   var panel = event.target;
 
   if (waitSteps > 0 && navigator.platform.includes("Linux") &&
-      panel.boxObject.screenY == 210) {
+      panel.screenY == 210) {
     waitSteps--;
     setTimeout(popupShown, 10, event);
     return;
   }
 
   currentTest.result(currentTest.testname + " ", panel);
   panel.hidePopup();
 }
@@ -208,17 +208,17 @@ var tests = [
       ok(screenRect.width >= 120 && screenRect.width <= 140, testname + " screen width");
       ok(screenRect.height >= 40 && screenRect.height <= 80, testname + " screen height");
 
       var gotMouseEvent = false;
       function mouseMoved(event)
       {
         is(event.clientY, panelrect.top + 10,
            "popup clientY");
-        is(event.screenY, panel.boxObject.screenY + 10,
+        is(event.screenY, panel.screenY + 10,
            "popup screenY");
         is(event.originalTarget, panel.firstChild, "popup target");
         gotMouseEvent = true;
       }
 
       panel.addEventListener("mousemove", mouseMoved, true);
       synthesizeMouse(panel, 10, 10, { type: "mousemove" });
       ok(gotMouseEvent, "mouse event on panel");