7 boxSizingEnabled : false,
\r
9 // TODO: offsetLeft, offsetTop の基準位置
\r
16 X.Dom.listenOnce( X.Dom.Event.DOM_INIT, function(){
\r
18 var node = Node._systemNode;
\r
19 node.cssText( 'width:10px;padding:1px;border:2px solid #0;margin:4px;' );
\r
21 X.Dom.BoxModel.defaultBoxModel = node.width() === 10 ?
\r
22 X.Dom.BoxModel.BORDER_BOX :
\r
23 X.Dom.BoxModel.CONTENT_BOX;
\r
25 if( X.Dom.BoxModel.defaultBoxModel === X.Dom.BoxModel.CONTENT_BOX ){
\r
26 X.Dom.BoxModel.boxSizingEnabled = node.cssText( 'width:10px;padding:1px;border:2px solid #0;margin:4px;' +
\r
27 '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
35 node.cssText( 'width:90px;height:90px;overflow:auto;' )
\r
36 .html( '<div style="width:100px;height:100px;"></div>' )
\r
39 X.Dom.BoxModel.vScrollbarSize = 90 - node._rawNode.clientWidth;
\r
40 X.Dom.BoxModel.hScrollbarSize = 90 - node._rawNode.clientHeight;
\r
42 X.Dom.BoxModel.absoluteOffset =
\r
43 node.cssText( 'position:absolute;top:0;left:0;margin:1px;border:2px solid #000;padding:4px;' )
\r
44 .firstChild().cssText( 'position:absolute;top:8px;left:8px;margin:16px;border:32px solid #666;padding:64px;' )
\r
47 node.cssText( '' ).empty();
\r
50 /* --------------------------------------
\r
52 * display:blobk かつ overflow:hidden かつ size(px,em)が設定されていたら、再描画しないでその値を返す
\r
56 * getBoundingClientRect
\r
58 Node.prototype.width = function(){
\r
59 if( !this.parent ){// todo : _state で tree に所属しているか?判定
\r
60 console.log( 'xnode.width() : no parent' );
\r
63 Node.root._updateTimerID && Node.root._startUpdate();
\r
65 console.log( 'xnode.width() : not belong tree.' );
\r
68 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
69 if( X.Dom.DOM_W3C ){
\r
70 // this.css( X.Dom.Style.Unit.px, 'width' );
\r
71 return this._rawNode.offsetWidth;
\r
73 if( X.Dom.DOM_IE4 ){
\r
74 return ( this._rawNode || this._ie4getRawNode() ).offsetWidth;
\r
80 Node.prototype.height = function(){
\r
82 console.log( 'xnode.height() : no parent' );
\r
85 Node.root._updateTimerID && Node.root._startUpdate();
\r
87 console.log( 'xnode.height() : not belong tree.' );
\r
90 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
91 if( X.Dom.DOM_W3C ){
\r
92 // this.css( X.Dom.Style.Unit.px, 'height' );
\r
93 return this._rawNode.offsetHeight;
\r
95 if( X.Dom.DOM_IE4 ){
\r
96 return ( this._rawNode || this._ie4getRawNode() ).offsetHeight;
\r
102 Node.prototype.scrollWidth = function(){
\r
103 if( !this.parent ){// todo : _state で tree に所属しているか?判定
\r
104 console.log( 'xnode.width() : no parent' );
\r
107 Node.root._updateTimerID && Node.root._startUpdate();
\r
109 console.log( 'xnode.width() : not belong tree.' );
\r
112 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
113 if( X.Dom.DOM_W3C ){
\r
114 // this.css( X.Dom.Style.Unit.px, 'width' );
\r
115 return this._rawNode.scrollWidth;
\r
117 if( X.Dom.DOM_IE4 ){
\r
118 return ( this._rawNode || this._ie4getRawNode() ).scrollWidth;
\r
124 Node.prototype.scrollHeight = function(){
\r
125 if( !this.parent ){
\r
126 console.log( 'xnode.height() : no parent' );
\r
129 Node.root._updateTimerID && Node.root._startUpdate();
\r
131 console.log( 'xnode.height() : not belong tree.' );
\r
134 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
135 if( X.Dom.DOM_W3C ){
\r
136 // this.css( X.Dom.Style.Unit.px, 'height' );
\r
137 return this._rawNode.scrollHeight;
\r
139 if( X.Dom.DOM_IE4 ){
\r
140 return ( this._rawNode || this._ie4getRawNode() ).scollHeight;
\r
146 Node.prototype.scrollLeft = function(){
\r
147 if( !this.parent ){// todo : _state で tree に所属しているか?判定
\r
148 console.log( 'xnode.scrollLeft() : no parent' );
\r
151 Node.root._updateTimerID && Node.root._startUpdate();
\r
153 console.log( 'xnode.scrollLeft() : not belong tree.' );
\r
156 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
157 if( X.Dom.DOM_W3C ){
\r
158 // this.css( X.Dom.Style.Unit.px, 'width' );
\r
159 return this._rawNode.scrollLeft;
\r
161 if( X.Dom.DOM_IE4 ){
\r
162 return ( this._rawNode || this._ie4getRawNode() ).scrollLeft;
\r
168 Node.prototype.scrollTop = function(){
\r
169 if( !this.parent ){// todo : _state で tree に所属しているか?判定
\r
170 console.log( 'xnode.scrollTop() : no parent' );
\r
173 Node.root._updateTimerID && Node.root._startUpdate();
\r
175 console.log( 'xnode.scrollTop() : not belong tree.' );
\r
178 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
179 if( X.Dom.DOM_W3C ){
\r
180 // this.css( X.Dom.Style.Unit.px, 'width' );
\r
181 return this._rawNode.scrollTop;
\r
183 if( X.Dom.DOM_IE4 ){
\r
184 return ( this._rawNode || this._ie4getRawNode() ).scrollTop;
\r
190 /* --------------------------------------
\r
192 * position:absolute かつ x か y が設定されていたら、再描画しないで css オブジェクトから計算した値を返す。 float は?
\r
193 * position:absolute の指定で自動で top,left を補う必要あり? -> X.Dom.Style
\r
194 * 親要素 border 外側からの値。 IE, Firefox, Safari, Chrome の offsetLeft/Topでは、border 内側なので補正する。
\r
195 * transformX, Y は加える? アニメーション中は?
\r
197 // X.Dom.Style.transform,
\r
198 Node.prototype.x = function(){
\r
199 if( !this.parent ){
\r
200 console.log( 'xnode.x() : no parent' );
\r
203 Node.root._updateTimerID && Node.root._startUpdate();
\r
205 console.log( 'xnode.x() : not belong tree.' );
\r
208 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
209 if( X.Dom.DOM_W3C ){
\r
210 // this.css( X.Dom.Style.Unit.px, 'left' );
\r
211 // this.css( X.Dom.Style.Unit.px, 'translateX' );
\r
212 return this._rawNode.offsetLeft;
\r
214 if( X.Dom.DOM_IE4 ){
\r
215 return ( this._rawNode || this._ie4getRawNode() ).offsetLeft;
\r
221 Node.prototype.y = function(){
\r
222 if( !this.parent ){
\r
223 console.log( 'xnode.y() : no parent' );
\r
226 Node.root._updateTimerID && Node.root._startUpdate();
\r
228 console.log( 'xnode.y() : not belong tree.' );
\r
231 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
232 if( X.Dom.DOM_W3C ){
\r
233 // this.css( X.Dom.Style.Unit.px, 'top' );
\r
234 // this.css( X.Dom.Style.Unit.px, 'transisitonY' );
\r
235 return this._rawNode.offsetTop;
\r
237 if( X.Dom.DOM_IE4 ){
\r
238 return ( this._rawNode || this._ie4getRawNode() ).offsetTop;
\r