ライブラリ更新
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3978 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
df8aa6f26a
commit
2887b8531e
@ -41,12 +41,22 @@
|
|||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
var rect = aNode.getBoundingClientRect();
|
var rect = aNode.getBoundingClientRect();
|
||||||
|
var style = this._getComputedStyle(aNode);
|
||||||
var frame = aNode.ownerDocument.defaultView;
|
var frame = aNode.ownerDocument.defaultView;
|
||||||
box.x = rect.left + frame.scrollX;
|
|
||||||
box.y = rect.top + frame.scrollY;
|
// "x" and "y" are offset positions of the "padding-box" from the document top-left edge.
|
||||||
|
box.x = rect.left + this._getPropertyPixelValue(style, 'border-left-width');
|
||||||
|
box.y = rect.top + this._getPropertyPixelValue(style, 'border-top-width');
|
||||||
|
if (style.getPropertyValue('position') != 'fixed') {
|
||||||
|
box.x += frame.scrollX;
|
||||||
|
box.y += frame.scrollY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "width" and "height" are sizes of the "border-box".
|
||||||
box.width = rect.right-rect.left;
|
box.width = rect.right-rect.left;
|
||||||
box.height = rect.bottom-rect.top;
|
box.height = rect.bottom-rect.top;
|
||||||
|
|
||||||
|
// "screenX" and "screenY" are absolute positions of the "border-box".
|
||||||
box.screenX = rect.left;
|
box.screenX = rect.left;
|
||||||
box.screenY = rect.top;
|
box.screenY = rect.top;
|
||||||
var owner = aNode;
|
var owner = aNode;
|
||||||
@ -54,6 +64,11 @@
|
|||||||
{
|
{
|
||||||
frame = owner.ownerDocument.defaultView;
|
frame = owner.ownerDocument.defaultView;
|
||||||
owner = this._getFrameOwnerFromFrame(frame);
|
owner = this._getFrameOwnerFromFrame(frame);
|
||||||
|
|
||||||
|
let style = this._getComputedStyle(owner);
|
||||||
|
box.screenX += this._getPropertyPixelValue(style, 'border-left-width');
|
||||||
|
box.screenY += this._getPropertyPixelValue(style, 'border-top-width');
|
||||||
|
|
||||||
if (!owner) {
|
if (!owner) {
|
||||||
box.screenX += frame.screenX;
|
box.screenX += frame.screenX;
|
||||||
box.screenY += frame.screenY;
|
box.screenY += frame.screenY;
|
||||||
@ -65,6 +80,7 @@
|
|||||||
box.screenY += ownerBox.screenY;
|
box.screenY += ownerBox.screenY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ownerRect = owner.getBoundingClientRect();
|
let ownerRect = owner.getBoundingClientRect();
|
||||||
box.screenX += ownerRect.left;
|
box.screenX += ownerRect.left;
|
||||||
box.screenY += ownerRect.top;
|
box.screenY += ownerRect.top;
|
||||||
@ -72,9 +88,25 @@
|
|||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let i in box)
|
||||||
|
{
|
||||||
|
box[i] = parseInt(box[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getComputedStyle : function(aNode)
|
||||||
|
{
|
||||||
|
return aNode.ownerDocument.defaultView.getComputedStyle(aNode, null);
|
||||||
|
},
|
||||||
|
|
||||||
|
_getPropertyPixelValue : function(aStyle, aProperty)
|
||||||
|
{
|
||||||
|
return parseInt(aStyle.getPropertyValue(aProperty).replace('px', ''));
|
||||||
|
},
|
||||||
|
|
||||||
_getFrameOwnerFromFrame : function(aFrame)
|
_getFrameOwnerFromFrame : function(aFrame)
|
||||||
{
|
{
|
||||||
var parentItem = aFrame
|
var parentItem = aFrame
|
||||||
|
Loading…
Reference in New Issue
Block a user