OLD | NEW |
1 /* | 1 /* |
2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
5 */ | 5 */ |
6 | 6 |
7 let {Prefs} = require("prefs"); | 7 let {Prefs} = require("prefs"); |
8 | 8 |
9 // Make sure to stop selection when we are uninstalled | 9 // Make sure to stop selection when we are uninstalled |
10 onShutdown.add(function() Aardvark.quit()); | 10 onShutdown.add(function() Aardvark.quit()); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 this.boxElem.parentNode.removeChild(this.boxElem); | 374 this.boxElem.parentNode.removeChild(this.boxElem); |
375 | 375 |
376 if (this.paintNode) | 376 if (this.paintNode) |
377 this.paintNode.removeEventListener("MozAfterPaint", this.onAfterPaint, fal
se); | 377 this.paintNode.removeEventListener("MozAfterPaint", this.onAfterPaint, fal
se); |
378 this.paintNode = null; | 378 this.paintNode = null; |
379 this.prevPos = null; | 379 this.prevPos = null; |
380 }, | 380 }, |
381 | 381 |
382 getWindowSize: function(wnd) | 382 getWindowSize: function(wnd) |
383 { | 383 { |
384 return [wnd.innerWidth, wnd.innerHeight]; | 384 return [wnd.innerWidth, wnd.document.documentElement.clientHeight]; |
385 }, | 385 }, |
386 | 386 |
387 getElementPosition: function(element) | 387 getElementPosition: function(element) |
388 { | 388 { |
389 // Restrict rectangle coordinates by the boundaries of a window's client are
a | 389 // Restrict rectangle coordinates by the boundaries of a window's client are
a |
390 function intersectRect(rect, wnd) | 390 function intersectRect(rect, wnd) |
391 { | 391 { |
392 let [wndWidth, wndHeight] = this.getWindowSize(wnd); | 392 let [wndWidth, wndHeight] = this.getWindowSize(wnd); |
393 rect.left = Math.max(rect.left, 0); | 393 rect.left = Math.max(rect.left, 0); |
394 rect.top = Math.max(rect.top, 0); | 394 rect.top = Math.max(rect.top, 0); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 // Show help box | 724 // Show help box |
725 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft"); | 725 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft"); |
726 return true; | 726 return true; |
727 } | 727 } |
728 } | 728 } |
729 | 729 |
730 // Makes sure event handlers like Aardvark.onKeyPress always have the correct | 730 // Makes sure event handlers like Aardvark.onKeyPress always have the correct |
731 // this pointer set. | 731 // this pointer set. |
732 for each (let method in ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageH
ide", "onMouseMove", "onAfterPaint", "quit"]) | 732 for each (let method in ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageH
ide", "onMouseMove", "onAfterPaint", "quit"]) |
733 Aardvark[method] = Aardvark[method].bind(Aardvark); | 733 Aardvark[method] = Aardvark[method].bind(Aardvark); |
OLD | NEW |