1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 13:34:13 +01:00
--HG--
extra : rebase_source : 001c7dc9fde0e4e43d9d611b46fa9f6cb30328ff
This commit is contained in:
Kris Maglione
2012-01-03 16:10:25 -05:00
parent 18c560a917
commit a53ce209be

View File

@@ -321,22 +321,26 @@ var DOM = Class("DOM", {
this[0] ? this[0].getBoundingClientRect() : {}, this[0] ? this[0].getBoundingClientRect() : {},
get viewport() { get viewport() {
if (this[0] instanceof Ci.nsIDOMWindow) let node = this[0];
if (node instanceof Ci.nsIDOMDocument)
node = node.defaultView;
if (node instanceof Ci.nsIDOMWindow)
return { return {
get width() this.right - this.left, get width() this.right - this.left,
get height() this.bottom - this.top, get height() this.bottom - this.top,
bottom: this[0].innerHeight, bottom: node.innerHeight,
right: this[0].innerWidth, right: node.innerWidth,
top: 0, left: 0 top: 0, left: 0
}; };
let r = this.rect; let r = this.rect;
return { return {
width: this[0].clientWidth, width: node.clientWidth,
height: this[0].clientHeight, height: node.clientHeight,
top: r.top + this[0].clientTop, top: r.top + node.clientTop,
get bottom() this.top + this.height, get bottom() this.top + this.height,
left: r.left + this[0].clientLeft, left: r.left + node.clientLeft,
get right() this.left + this.width get right() this.left + this.width
} }
}, },