OSDN Git Service

Version 0.6.195, add opacity-fix for IE8.
[pettanr/clientJs.git] / 0.6.x / js / 02_dom / 20_XNode.js
index 2576ae4..cc826b1 100644 (file)
@@ -1381,10 +1381,10 @@ function X_Node_startUpdate( time ){
        };
        
        if( X_Node_html[ '_flags' ] & X_Node_BitMask_IS_DIRTY ){
-               X_Node__commitUpdate( X_Node_html, X_Node_html[ '_rawObject' ].parentNode, null, X_Node_html[ '_flags' ] );
+               X_Node__commitUpdate( X_Node_html, X_Node_html[ '_rawObject' ].parentNode, null, X_Node_html[ '_flags' ], 1 );
        } else {
-               X_Node__commitUpdate( X_Node_head, X_Node_head[ '_rawObject' ].parentNode, null, X_Node_head[ '_flags' ] );
-               X_Node__commitUpdate( X_Node_body, X_Node_body[ '_rawObject' ].parentNode, null, X_Node_body[ '_flags' ] );
+               X_Node__commitUpdate( X_Node_head, X_Node_head[ '_rawObject' ].parentNode, null, X_Node_head[ '_flags' ], 1 );
+               X_Node__commitUpdate( X_Node_body, X_Node_body[ '_rawObject' ].parentNode, null, X_Node_body[ '_flags' ], 1 );
        };
        
        if( X_Node_updateReservedByReleaseGPU ){
@@ -1417,7 +1417,7 @@ function X_Node_startUpdate( time ){
  */
 var X_Node__commitUpdate =
        X_UA_DOM.W3C ?
-               ( function( that, parentElement, nextElement, accumulatedFlags ){
+               ( function( that, parentElement, nextElement, accumulatedFlags, ie8opacity ){
                        var elm = that[ '_rawObject' ],
                                created, xnodes, l, next;
 
@@ -1432,7 +1432,6 @@ var X_Node__commitUpdate =
                        if( that[ '_flags' ] & X_NodeFlags_GPU_RELEASE_RESERVED ){
                                // console.log( 'GPU 解放 ' );
                                //X_Node_updateReservedByReleaseGPU = true;
-                               //X_Node__updateRawNode( that, elm );
                                that[ '_flags' ] &= X_Node_BitMask_RESET_GPU;
                                //return elm;// TODO もしかしたらこのタイミングで更新できるかも。
                        };
@@ -1550,10 +1549,12 @@ var X_Node__commitUpdate =
                                that[ '_flags' ] |= X_NodeFlags_ACTUAL_LISTENING;
                        };
                        
+                       ie8opacity = ie8opacity * ( that[ '_css' ] && 0 <= that[ '_css' ].opacity ? that[ '_css' ].opacity : 1 );
+                       
                        // 8. 更新の適用
                        if( accumulatedFlags & X_Node_BitMask_IS_DIRTY ){
                                delete that[ '_fontSize' ];
-                               X_Node__updateRawNode( that, elm );
+                               X_Node__updateRawNode( that, elm, ie8opacity, accumulatedFlags );
                        };
 
                        // 9. ie5 only
@@ -1573,7 +1574,7 @@ var X_Node__commitUpdate =
                        // 10. 子要素の更新。
                        if( ( xnodes = that[ '_xnodes' ] ) && ( l = xnodes.length ) ) {
                                for( ; l; ){
-                                       next = X_Node__commitUpdate( xnodes[ --l ], elm, next, accumulatedFlags );
+                                       next = X_Node__commitUpdate( xnodes[ --l ], elm, next, accumulatedFlags, ie8opacity );
                                };
                        };
 
@@ -1688,8 +1689,8 @@ var X_Node__commitUpdate =
  */
 var X_Node__updateRawNode =
        X_UA_DOM.W3C ?
-               ( function( that, elm ){
-                       var attrs, rename, k, v;
+               ( function( that, elm, ie8opacity, accumulatedFlags ){
+                       var attrs, rename, k, v, memory, f;
 
                        // textNode
                        if( !that[ '_tag' ] ){
@@ -1763,6 +1764,20 @@ var X_Node__updateRawNode =
                                delete that[ '_newAttrs' ];
                        };
                        
+                       if( accumulatedFlags & X_NodeFlags_IE8_OPACITY_FIX ){
+                               memory = that[ '_css' ] && that[ '_css' ].opacity;
+                               if( f = true ){
+                                       if( !that[ '_css' ] ) that[ '_css' ] = {};
+                                       that[ '_css' ].opacity = ie8opacity;
+                                       if( that[ '_flags' ] & X_NodeFlags_DIRTY_CSS ){
+                                               that[ '_flags' ] |= X_NodeFlags_OLD_CSSTEXT;
+                                       } else
+                                       if( !( that[ '_flags' ] & X_NodeFlags_DIRTY_IE_FILTER ) ){
+                                               that[ '_flags' ] |= X_NodeFlags_DIRTY_IE_FILTER;
+                                       };
+                               };
+                       };
+                       
                        // style
                        if( that[ '_flags' ] & X_NodeFlags_DIRTY_CSS ){
                                if( that[ '_flags' ] & X_NodeFlags_OLD_CSSTEXT ? X_Node_CSS_objToCssText( that ) : that[ '_cssText' ] ){
@@ -1785,6 +1800,15 @@ var X_Node__updateRawNode =
                                };
                        };
                        
+                       if( f ){
+                               if( 0 <= memory ){
+                                       that[ '_css' ].opacity = memory;
+                               } else {
+                                       delete that[ '_css' ].opacity;
+                                       if( X_Object_isEmpty( that[ '_css' ] ) ) delete that[ '_css' ];
+                               };
+                       };
+                       
                        that[ '_flags' ] &= X_Node_BitMask_RESET_DIRTY;
                }) :
        X_UA_DOM.IE4 ? 
@@ -1959,7 +1983,7 @@ var X_Node__actualRemove =
                                that[ '_listeners' ] && X_EventDispatcher_toggleAllEvents( that, false );// イベントの退避
                                that[ '_flags' ] &= ~X_NodeFlags_ACTUAL_LISTENING;
                        };
-                       
+
                        // ie5では filter の効いている要素をremove時に破棄して、再度append 時に新規生成する
                        // ちなみに elm.filters に触ると ie8 でなぜかカラム落ちが発生、、、
                        if( X_Node_displayNoneFixForIE5 ){
@@ -1979,7 +2003,7 @@ var X_Node__actualRemove =
                                                if( !that[ '_attrs' ] ) that[ '_attrs' ] = {};
                                                that[ '_attrs' ].selectedIndex = elm.selectedIndex;
                                        };
-                                       if( that[ '_tag' ] === 'INPUT' && that._attr && ( that._attr.type === 'checkbox' || that._attr.type === 'radio' ) && ( !that[ '_newAttrs' ] || !X_Object_inObject( 'checked', that[ '_newAttrs' ] ) ) ){
+                                       if( that[ '_tag' ] === 'INPUT' && that[ '_attrs' ] && ( that[ '_attrs' ].type === 'checkbox' || that[ '_attrs' ].type === 'radio' ) && ( !that[ '_newAttrs' ] || !X_Object_inObject( 'checked', that[ '_newAttrs' ] ) ) ){
                                                if( !that[ '_attrs' ] ) that[ '_attrs' ] = {};
                                                that[ '_attrs' ].checked = elm.checked;
                                        };
@@ -2022,7 +2046,7 @@ var X_Node__actualRemove =
                                if( !that[ '_attrs' ] ) that[ '_attrs' ] = {};
                                that[ '_attrs' ].selectedIndex = elm.selectedIndex;
                        };
-                       if( that[ '_tag' ] === 'INPUT' && that._attr && ( that._attr.type === 'checkbox' || that._attr.type === 'radio' ) && ( !that[ '_newAttrs' ] || !X_Object_inObject( 'checked', that[ '_newAttrs' ] ) ) ){
+                       if( that[ '_tag' ] === 'INPUT' && that[ '_attrs' ] && ( that[ '_attrs' ].type === 'checkbox' || that[ '_attrs' ].type === 'radio' ) && ( !that[ '_newAttrs' ] || !X_Object_inObject( 'checked', that[ '_newAttrs' ] ) ) ){
                                if( !that[ '_attrs' ] ) that[ '_attrs' ] = {};
                                that[ '_attrs' ].checked = elm.checked;
                        };