From 6331dfc3e18e169f05d220e01e5db6cdbf19d203 Mon Sep 17 00:00:00 2001 From: itozyun Date: Thu, 10 Jul 2014 14:47:48 +0900 Subject: [PATCH] Version 0.6.52, fix X.UI. --- 0.6.x/js/core/00_builtin.js | 40 ++++++++++++++++++++++++++++++++-------- 0.6.x/js/dom/12_XDomEvent.js | 4 ++-- 0.6.x/js/ui/06_AbstractUINode.js | 22 ++++++++++++++-------- 0.6.x/js/ui/20_PageRoot.js | 26 +++++++++++++------------- 4 files changed, 61 insertions(+), 31 deletions(-) diff --git a/0.6.x/js/core/00_builtin.js b/0.6.x/js/core/00_builtin.js index e49582f..496c533 100644 --- a/0.6.x/js/core/00_builtin.js +++ b/0.6.x/js/core/00_builtin.js @@ -228,7 +228,7 @@ Object.prototype.hasOwnProperty || (Object.prototype.hasOwnProperty = function( var proto = this.constructor && this.constructor.prototype, __p__ = proto && proto.__proto__, v = this[ p ], - r = false; + r = false; if( __p__ ) proto.__proto__ = null; @@ -236,24 +236,48 @@ Object.prototype.hasOwnProperty || (Object.prototype.hasOwnProperty = function( if( v !== v ){ if( proto && ( p in proto ) && proto[ p ] !== proto[ p ] ){ // proto[ p ] is NaN proto[ p ] = 0; // different value - r = this[ p ] !== this[ p ]; // isNaN - proto[ p ] = v; // proto で定義されていた. + r = this[ p ] !== this[ p ]; // isNaN? + proto[ p ] = v; // set NaN } else { r = true; }; } else - if( !proto || !( p in proto ) || ( proto[ p ] !== v ) ){ - r = true; - } else { + if( proto && p in proto && proto[ p ] === v ){ // this と proto に同名で同値が書かれている可能性あり proto[ p ] = v + ' '; // different value r = v === this[ p ]; - proto[ p ] = v; + } else { + r = true; + }; + }; + + if( __p__ ) proto.__proto__ = __p__; + + return r; + }); */ +/* +Object.prototype.hasOwnProperty || (Object.prototype.hasOwnProperty = function( p ){ + var proto = this.constructor && this.constructor.prototype, + __p__ = proto && proto.__proto__, + v = this[ p ], + isNaN = v !== v; + r = false; + + if( __p__ ) proto.__proto__ = null; + + if( p in this ){ + if( proto && p in proto && ( proto[ p ] === v ) ^ isNaN ){ //true + false, false + true + // this と proto に同名で同値が書かれている可能性あり + proto[ p ] = v + ' '; // different value + r = ( v === this[ p ] ) ^ isNaN; // true + false, false + true + proto[ p ] = v; + } else { + r = true; }; }; if( __p__ ) proto.__proto__ = __p__; return r; - });*/ + }); */ \ No newline at end of file diff --git a/0.6.x/js/dom/12_XDomEvent.js b/0.6.x/js/dom/12_XDomEvent.js index 1ec779c..145054e 100644 --- a/0.6.x/js/dom/12_XDomEvent.js +++ b/0.6.x/js/dom/12_XDomEvent.js @@ -217,7 +217,7 @@ X.Dom.Node.prototype._addEvent = raw.addEventListener( type, this._handleEvent, false ); }; }) : - X.Dom.EVENT_W3C && ( X.UA.Opera7 || X.UA.NetFront ) ? + X.Dom.EVENT_W3C && X.UA.Opera7 ? (function( type ){ var raw = this._rawNode; if( !raw ) return; @@ -272,7 +272,7 @@ X.Dom.Node.prototype._removeEvent = delete this._handleEvent; }; }) : - X.Dom.EVENT_W3C && ( X.UA.Opera7 || X.UA.NetFront ) ? + X.Dom.EVENT_W3C && X.UA.Opera7 ? (function( type ){ var raw = this._rawNode; if( !raw ) return; diff --git a/0.6.x/js/ui/06_AbstractUINode.js b/0.6.x/js/ui/06_AbstractUINode.js index 4dcbc02..82a9d65 100644 --- a/0.6.x/js/ui/06_AbstractUINode.js +++ b/0.6.x/js/ui/06_AbstractUINode.js @@ -58,6 +58,7 @@ var _AbstractUINode = X.EventDispatcher.inherits( contentHeight : X.UI.Attr.AUTO, minContentHeight : 0, maxContentHeight : X.UI.Attr.AUTO, + lastContentHeight : -1, constraintW : false, constraintH : false, @@ -577,7 +578,8 @@ var _AbstractUINode = X.EventDispatcher.inherits( case X.UI.Dirty.CONTENT : // コンテンツが変更された case X.UI.Dirty.FONT : // フォントサイズが変更された - delete this.lastContentWidth; + delete this.lastContentWidth; + delete this.lastContentHeight; case X.UI.Dirty.LAYOUT : // レイアウトの再計算が必要 @@ -623,8 +625,10 @@ var _AbstractUINode = X.EventDispatcher.inherits( if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB; if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB; } else { - this.scrollHeight = xnode.height() / xnode._getCharSize() + this.contentT + this.contentB; + this.scrollHeight = h + this.contentT + this.contentB; }; + + this.lastContentHeight = h; } else if( h === X.UI.Attr.AUTO ){ if( w !== this.lastContentWidth ){ @@ -637,13 +641,15 @@ var _AbstractUINode = X.EventDispatcher.inherits( if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB; if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB; } else { - this.scrollWidth = w + this.contentL + this.contentR; - this.scrollHeight = h + this.contentT + this.contentB; + this.contentHeight = this.lastContentHeight = h = + this.lastContentHeight === -1 ? xnode.scrollHeight() / xnode._getCharSize() : this.lastContentHeight; + this.scrollWidth = w + this.contentL + this.contentR; + this.scrollHeight = h + this.contentT + this.contentB; }; } else if( dirty !== X.UI.Dirty.LAYOUT ){ - this.contentWidth = this.lastContentWidth = w; //xnode.width(); - this.contentHeight = xnode.height() / xnode._getCharSize(); + this.contentWidth = this.lastContentWidth = w; //xnode.width(); + this.contentHeight = this.lastContentHeight = xnode.scrollHeight() / xnode._getCharSize(); this.scrollWidth = this.contentWidth + this.contentL + this.contentR; this.scrollHeight = this.contentHeight + this.contentT + this.contentB; } else { @@ -775,7 +781,7 @@ var _AbstractUINode = X.EventDispatcher.inherits( ++counter[ type ]; } else { counter[ type ] = 1; - root.elmMouseCatch.listen( X.UI.Event.IdToName[ type ], eventRellay ); + root.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ type ], eventRellay ); }; }; }; @@ -807,7 +813,7 @@ var _AbstractUINode = X.EventDispatcher.inherits( if( !counter[ type ] ) return this; --counter[ type ]; if( counter[ type ] === 0 ){ - X.Dom.Event.remove( root.elmMouseCatch, X.UI.Event.IdToName[ type ], eventRellay ); + root.xnodeInteractiveLayer.unlisten( X.UI.Event.IdToName[ type ], eventRellay ); delete counter[ type ]; }; }; diff --git a/0.6.x/js/ui/20_PageRoot.js b/0.6.x/js/ui/20_PageRoot.js index c377aad..2a658aa 100644 --- a/0.6.x/js/ui/20_PageRoot.js +++ b/0.6.x/js/ui/20_PageRoot.js @@ -57,16 +57,16 @@ var _PageRoot = _Box.inherits( '_PageRoot', X.Class.FINAL | X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS, { - layout : X.UI.Layout.Canvas, + layout : X.UI.Layout.Canvas, - calcReserved : false, - hoverList : null, - targetNodeData : null, - monopolyNodeData : null, + calcReserved : false, + hoverList : null, + targetNodeData : null, + monopolyNodeData : null, - elmMouseCatch : null, - eventCounter : null, - cursorStyle : null, + xnodeInteractiveLayer : null, + eventCounter : null, + cursorStyle : null, Constructor : function( layout, args ){ this.SuperConstructor( layout, args ); @@ -90,11 +90,11 @@ var _PageRoot = _Box.inherits( addToView : function(){ var counter = this.eventCounter, flg; - // this.elmMouseCatch の前に追加する! + // this.xnodeInteractiveLayer の前に追加する! this.addToParent( X.Dom.Node.root ); - this.elmMouseCatch = X.Dom.Node.root.create( 'div', { + this.xnodeInteractiveLayer = X.Dom.Node.root.create( 'div', { 'class' : 'mouse-operation-catcher', unselectable : 'on' } ); @@ -103,14 +103,14 @@ var _PageRoot = _Box.inherits( // X.Dom.Event.activate, X.Dom.Event.deactivate ? // mouseout, mouseover if( navigator.msPointerEnabled || navigator.pointerEnabled ){ - this.elmMouseCatch.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], eventRellay ); + this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], eventRellay ); if( counter[ X.UI.Event._POINTER_MOVE ] ){ ++counter[ X.UI.Event._POINTER_MOVE ]; } else { counter[ X.UI.Event._POINTER_MOVE ] = 1; }; } else { - this.elmMouseCatch.listen( X.UI.Event.IdToName[ X.UI.Event._MOUSE_MOVE ], eventRellay ); + this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._MOUSE_MOVE ], eventRellay ); if( counter[ X.UI.Event._MOUSE_MOVE ] ){ ++counter[ X.UI.Event._MOUSE_MOVE ]; } else { @@ -159,7 +159,7 @@ var _PageRoot = _Box.inherits( }, _remove : function(){ - this.elmMouseCatch.unlisten(); + this.xnodeInteractiveLayer.unlisten(); _Box.prototype._remove.call( this ); } } -- 2.11.0