OSDN Git Service

version 0.6.19, working X.UI on async X.Dom.
authoritozyun <itozyun@user.sourceforge.jp>
Sun, 16 Feb 2014 01:59:43 +0000 (10:59 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Sun, 16 Feb 2014 01:59:43 +0000 (10:59 +0900)
0.6.x/js/dom/11_XDomNode.js
0.6.x/js/dom/13_XDomBoxModel.js
0.6.x/js/dom/16_XDomAnime.js
0.6.x/js/ui/PageRoot.js

index 4505d75..e0333c4 100644 (file)
@@ -40,6 +40,8 @@ X.Dom.Node = X.EventDispatcher.inherits(
                _css       : null, // X.Dom.Style\r
                _cssText   : '',\r
                \r
+               _anime     : null,\r
+               \r
                Constructor : function( v ){\r
                        var css, xnodes, xnode, parent, uid = Node._chashe.length;\r
                        \r
@@ -159,24 +161,28 @@ Node._getType = function( v ){
        //if( v.nodeType === 11 ) return Node.IS_DOC_FRAG;\r
        return 0;\r
 };\r
-Node._getXNode = function( node ){\r
-       var uid;\r
-       switch( Node._getType( node ) ){\r
+Node._getXNode = function( v ){\r
+       var uid, i, chashe, xnode;\r
+       switch( Node._getType( v ) ){\r
                case Node.IS_XNODE :\r
                case Node.IS_XNODE_LIST :\r
-                       return node;\r
+                       return v;\r
                case Node.IS_RAW_HTML :\r
-               case Node.IS_RAW_TEXT :\r
                case Node.IS_IMAGE :\r
+                       // fake TextNode too.\r
                        if( X.UA.IE && X.UA.IE < 5 ){\r
-                               uid = node.getAttribute( 'UID' );\r
+                               uid = v.getAttribute( 'UID' );\r
                                return uid && Node._chashe[ uid ];\r
                        };\r
-                       return node.UID && Node._chashe[ node.UID ];\r
+                       return v.UID && Node._chashe[ v.UID ];\r
                case Node.IS_WINDOW :\r
                        return Node._window;\r
                case Node.IS_DOCUMENT :\r
                        return Node._document;\r
+               case Node.IS_RAW_TEXT :\r
+                       for( chashe = Node._chashe, i = chashe.length; i; ){\r
+                               if( ( xnode = Node._chashe[ --i ] ) && ( xnode._rawNode === v ) ) return xnode;\r
+                       };\r
        };\r
 };\r
 \r
@@ -329,6 +335,7 @@ Node.prototype.append = function( v ){
                                if( v._destroyed ) alert( 'xnode already destroyed!' );\r
                                Node._reserveRemoval.splice( i, 1 );\r
                        };\r
+                       break;\r
                default :\r
                        return this;\r
        };\r
@@ -752,15 +759,15 @@ Node.prototype._reserveUpdate = function( child ){
        var root = Node.root;\r
        //if( !root ) return;\r
        //child && ( child._dirty = true );\r
-       if( root && !root._updateReserved ) root._updateReserved = X.Timer.requestFrame( root, root._startUpdate );\r
+       if( root && !root._updateTimerID ) root._updateTimerID = X.Timer.requestFrame( root, root._startUpdate );\r
 };\r
 \r
 Node.prototype._startUpdate = function(){\r
        var removal, i, xnode, tmp;\r
        \r
-       if( this._updateReserved ){\r
-               //X.Timer.cancelFrame( this._updateReserved );\r
-               delete this._updateReserved;\r
+       if( this._updateTimerID ){\r
+               //X.Timer.cancelFrame( this._updateTimerID );\r
+               this._updateTimerID = 0;\r
        } else {\r
                return;\r
        };\r
index 172365a..7219b08 100644 (file)
@@ -37,32 +37,34 @@ X.Dom.listenOnce( X.Dom.Event.DOM_INIT, function(){
  *  overflow:hidden かつ width か height が設定されていたら、再描画しないでその値を返す
  */
 Node.prototype.width = function(){
-       var elm;
-       if( !this.parent ) return 0;
+       if( !this.parent ){
+               console.log( 'xnode.width() : no parent' );
+               return 0;
+       };
+       Node.root._updateTimerID && Node.root._startUpdate();
        if( document.getElementById ){
                // this.css( X.Dom.Style.Unit.px, 'width' );
-               return ( elm = this._rawNode ) ? elm.offsetWidth : 0;
+               return this._rawNode.offsetWidth;
        } else
        if( document.all ){
-               if( !( elm = this._ie4getRawNode() ) ) return 0;
-               Node.root._updateReserved === true && Node.root._startUpdate();
-               return elm.offsetWidth;
+               return ( this._rawNode || this._ie4getRawNode() ).offsetWidth;
        } else {
                
        };
 };
 
 Node.prototype.height = function(){
-       var elm;
-       if( !this.parent ) return 0;
+       if( !this.parent ){
+               console.log( 'xnode.height() : no parent' );
+               return 0;
+       };
+       Node.root._updateTimerID && Node.root._startUpdate();
        if( document.getElementById ){
                // this.css( X.Dom.Style.Unit.px, 'height' );
-               return ( elm = this._rawNode ) ? elm.offsetHeight : 0;
+               return this._rawNode.offsetHeight;
        } else
        if( document.all ){
-               if( !( elm = this._ie4getRawNode() ) ) return 0;
-               Node.root._updateReserved === true && Node.root._startUpdate();
-               return elm.offsetHeight;                
+               return ( this._rawNode || this._ie4getRawNode() ).offsetHeight;
        } else {
                
        };
@@ -77,35 +79,38 @@ Node.prototype.height = function(){
  */
 // X.Dom.Style.transform,
 Node.prototype.x = function(){
-       var elm;
-       if( !this.parent ) return 0;
+       if( !this.parent ){
+               console.log( 'xnode.x() : no parent' );
+               return 0;
+       };
+       Node.root._updateTimerID && Node.root._startUpdate();
        if( document.getElementById ){
                // this.css( X.Dom.Style.Unit.px, 'left' );
                // this.css( X.Dom.Style.Unit.px, 'translateX' );
-               return ( elm = this._rawNode ) ? elm.offsetLeft : 0;
+               return this._rawNode.offsetLeft;
        } else
        if( document.all ){
-               if( !( elm = this._ie4getRawNode() ) ) return 0;
-               Node.root._updateReserved === true && Node.root._startUpdate();
-               return elm.offsetLeft;          
+               return ( this._rawNode || this._ie4getRawNode() ).offsetLeft;
        } else {
                
        };
 };
 
 Node.prototype.y = function(){
-       var elm;
-       if( !this.parent ) return 0;
+       if( !this.parent ){
+               console.log( 'xnode.y() : no parent' );
+               return 0;
+       };
+       Node.root._updateTimerID && Node.root._startUpdate();
        if( document.getElementById ){
                // this.css( X.Dom.Style.Unit.px, 'top' );
                // this.css( X.Dom.Style.Unit.px, 'transisitonY' );
-               return ( elm = this._rawNode ) ? elm.offsetTop : 0;
+               return this._rawNode.offsetTop;
        } else
        if( document.all ){
-               if( !( elm = this._ie4getRawNode() ) ) return 0;
-               Node.root._updateReserved === true && Node.root._startUpdate();
-               return elm.offsetTop;           
+               return ( this._rawNode || this._ie4getRawNode() ).offsetTop;            
        } else {
                
        };
-};
\ No newline at end of file
+};
+
index 82bd2bf..7ad1ec5 100644 (file)
@@ -358,3 +358,5 @@ return {
 };\r
        \r
 })( window, document, navigator, Math );\r
+\r
+\r
index 8b71604..0a7b4b8 100644 (file)
@@ -88,10 +88,12 @@ var _PageRoot = _AbstractDisplayContainer.inherits(
                },
                
                start : function(){
+                       console.log( 'ui start.' )
                        this.initialize( this.User, this, null, null );
                        X.Timer.once( 0, this, this.addToView );
                },
                addToView : function(){
+                       console.log( 'ui add to view.' + X.Dom.Node.root._tag )
                        var     counter = this.eventCounter, flg, elm;
                        
                        // document.body.insertBefore( this.rawElement, elmInteractive );
@@ -101,7 +103,7 @@ var _PageRoot = _AbstractDisplayContainer.inherits(
                        //document.body.appendChild( elm = document.createElement( 'div' ) );
                        
                        elm = X.Dom.Node.root.create( 'div', {
-                               className    : 'mouse-operation-catcher',
+                               'class'      : 'mouse-operation-catcher',
                                unselectable : 'on'
                        } );