hScrollbarSize : 0\r
};\r
\r
+\r
+\r
X.Dom.listenOnce( X.Dom.Event.DOM_INIT, function(){\r
\r
- var node = Node._systemNode;\r
+ var node = Node._systemNode,\r
+ \r
+ // http://jsdo.it/imaya/kTYg\r
+ body = document.body,\r
+ defaultOverflow = document.body.style.overflow,\r
+ width, height;\r
+\r
+ body.style.overflow = 'hidden';\r
+ w = body.clientWidth;\r
+ h = body.clientHeight;\r
+\r
+ body.style.overflow = 'scroll';\r
+ w -= body.clientWidth;\r
+ h -= body.clientHeight;\r
+\r
+ if( !w ) w = body.offsetWidth - body.clientWidth;\r
+ if( !h ) h = body.offsetHeight - body.clientHeight;\r
+ body.style.overflow = defaultOverflow; \r
+\r
+ X.Dom.BoxModel.vScrollbarSize = w;\r
+ X.Dom.BoxModel.hScrollbarSize = h;\r
+ if( h <= 0 ){ // ie6, ie11, firefox で 負の値が返る\r
+ console.log( 'invalid hScrollbarSize: ' + h );\r
+ X.Dom.BoxModel.hScrollbarSize = w;\r
+ };\r
+ //\r
+ \r
node.cssText( 'width:10px;padding:1px;border:2px solid #0;margin:4px;' );\r
\r
X.Dom.BoxModel.defaultBoxModel = node.width() === 10 ?\r
\r
if( X.Dom.BoxModel.defaultBoxModel === X.Dom.BoxModel.CONTENT_BOX ){\r
X.Dom.BoxModel.boxSizingEnabled = node.cssText( 'width:10px;padding:1px;border:2px solid #0;margin:4px;' +\r
- 'box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing: border-box;-o-box-sizing:border-box;-ms-box-sizing:border-box;' )\r
+ 'box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;-ms-box-sizing:border-box;' )\r
.width() === 10;\r
};\r
// padding\r
// margin\r
// top\r
\r
- node.cssText( 'width:90px;height:90px;overflow:auto;' )\r
- .html( '<div style="width:100px;height:100px;"></div>' )\r
- ._startUpdate();\r
- \r
- X.Dom.BoxModel.vScrollbarSize = 90 - node._rawNode.clientWidth;\r
- X.Dom.BoxModel.hScrollbarSize = 90 - node._rawNode.clientHeight;\r
-\r
X.Dom.BoxModel.absoluteOffset =\r
node.cssText( 'position:absolute;top:0;left:0;margin:1px;border:2px solid #000;padding:4px;' )\r
+ .append( '<div></div>' )\r
.firstChild().cssText( 'position:absolute;top:8px;left:8px;margin:16px;border:32px solid #666;padding:64px;' )\r
.y();\r
\r
* Width, Height\r
* display:blobk かつ overflow:hidden かつ size(px,em)が設定されていたら、再描画しないでその値を返す\r
* display:none なら 0\r
+ * \r
+ * getBoxObjectFor\r
+ * getBoundingClientRect\r
*/\r
Node.prototype.width = function(){\r
if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
console.log( 'xnode.width() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.width() : not belong tree.' );\r
return 0;\r
console.log( 'xnode.height() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.height() : not belong tree.' );\r
return 0;\r
console.log( 'xnode.width() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.width() : not belong tree.' );\r
return 0;\r
console.log( 'xnode.height() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.height() : not belong tree.' );\r
return 0;\r
return this._rawNode.scrollHeight;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).scollHeight;\r
+ return ( this._rawNode || this._ie4getRawNode() ).scrollHeight;\r
} else {\r
\r
};\r
console.log( 'xnode.scrollLeft() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.scrollLeft() : not belong tree.' );\r
return 0;\r
console.log( 'xnode.scrollTop() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.scrollTop() : not belong tree.' );\r
return 0;\r
console.log( 'xnode.x() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.x() : not belong tree.' );\r
return 0;\r
console.log( 'xnode.y() : no parent' );\r
return 0;\r
};\r
- Node.root._updateTimerID && Node.root._startUpdate();\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
if( !this._root ){\r
console.log( 'xnode.y() : not belong tree.' );\r
return 0;\r