From d9dcc17f9652c597f905d8e30c8d4f2527fdd7b4 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 2 Apr 2009 10:57:00 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9=E3=83=AA?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4028 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/res/boxObject.js | 42 ++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/content/treestyletab/res/boxObject.js b/content/treestyletab/res/boxObject.js index 0d06fe92..3f6b398e 100644 --- a/content/treestyletab/res/boxObject.js +++ b/content/treestyletab/res/boxObject.js @@ -5,7 +5,7 @@ https://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/boxObject.js */ (function() { - const currentRevision = 2; + const currentRevision = 3; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; @@ -16,6 +16,7 @@ return; } + var Cc = Components.classes; var Ci = Components.interfaces; window['piro.sakura.ne.jp'].boxObject = { @@ -65,6 +66,8 @@ screenY : 0 }; try { + var zoom = this.getZoom(aNode.ownerDocument.defaultView); + var rect = aNode.getBoundingClientRect(); if (aUnify) { box.left = rect.left; @@ -89,17 +92,18 @@ box.height = rect.bottom-rect.top; // "screenX" and "screenY" are absolute positions of the "border-box". - box.screenX = rect.left; - box.screenY = rect.top; + box.screenX = rect.left * zoom; + box.screenY = rect.top * zoom; var owner = aNode; while (true) { - frame = owner.ownerDocument.defaultView; owner = this._getFrameOwnerFromFrame(frame); + frame = owner.ownerDocument.defaultView; + zoom = this.getZoom(frame); let style = this._getComputedStyle(owner); - box.screenX += this._getPropertyPixelValue(style, 'border-left-width'); - box.screenY += this._getPropertyPixelValue(style, 'border-top-width'); + box.screenX += this._getPropertyPixelValue(style, 'border-left-width') * zoom; + box.screenY += this._getPropertyPixelValue(style, 'border-top-width') * zoom; if (!owner) { box.screenX += frame.screenX; @@ -114,8 +118,8 @@ } let ownerRect = owner.getBoundingClientRect(); - box.screenX += ownerRect.left; - box.screenY += ownerRect.top; + box.screenX += ownerRect.left * zoom; + box.screenY += ownerRect.top * zoom; } } catch(e) { @@ -177,6 +181,28 @@ } } return null; + }, + + Prefs : Cc['@mozilla.org/preferences;1'] + .getService(Ci.nsIPrefBranch) + .QueryInterface(Ci.nsIPrefBranch2), + + getZoom : function(aFrame) + { + try { + if (!this.Prefs.getBoolPref('browser.zoom.full')) + return 1; + } + catch(e) { + return 1; + } + var markupDocumentViewer = aFrame.top + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .contentViewer + .QueryInterface(Ci.nsIMarkupDocumentViewer); + return markupDocumentViewer.fullZoom; } };