ライブラリ更新
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3972 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
20964287fd
commit
df8aa6f26a
@ -18,45 +18,6 @@
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
var getFrameOwnerFromFrame = function(aFrame) {
|
||||
var parentItem = aFrame
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.QueryInterface(Ci.nsIDocShellTreeNode)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.parent;
|
||||
var isChrome = parentItem.itemType == parentItem.typeChrome;
|
||||
var parentDocument = parentItem
|
||||
.QueryInterface(Ci.nsIWebNavigation)
|
||||
.document;
|
||||
var nodes = parentDocument.evaluate(
|
||||
'/descendant::*[contains(" frame FRAME iframe IFRAME browser tabbrowser ", concat(" ", local-name(), " "))]',
|
||||
parentDocument,
|
||||
null,
|
||||
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
|
||||
null
|
||||
);
|
||||
for (let i = 0, maxi = nodes.snapshotLength; i < maxi; i++)
|
||||
{
|
||||
let owner = nodes.snapshotItem(i);
|
||||
if (isChrome && owner.wrappedJSObject) owner = owner.wrappedJSObject;
|
||||
if (owner.localName == 'tabbrowser') {
|
||||
let tabs = owner.mTabContainer.childNodes;
|
||||
for (let i = 0, maxi = tabs.length; i < maxi; i++)
|
||||
{
|
||||
let browser = tabs[i].linkedBrowser;
|
||||
if (browser.contentWindow == aFrame)
|
||||
return browser;
|
||||
}
|
||||
}
|
||||
else if (owner.contentWindow == aFrame) {
|
||||
return owner;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
window['piro.sakura.ne.jp'].boxObject = {
|
||||
revision : currentRevision,
|
||||
|
||||
@ -65,6 +26,11 @@
|
||||
if ('getBoxObjectFor' in aNode.ownerDocument)
|
||||
return aNode.ownerDocument.getBoxObjectFor(aNode);
|
||||
|
||||
return this.getBoxObjectFromClientRectFor(aNode);
|
||||
},
|
||||
|
||||
getBoxObjectFromClientRectFor : function(aNode)
|
||||
{
|
||||
var box = {
|
||||
x : 0,
|
||||
y : 0,
|
||||
@ -87,7 +53,7 @@
|
||||
while (true)
|
||||
{
|
||||
frame = owner.ownerDocument.defaultView;
|
||||
owner = getFrameOwnerFromFrame(frame);
|
||||
owner = this._getFrameOwnerFromFrame(frame);
|
||||
if (!owner) {
|
||||
box.screenX += frame.screenX;
|
||||
box.screenY += frame.screenY;
|
||||
@ -107,6 +73,46 @@
|
||||
catch(e) {
|
||||
}
|
||||
return box;
|
||||
},
|
||||
|
||||
_getFrameOwnerFromFrame : function(aFrame)
|
||||
{
|
||||
var parentItem = aFrame
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.QueryInterface(Ci.nsIDocShellTreeNode)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.parent;
|
||||
var isChrome = parentItem.itemType == parentItem.typeChrome;
|
||||
var parentDocument = parentItem
|
||||
.QueryInterface(Ci.nsIWebNavigation)
|
||||
.document;
|
||||
var nodes = parentDocument.evaluate(
|
||||
'/descendant::*[contains(" frame FRAME iframe IFRAME browser tabbrowser ", concat(" ", local-name(), " "))]',
|
||||
parentDocument,
|
||||
null,
|
||||
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
|
||||
null
|
||||
);
|
||||
for (let i = 0, maxi = nodes.snapshotLength; i < maxi; i++)
|
||||
{
|
||||
let owner = nodes.snapshotItem(i);
|
||||
if (isChrome && owner.wrappedJSObject) owner = owner.wrappedJSObject;
|
||||
if (owner.localName == 'tabbrowser') {
|
||||
let tabs = owner.mTabContainer.childNodes;
|
||||
for (let i = 0, maxi = tabs.length; i < maxi; i++)
|
||||
{
|
||||
let browser = tabs[i].linkedBrowser;
|
||||
if (browser.contentWindow == aFrame)
|
||||
return browser;
|
||||
}
|
||||
}
|
||||
else if (owner.contentWindow == aFrame) {
|
||||
return owner;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user