forked from mirrors/gecko-dev
		
	Bug 1519952, replace calls to boxobject screenX and screenY with the equivalent on XULElement, r=paolo
This commit is contained in:
		
							parent
							
								
									65399694b4
								
							
						
					
					
						commit
						1a628e76c2
					
				
					 22 changed files with 80 additions and 82 deletions
				
			
		|  | @ -30,8 +30,8 @@ | |||
|         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, () => { | ||||
|  |  | |||
|  | @ -4645,7 +4645,7 @@ var XULBrowserWindow = { | |||
|     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() { | ||||
|  |  | |||
|  | @ -630,14 +630,14 @@ | |||
| 
 | ||||
|           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); | ||||
| 
 | ||||
|  | @ -672,11 +672,10 @@ | |||
|             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; | ||||
|  | @ -998,8 +997,8 @@ | |||
|           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; | ||||
|  | @ -1014,11 +1013,11 @@ | |||
|           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; | ||||
|  |  | |||
|  | @ -1057,9 +1057,11 @@ var PanelMultiView = class extends AssociatedToNode { | |||
|     // 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 = {}; | ||||
|  | @ -1070,9 +1072,9 @@ var PanelMultiView = class extends AssociatedToNode { | |||
|     // 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; | ||||
|     } | ||||
|  |  | |||
|  | @ -68,13 +68,12 @@ add_task(async function testPopupSelectPopup() { | |||
|       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.
 | ||||
|  |  | |||
|  | @ -438,10 +438,10 @@ | |||
|         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; | ||||
|  |  | |||
|  | @ -9,14 +9,14 @@ add_task(async function() { | |||
|                       .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; | ||||
|  | @ -48,21 +48,21 @@ add_task(async function() { | |||
|   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
 | ||||
|  | @ -81,13 +81,13 @@ add_task(async function() { | |||
|   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
 | ||||
|  |  | |||
|  | @ -257,9 +257,9 @@ var TestRunner = { | |||
|       } | ||||
| 
 | ||||
|       // 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); | ||||
|  |  | |||
|  | @ -37,8 +37,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1224790 | |||
|     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 | ||||
|  |  | |||
|  | @ -38,8 +38,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1224790 | |||
|     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 | ||||
|  |  | |||
|  | @ -40,10 +40,10 @@ function doTests() | |||
| 
 | ||||
|   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"); | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ | |||
| </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"/> | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| </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"/> | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| </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"/> | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| </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"/> | ||||
|  |  | |||
|  | @ -131,7 +131,7 @@ checkClipRegionNoBounds = function checkClipRegionNoBounds(id, rects) { | |||
| 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?"); | ||||
|  | @ -148,8 +148,8 @@ function loaded() { | |||
|   } | ||||
| 
 | ||||
|   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(); | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| </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"/> | ||||
|  | @ -41,7 +41,7 @@ function checkGeometry(id, x, y, w, h) { | |||
| 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?"); | ||||
|  | @ -56,8 +56,8 @@ function runTests() { | |||
|   } | ||||
| 
 | ||||
|   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 | ||||
|  |  | |||
|  | @ -77,16 +77,16 @@ function openContextMenu() { | |||
|     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); | ||||
|  | @ -94,12 +94,11 @@ function openContextMenu() { | |||
|     } | ||||
| 
 | ||||
|     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) | ||||
|         { | ||||
|  | @ -122,7 +121,7 @@ function openContextMenu() { | |||
| 
 | ||||
|         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 | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ function popupshown() | |||
|   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); | ||||
|  |  | |||
|  | @ -46,21 +46,21 @@ function setScale(win, 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() | ||||
|  | @ -71,13 +71,13 @@ function nextTest() | |||
|   } | ||||
|   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); | ||||
|   } | ||||
|  |  | |||
|  | @ -60,8 +60,7 @@ function nextTest() | |||
|       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": | ||||
|  |  | |||
|  | @ -81,7 +81,7 @@ 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; | ||||
|  | @ -213,7 +213,7 @@ var tests = [ | |||
|       { | ||||
|         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; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Neil Deakin
						Neil Deakin