OSDN Git Service

Version 0.6.141, fix X.UI.ScrollBox.
[pettanr/clientJs.git] / 0.6.x / js / 01_core / 16_XViewPort.js
index a6eddb8..8207644 100644 (file)
@@ -9,7 +9,8 @@ var X_ViewPort_readyState,
        X_ViewPort_vScrollbarSize,
        X_ViewPort_hScrollbarSize,
        
-       X_Dom_detectFontSize = !( X_UA[ 'IE' ] < 9 || X_UA[ 'iOS' ] ) && function(){
+       X_ViewPort_useDetectionLoop = X_UA[ 'IE' ] < 9 || X_UA[ 'iOS' ],
+       X_ViewPort_detectFontSize = !X_ViewPort_useDetectionLoop && function(){
                        var size = X_Node_fontSizeNode[ '_rawObject' ].offsetHeight;
                        if( X_ViewPort_baseFontSize !== size ){
                                X_ViewPort_baseFontSize = size;
@@ -18,7 +19,7 @@ var X_ViewPort_readyState,
        },
 
        X_ViewPort_orientationFlag,     
-       X_Dom_orientationchange = window[ 'orientation' ] !== undefined && function( e ){
+       X_ViewPort_orientationchange = window[ 'orientation' ] !== undefined && function( e ){
                X_ViewPort_orientationFlag = true;
                !X_UA[ 'Android' ] && X_ViewPort_resize();
                //console.log( '-- orientationchange : ' + X[ 'ViewPort' ][ 'getSize' ][ 0 ] + ' ' + X[ 'ViewPort' ][ 'getSize' ][ 1 ] );
@@ -224,7 +225,7 @@ X[ 'ViewPort' ] = {
  */
                var X_ViewPort_resize =
                        // iOS もループで回す,,,iOS3.1.3, iOS6 で確認
-                       X_UA[ 'IE' ] < 9 || X_UA[ 'iOS' ] ?
+                       X_ViewPort_useDetectionLoop ?
                                (function(){
                                        var size;
                                        if( !X_ViewPort_lock ){
@@ -232,7 +233,7 @@ X[ 'ViewPort' ] = {
                                                if( X_ViewPort_width !== size[ 0 ] || X_ViewPort_height !== size[ 1 ] ){
                                                        X_ViewPort_width = size[ 0 ];
                                                        X_ViewPort_height = size[ 1 ];
-                                                       X_Timer_once( 100, X_Dom_detectFinishResizing );
+                                                       X_Timer_once( 100, X_ViewPort_detectFinishResizing );
                                                        X_ViewPort_lock = true;
                                                };
                                        };
@@ -247,16 +248,16 @@ X[ 'ViewPort' ] = {
                                (function( e ){
                                        console.log( '-- resize : ' + X_Timer_now() );
                                        
-                                       !X_ViewPort_lock && ( X_ViewPort_lock = true ) && X_Timer_once( 100, X_Dom_detectFinishResizing );
+                                       !X_ViewPort_lock && ( X_ViewPort_lock = true ) && X_Timer_once( 100, X_ViewPort_detectFinishResizing );
                                        return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION;
                                });
                
-               function X_Dom_detectFinishResizing(){
+               function X_ViewPort_detectFinishResizing(){
                        var size = X_ViewPort_getWindowSize();
                        if( X_ViewPort_width !== size[ 0 ] || X_ViewPort_height !== size[ 1 ] ){
                                X_ViewPort_width  = size[ 0 ];
                                X_ViewPort_height = size[ 1 ];
-                               X_Timer_once( 100, X_Dom_detectFinishResizing );
+                               X_Timer_once( 100, X_ViewPort_detectFinishResizing );
                        } else {
                                console.log( '-- detectFinishResizing : ' + X_Timer_now() );
                                
@@ -293,7 +294,7 @@ X[ 'ViewPort' ] = {
 
                        X_ViewPort_rootElement = document.compatMode !== 'CSS1Compat' ? elmBody : elmHtml || elmBody;
 
-                       html = X[ 'Doc' ][ 'html' ] = X_Node_html = elmHtml && new Node( elmHtml );
+                       html = X[ 'Doc' ][ 'html' ] = X_Node_html = elmHtml && new Node( elmHtml ).removeClass( 'js-disabled' ).addClass( X_UA_classNameForHTML );
                        html[ '_flags' ] |= X_Node_State.IN_TREE;
                        
                        head = X[ 'Doc' ][ 'head' ] = X_Node_head = elmHead && new Node( elmHead );
@@ -359,13 +360,13 @@ X[ 'ViewPort' ] = {
                                };
                                
                                //
-                               if( X_Dom_orientationchange ){
-                                       X_EventDispatcher_systemListen( X_ViewPort, 'orientationchange', X_Dom_orientationchange );
+                               if( X_ViewPort_orientationchange ){
+                                       X_EventDispatcher_systemListen( X_ViewPort, 'orientationchange', X_ViewPort_orientationchange );
                                };
                                
-                               if( X_Dom_detectFontSize ){
+                               if( X_ViewPort_detectFontSize ){
                                        X_EventDispatcher_systemListen( X_ViewPort, 'resize', X_ViewPort_resize );
-                                       X_Timer_add( 333, X_Dom_detectFontSize );
+                                       X_Timer_add( 333, X_ViewPort_detectFontSize );
                                } else {
                                        X_Timer_add( 333, X_ViewPort_resize );
                                };
@@ -402,8 +403,10 @@ X[ 'ViewPort' ] = {
                };
 
                function X_ViewPort_getWindowSize(){
-                       return X_UA[ 'IE' ] ?
+                       return X_UA[ 'IE' ] ? // Opera10.1 では ズーム時に表示領域のサイズが取れない!
                                [ X_ViewPort_rootElement.clientWidth, X_ViewPort_rootElement.clientHeight ] :
+                               X_UA[ 'Opera' ] < 12 ? // Opera10.1 では ズーム + resize 時に表示領域のサイズが取れない!
+                               [ X_ViewPort_rootElement.offsetWidth, X_ViewPort_rootElement.offsetHeight ] :
                                [ window.innerWidth, window.innerHeight ];
                };