OSDN Git Service

Version 0.6.200, fix X.Node.Anime.
[pettanr/clientJs.git] / 0.6.x / js / 02_dom / 20_XNode.js
index e40f832..ab4e26b 100644 (file)
@@ -781,12 +781,13 @@ function X_Node_remove(){
        
        if( !parent ) return this;
 
-       // TODO anime
        // stop() ->
        if( this[ '_anime' ] && this[ '_anime' ].phase ){
                console.log( 'Animation 中の REMOVE' );
-               this[ 'stop' ]();
+               X_NodeAnime_stopNow( this );
        };
+       // 子孫にアニメーション中の要素が要る
+       // 先祖に GPU 化した要素が要る
 
        delete this.parent;
        parent[ '_xnodes' ].splice( parent[ '_xnodes' ].indexOf( this ), 1 );
@@ -798,7 +799,7 @@ function X_Node_remove(){
                if( X_UA_DOM.IE4 ){
                        if( elm = this[ '_rawObject' ] || X_Node__ie4getRawNode( this ) ){
                                X_Node_reserveRemoval[ X_Node_reserveRemoval.length ] = this;
-                               X_Node_reserveUpdate();                 
+                               X_Node_reserveUpdate();
                        } else
                        if( !this[ '_tag' ] && ( ( parent[ '_flags' ] & X_NodeFlags_IE4_FIXED ) === 0 ) ){
                                parent[ '_flags' ] |= X_NodeFlags_IE4_DIRTY_CHILDREN;
@@ -849,8 +850,6 @@ function X_Node_onKill( that ){
        
        parent && parent[ '_xnodes' ] && parent[ '_xnodes' ].splice( parent[ '_xnodes' ].indexOf( that ), 1 );
 
-       elm = that[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( that );
-
        if( xnodes && ( i = xnodes.length ) ){
                delete that[ '_xnodes' ];
                for( ; i; ){
@@ -861,12 +860,13 @@ function X_Node_onKill( that ){
 
        X_Node_CHASHE[ that[ '_uid' ] ] = null; // array に対して delete X_Node_CHASHE[ uid ] はまずい!
 
-// TODO anime
        if( that[ '_anime' ] && that[ '_anime' ].phase ){
                console.log( 'Animation 中の KILL' );
-               that[ 'stop' ]();
+               X_NodeAnime_stopNow( that );
        };
 
+       elm = that[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( that );
+
 // remove _xnodes
        if( X_UA_DOM.IE4 ){
                if( elm ){
@@ -895,26 +895,15 @@ function X_Node_onKill( that ){
  * @example node.contains( testNode );
  */
 function X_Node_contains( v ){
-       var elm, type, xnodes, i;
+       var xnodes;
        
        if( !v || !this[ '_tag' ] || this === v ) return false;
-       
-       // contains ie4+
-       /*
-       if( ( elm = this[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( this ) ) && document.contains && ( type = X_Node_getType( v ) ) && ( type === X_NodeType_RAW_HTML || type === X_NodeType_RAW_TEXT ) ){
-               return elm.contains( v );
-       }; */
 
-       //if( document.compareDocumentPosition ){
-       //      
-       //};
-       
        xnodes = this[ '_xnodes' ];
        if( !xnodes || !xnodes.length ) return false;
-       if( this === v[ 'parent' ] ) return true; // fast
-       if( xnodes.indexOf( v ) !== -1 ) return true; // fast
-       for( i = xnodes.length; i; ){
-               if( xnodes[ --i ][ 'contains' ]( v ) ) return true;
+
+       while( v = v[ 'parent' ] ){
+               if( this === v ) return true;
        };
        return false;
 };
@@ -1237,6 +1226,17 @@ function X_Node_call( name /*, opt_args... */ ){
                        return this.parent ? X_Node_CSS_getCharSize( this ) : 0;
                case 'inGPU' :
                        return !!( this[ '_flags' ] & ( X_NodeFlags_GPU_NOW | X_NodeFlags_GPU_RELEASE_RESERVED ) );
+               case 'isGPUChild' :
+                       if( this[ '_flags' ] & X_NodeFlags_IN_TREE ){
+                               parent = this;
+                               while( parent = parent.parent ){
+                                       if( parent[ '_flags' ] & ( X_NodeFlags_GPU_NOW | X_NodeFlags_GPU_RELEASE_RESERVED ) ) return true;
+                               };
+                       };
+                       return false;
+               case 'containGPU' :
+                       
+                       return false;
                case 'canAnimateNow' :
                        return ( this[ '_flags' ] & X_NodeFlags_IN_TREE ) && X_NodeAnime_detectWaitAnimation( this, true, true ) === 6;
                case 'animeState' :
@@ -1460,12 +1460,12 @@ var X_Node__commitUpdate =
                                console.log( 'GPU 解放 ' );
                                //X_Node_updateReservedByReleaseGPU = true;
                                that[ '_flags' ] &= X_Node_BitMask_RESET_GPU;
-                               //return elm;// TODO もしかしたらこのタイミングで更新できるかも
+                               //return elm;// このタイミングで更新できるっぽい
                        };
 
                        // 3. GPU予約 -> GPU
                        if( that[ '_flags' ] & X_NodeFlags_GPU_RESERVED ){
-                               // TODO size 取得のための update の場合、GPU化を待つ
+                               // TODO size 取得のための update の場合、GPU化をスキップ
                                that[ '_flags' ] &= X_Node_BitMask_RESET_GPU;
                                that[ '_flags' ] |= X_NodeFlags_GPU_NOW;
                        };
@@ -1518,7 +1518,7 @@ var X_Node__commitUpdate =
                                if( that[ '_flags' ] & X_NodeFlags_IS_SVG ){
                                        elm = document.createElementNS( 'http://www.w3.org/2000/svg', that[ '_tag' ].toLowerCase() );
                                        
-                                       // math http://www.w3.org/1998/Math/MathML
+                                       // TODO math http://www.w3.org/1998/Math/MathML
                                } else {
                                        elm = document.createElement( that[ '_tag' ] );
                                };