From 6b28a86cc49680dac50278ff5617bfe7a3d98613 Mon Sep 17 00:00:00 2001 From: itozyun Date: Fri, 13 Nov 2015 13:27:35 +0900 Subject: [PATCH] Version 0.6.193, bug fixes X.Node.Anime. --- 0.6.x/js/01_core/02_XUA.js | 99 -------------------- 0.6.x/js/01_core/03_XScript.js | 109 ++++++++++++++++++++++ 0.6.x/js/01_core/{03_XType.js => 04_XType.js} | 0 0.6.x/js/01_core/{04_XObject.js => 05_XObject.js} | 0 0.6.x/js/01_core/{05_XArray.js => 06_XArray.js} | 0 0.6.x/js/01_core/{06_XString.js => 07_XString.js} | 0 0.6.x/js/01_core/{07_XNumber.js => 08_Number.js} | 0 0.6.x/js/01_core/{08_XURL.js => 09_XURL.js} | 0 0.6.x/js/02_dom/06_XNodeCSS.js | 2 +- 0.6.x/js/02_dom/10_XNodeAnime.js | 32 ++++--- 0.6.x/js/02_dom/20_XNode.js | 2 +- 0.6.x/js/07_audio/03_XSilverlightAudio.js | 3 +- 0.6.x/js/07_audio/05_XWMPAudio.js | 3 +- 0.6.x/js/20_ui/05_XUI_Gesture.js | 2 - 0.6.x/js/20_ui/15_ScrollBox.js | 1 + 0.6.x/js/20_ui/20_Root.js | 93 +++++++++++++----- 0.6.x/js/import.js | 11 ++- 17 files changed, 210 insertions(+), 147 deletions(-) create mode 100644 0.6.x/js/01_core/03_XScript.js rename 0.6.x/js/01_core/{03_XType.js => 04_XType.js} (100%) rename 0.6.x/js/01_core/{04_XObject.js => 05_XObject.js} (100%) rename 0.6.x/js/01_core/{05_XArray.js => 06_XArray.js} (100%) rename 0.6.x/js/01_core/{06_XString.js => 07_XString.js} (100%) rename 0.6.x/js/01_core/{07_XNumber.js => 08_Number.js} (100%) rename 0.6.x/js/01_core/{08_XURL.js => 09_XURL.js} (100%) diff --git a/0.6.x/js/01_core/02_XUA.js b/0.6.x/js/01_core/02_XUA.js index 78b62f2..f4a5dbb 100644 --- a/0.6.x/js/01_core/02_XUA.js +++ b/0.6.x/js/01_core/02_XUA.js @@ -838,102 +838,3 @@ X_UA_ATagWrapDiv = (function( e, h ){ })(); console.log( 'HTML5? ' + X_UA_ATagWrapDiv ); */ - -var X_Script_VBS_ENABLED = X_UA[ 'Windows' ] && !X_UA[ 'WinCE' ] && !X_UA[ 'WinPhone' ] && X_UA[ 'IE' ] < 11, - // 構文のサポート instanceof, in(for-in ではない), try-catch. JS version 1.5以上 - X_Script_gte15 = !( X_UA[ 'IE' ] < 5.5 ) && ( new Function( 'f,a', 'try{return f.apply({},a)}catch(e){}' ) ); - -/** - * js バージョン間の際を吸収 - * @namespace X.Script - * @alias X.Script - * @type {object} - */ -X[ 'Script' ] = { - 'tryCatch' : X_Script_try -}; - -if( X_Script_VBS_ENABLED ){ - X_Script_gte15 || document.write( '' ); - - // TODO Object のメンバを辿る vba - // byte Array を扱う vba -}; - -function X_Script_try( func, args ){ - if( !X_Script_gte15 ){ - //return func.apply( {}, args ); - return; - }; - return X_Script_gte15( func, args || [] ); -}; - -function X_Script_createActiveXObjectSafty( name ){ - if( !X_Script_gte15 ){ - if( X_Script_VBS_ENABLED ){ - // console.log( window[ 'vbs_testAXO' ]( name ) + ' ' + name ); - return !window[ 'vbs_testAXO' ]( name ) && X_Script_createActiveXObject( name ); - }; - return X_Script_createActiveXObject( name ); - }; - - return X_Script_try( X_Script_createActiveXObject, [ name ] ); -}; - -// TODO GeckoActiveX -function X_Script_createActiveXObject( name ){ - return new ActiveXObject( name ); -}; - -/* - * http://archiva.jp/web/html-css/ie6_background_flickr.html - * hover時の背景画像ちらつきに対処する - * この問題はIE6固有の問題であり、他のモダンブラウザやIE5等では発現しない。 - */ -if( X_UA[ 'IE6' ] && // error @ NN7.2 - !X_Script_try( function(){ document.execCommand( 'BackgroundImageCache', false, true ); return 1; } ) ){ - /** - * ie6 のみで実行する document.execCommand( 'BackgroundImageCache', false, true ) の失敗。 - * bonus: hotfix for IE6 SP1 (bug KB823727) - * multipleIEs IE6 standalone 版では不可, IE5.5 は可,,, - * @alias X.UA.ieExeComError */ - X_UA[ 'ieExeComError' ] = true; -}; - diff --git a/0.6.x/js/01_core/03_XScript.js b/0.6.x/js/01_core/03_XScript.js new file mode 100644 index 0000000..b8255ca --- /dev/null +++ b/0.6.x/js/01_core/03_XScript.js @@ -0,0 +1,109 @@ +var X_Script_VBS_ENABLED = X_UA[ 'Windows' ] && !X_UA[ 'WinCE' ] && !X_UA[ 'WinPhone' ] && X_UA[ 'IE' ] < 11, + // 構文のサポート instanceof, in(for-in ではない), try-catch. JS version 1.5以上 + X_Script_gte15 = !( X_UA[ 'IE' ] < 5.5 ) && ( new Function( 'f,a', 'try{return f.apply({},a)}catch(e){}' ) ); + +/** + * js バージョン間の差異を可能な限り吸収する + * @namespace X.Script + * @alias X.Script + * @type {object} + */ +X[ 'Script' ] = { + 'tryCatch' : X_Script_try + + // git, strict mode, asm.js, +}; + +if( X_Script_VBS_ENABLED ){ + +/** + * Visual Basic Script が使えるか? + * @alias X.Script.VBS + * @type {boolean} + */ + X[ 'Script' ][ 'VBS' ] = true; + + X_Script_gte15 || document.write( '' ); + + // TODO Object のメンバを辿る vba + // byte Array を扱う vba +}; + +function X_Script_try( func, args ){ + if( !X_Script_gte15 ){ + //return func.apply( {}, args ); + return; + }; + return X_Script_gte15( func, args || [] ); +}; + +function X_Script_createActiveXObjectSafty( name ){ + if( !X_Script_gte15 ){ + if( X_Script_VBS_ENABLED ){ + // console.log( window[ 'vbs_testAXO' ]( name ) + ' ' + name ); + return !window[ 'vbs_testAXO' ]( name ) && X_Script_createActiveXObject( name ); + }; + return X_Script_createActiveXObject( name ); + }; + + return X_Script_try( X_Script_createActiveXObject, [ name ] ); +}; + +// TODO GeckoActiveX +function X_Script_createActiveXObject( name ){ + return new ActiveXObject( name ); +}; + +/* + * http://archiva.jp/web/html-css/ie6_background_flickr.html + * hover時の背景画像ちらつきに対処する + * この問題はIE6固有の問題であり、他のモダンブラウザやIE5等では発現しない。 + */ +if( X_UA[ 'IE6' ] && // error @ NN7.2 + !X_Script_try( function(){ document.execCommand( 'BackgroundImageCache', false, true ); return 1; } ) ){ + /** + * ie6 のみで実行する document.execCommand( 'BackgroundImageCache', false, true ) の失敗。 + * bonus: hotfix for IE6 SP1 (bug KB823727) + * multipleIEs IE6 standalone 版では不可, IE5.5 は可,,, + * @alias X.UA.ieExeComError */ + X_UA[ 'ieExeComError' ] = true; +}; + + diff --git a/0.6.x/js/01_core/03_XType.js b/0.6.x/js/01_core/04_XType.js similarity index 100% rename from 0.6.x/js/01_core/03_XType.js rename to 0.6.x/js/01_core/04_XType.js diff --git a/0.6.x/js/01_core/04_XObject.js b/0.6.x/js/01_core/05_XObject.js similarity index 100% rename from 0.6.x/js/01_core/04_XObject.js rename to 0.6.x/js/01_core/05_XObject.js diff --git a/0.6.x/js/01_core/05_XArray.js b/0.6.x/js/01_core/06_XArray.js similarity index 100% rename from 0.6.x/js/01_core/05_XArray.js rename to 0.6.x/js/01_core/06_XArray.js diff --git a/0.6.x/js/01_core/06_XString.js b/0.6.x/js/01_core/07_XString.js similarity index 100% rename from 0.6.x/js/01_core/06_XString.js rename to 0.6.x/js/01_core/07_XString.js diff --git a/0.6.x/js/01_core/07_XNumber.js b/0.6.x/js/01_core/08_Number.js similarity index 100% rename from 0.6.x/js/01_core/07_XNumber.js rename to 0.6.x/js/01_core/08_Number.js diff --git a/0.6.x/js/01_core/08_XURL.js b/0.6.x/js/01_core/09_XURL.js similarity index 100% rename from 0.6.x/js/01_core/08_XURL.js rename to 0.6.x/js/01_core/09_XURL.js diff --git a/0.6.x/js/02_dom/06_XNodeCSS.js b/0.6.x/js/02_dom/06_XNodeCSS.js index 1f1fe70..f9ddadd 100644 --- a/0.6.x/js/02_dom/06_XNodeCSS.js +++ b/0.6.x/js/02_dom/06_XNodeCSS.js @@ -825,7 +825,7 @@ X[ 'CSS' ] = { for( j = vendors.length; j; ){ v = vendors[ --j ]; if( testStyle[ v + prop ] !== undefined ){ - if( v === 'ms' ) v = 'Ms';// for ie9 + if( v === 'ms' && !( 10 <= X_UA[ 'IEHost' ] ) ) v = 'Ms';// for ie9, 但し ie11 のieには不要 if( v === 'o' ) v = 'O';//for opera12 X_Node_CSS_VENDER_PREFIX[ search ] = v + prop; break; diff --git a/0.6.x/js/02_dom/10_XNodeAnime.js b/0.6.x/js/02_dom/10_XNodeAnime.js index 2520f14..31e853a 100644 --- a/0.6.x/js/02_dom/10_XNodeAnime.js +++ b/0.6.x/js/02_dom/10_XNodeAnime.js @@ -431,27 +431,29 @@ function X_Node_Anime_updateAnimation( xnode ){ function X_Node_Anime_getComputedPosition( that ){ var raw = that[ '_rawObject' ], - x = 0, y = 0, a = 1, matrix; + x = NaN, y = NaN, a = 1, style, matrix; if( raw ){ if( X_Node_Anime_hasTransform ){ - matrix = X_Node_CSS_getComputedStyle( raw, null ); - matrix = matrix[ X_Node_CSS_VENDER_PREFIX[ 'transform' ] ].split( ')' )[ 0 ].split( ', ' ); - x = + ( matrix[ 12 ] || matrix[ 4 ] ); - y = + ( matrix[ 13 ] || matrix[ 5 ] ); - a = matrix[ X_Node_CSS_Support[ 'opacity' ] ]; + if( style = X_Node_CSS_getComputedStyle( raw, null ) ){ + matrix = ( style[ X_Node_CSS_VENDER_PREFIX[ 'transform' ] ] || '' ).split( ')' )[ 0 ].split( ', ' ); + x = + ( matrix[ 12 ] || matrix[ 4 ] ); + y = + ( matrix[ 13 ] || matrix[ 5 ] ); + a = matrix[ X_Node_CSS_Support[ 'opacity' ] ]; + }; } else if( X_Node_CSS_getComputedStyle ){ - matrix = X_Node_CSS_getComputedStyle( raw, null ); - x = parseFloat( matrix[ 'left' ] ); - y = parseFloat( matrix[ 'top' ] ); - a = matrix[ X_Node_CSS_Support[ 'opacity' ] ]; + if( style = X_Node_CSS_getComputedStyle( raw, null ) ){ + x = parseFloat( style[ 'left' ] ); + y = parseFloat( style[ 'top' ] ); + a = parseFloat( style[ X_Node_CSS_Support[ 'opacity' ] ] ); + }; } else - if( matrix = raw.currentStyle || raw.style ){ - x = parseFloat( matrix[ 'left' ] ); - y = parseFloat( matrix[ 'top' ] ); - a = matrix[ 'opacity' ]; - }; + if( style = ( raw.currentStyle || raw.style ) ){ + x = parseFloat( style[ 'left' ] ); + y = parseFloat( style[ 'top' ] ); + a = parseFloat( ( style[ 'filter' ] || 'opacity=1' ).split( 'opacity=' )[ 1 ] ); + }; }; return { x : x, y : y, a : a }; diff --git a/0.6.x/js/02_dom/20_XNode.js b/0.6.x/js/02_dom/20_XNode.js index d0a2185..2576ae4 100644 --- a/0.6.x/js/02_dom/20_XNode.js +++ b/0.6.x/js/02_dom/20_XNode.js @@ -1214,7 +1214,7 @@ function X_Node_call( name /*, opt_args... */ ){ case 'treeIsDirty' : return !!X_Node_updateTimerID; case 'fontSize' : - return X_Node_CSS_getCharSize( this ); + return this.parent ? X_Node_CSS_getCharSize( this ) : 0; case 'inGPU' : return !!( this[ '_flags' ] & ( X_NodeFlags_GPU_NOW | X_NodeFlags_GPU_RELEASE_RESERVED ) ); }; diff --git a/0.6.x/js/07_audio/03_XSilverlightAudio.js b/0.6.x/js/07_audio/03_XSilverlightAudio.js index 3b9d94d..c713961 100644 --- a/0.6.x/js/07_audio/03_XSilverlightAudio.js +++ b/0.6.x/js/07_audio/03_XSilverlightAudio.js @@ -407,6 +407,7 @@ if( X_Pulgin_SILVER_LIGHT_VERSION ){ canPlay : { 'mp3' : true, + 'm4a' : true, 'wma' : true, 'wav' : true }, @@ -414,7 +415,7 @@ if( X_Pulgin_SILVER_LIGHT_VERSION ){ detect : function( proxy, source, ext ){ // TODO source = .mp3#CBR // 得意度で返す - proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : ext === 'mp3' || ext === 'wma' || ext === 'wav' } ); + proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : ext === 'mp3' || ext === 'm4a' || ext === 'wma' || ext === 'wav' } ); }, klass : X_SLAudio diff --git a/0.6.x/js/07_audio/05_XWMPAudio.js b/0.6.x/js/07_audio/05_XWMPAudio.js index 7c6964f..04be569 100644 --- a/0.6.x/js/07_audio/05_XWMPAudio.js +++ b/0.6.x/js/07_audio/05_XWMPAudio.js @@ -211,6 +211,7 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可 canPlay : { 'mp3' : true, + 'm4a' : true, 'wma' : true, 'wav' : true, 'mid' : true, @@ -223,7 +224,7 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可 }, detect : function( proxy, source, ext ){ - proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : 0 <= 'mp3 wma wav midi snd au aiff aicf'.indexOf( ext ) } ); + proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : 0 <= 'mp3 m4a wma wav midi snd au aiff aicf'.indexOf( ext ) } ); }, klass : X_WMPAudio diff --git a/0.6.x/js/20_ui/05_XUI_Gesture.js b/0.6.x/js/20_ui/05_XUI_Gesture.js index f22672f..db684c3 100644 --- a/0.6.x/js/20_ui/05_XUI_Gesture.js +++ b/0.6.x/js/20_ui/05_XUI_Gesture.js @@ -264,8 +264,6 @@ function XUI_Gesture_handleEvent( e ){ if( !isStart && !hammer.gestureStartEvent ) return; -if( type === XUI_Event.POINTER_OUT ) console.log( 'gestureCanceled ...' + e.button ) - if( isEnd ){ if( XUI_Gesture_POINTERS[ uid ] ){ delete XUI_Gesture_POINTERS[ uid ]; diff --git a/0.6.x/js/20_ui/15_ScrollBox.js b/0.6.x/js/20_ui/15_ScrollBox.js index 7574493..b6cfabc 100644 --- a/0.6.x/js/20_ui/15_ScrollBox.js +++ b/0.6.x/js/20_ui/15_ScrollBox.js @@ -526,6 +526,7 @@ function X_UI_ScrollBox_onEnd( e ){ //console.log( '-3-' ); this[ 'dispatch' ]( XUI_Event.SCROLL_END ); }; + return ret | X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_RELEASE_POINTER; }; diff --git a/0.6.x/js/20_ui/20_Root.js b/0.6.x/js/20_ui/20_Root.js index 6339c63..5c301e0 100644 --- a/0.6.x/js/20_ui/20_Root.js +++ b/0.6.x/js/20_ui/20_Root.js @@ -1,37 +1,81 @@ -var XUI_rootData = null, - XUI_xnodeIneraction = null, - XUI_UINODES_HOVER = [], - XUI_EVENT_COUNTER = {}, - XUI_uinodeTarget = null, +var XUI_rootData = null, + XUI_xnodeIneraction = null, + XUI_mousemoveFix = X_UA[ 'WinPhone' ] && X_UA[ 'IE9' ], + XUI_mousemoveFixOn = 0, + XUI_mousemoveFixX = 0, + XUI_mousemoveFixY = 0, + XUI_mousemoveFixLast = null, + XUI_UINODES_HOVER = [], + XUI_EVENT_COUNTER = {}, + XUI_uinodeTarget = null, XUI_xnodeInteractionOverlay, - XUI_interactionBusy = false; + XUI_interactionBusy = false; + +function XUI_mousemoveFixResetScroll(){ + var raw = XUI_xnodeInteractionOverlay[ '_rawObject' ]; + + if( XUI_mousemoveFix ){ + XUI_mousemoveFixX = raw.scrollLeft = raw.offsetWidth; + XUI_mousemoveFixY = raw.scrollTop = raw.offsetHeight; + }; +}; + +function XUI_mousemoveFixScrollEnd(){ + var raw = XUI_xnodeInteractionOverlay[ '_rawObject' ]; + + XUI_mousemoveFixOn = 0; + XUI_mousemoveFixLast.type = 'pointerup'; + X_UI_eventRellay( XUI_mousemoveFixLast ); + + raw.scrollLeft = XUI_mousemoveFixX; + raw.scrollTop = XUI_mousemoveFixY; +}; function X_UI_eventRellay( e ){ var font = X_ViewPort_baseFontSize, - x = e.pageX / font, // clientX は iOS4- で通らない? - y = e.pageY / font, + x = e.pageX, // clientX は iOS4- で通らない? + y = e.pageY, type = XUI_Event.NameToID[ e.type ], i = 0, data = XUI_rootData, sysOnly = false, ret = X_CALLBACK_NONE, - list, parent, _ret, eventIn, eventOut; + list = XUI_UINODES_HOVER, + raw, parent, _ret, eventIn, eventOut; - // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止 - if( !data || XUI_interactionBusy ) return ret; + // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止 + if( XUI_interactionBusy ) return ret; XUI_interactionBusy = true; + if( XUI_mousemoveFix ){ + if( e.type === 'scroll' ){ + raw = XUI_xnodeInteractionOverlay[ '_rawObject' ]; + type = XUI_mousemoveFixOn ? XUI_Event._POINTER_MOVE : XUI_Event._POINTER_DOWN; + x = XUI_mousemoveFixX - raw.scrollLeft; + y = XUI_mousemoveFixY - raw.scrollTop; + e.pageX = x; + e.pageY = y; + e[ 'button' ] = 0; + e[ 'timestamp' ] = e[ 'timeStamp' ]; + e[ 'pointerId' ] = 1; + e[ 'pointerType' ] = 'mouse'; + + XUI_mousemoveFixOn && X_Timer_remove( XUI_mousemoveFixOn ); + XUI_mousemoveFixOn = X_Timer_once( 250, XUI_mousemoveFixScrollEnd ); + XUI_mousemoveFixLast = X_Object_copy( e ); + }; + }; + e = X_Object_copy( e ); e.type = type; - // TODO capture は pointer 毎に! - list = XUI_UINODES_HOVER; - ( XUI_uinodeTarget = XUI_rootData ).capcher( x, y ); - data = XUI_uinodeTarget; + // capture は pointer 毎に! + data.capcher( x / font, y / font ); + data = XUI_uinodeTarget || data; while( data ){ - _ret = data[ 'dispatch' ]( e, sysOnly ); + _ret = data[ 'dispatch' ]( e, sysOnly ) || X_CALLBACK_NONE; ret |= _ret; if( type < XUI_Event._START_BUBLEUP || ret & X_CALLBACK_STOP_PROPAGATION ){ break; @@ -114,17 +158,15 @@ var XUI_Root = XUI_Box.inherits( }, start : function(){ - - this.initialize( this.User, this, null, null ); X_Timer_once( 0, this, this.addToView ); }, addToView : function(){ // XUI_xnodeInteractionOverlay の前に追加する! this.addToParent( X_Node_body ); - + XUI_xnodeInteractionOverlay = X_Node_body.create( 'div', { - 'class' : 'mouse-operation-catcher', + 'class' : XUI_mousemoveFix ? 'mouse-operation-catcher-scrollFix' : 'mouse-operation-catcher', unselectable : 'on' } ); @@ -133,7 +175,12 @@ var XUI_Root = XUI_Box.inherits( // hover や rollover rollout のための move イベントの追加 // TODO この切り替えを ViewPort へ XUI_xnodeIneraction = ( X_UA[ 'IE' ] < 9 ? X_ViewPort_document : X_UA[ 'Opera' ] < 8 ? X_Node_body : X_ViewPort ); - XUI_xnodeIneraction[ 'listen' ]( 'pointermove', X_UI_eventRellay ); + + if( XUI_mousemoveFix ){ + XUI_xnodeInteractionOverlay[ 'listen' ]( [ 'scroll', 'mouseup' ], X_UI_eventRellay )[ 'create' ]( 'div' ); + } else { + XUI_xnodeIneraction[ 'listen' ]( 'pointermove', X_UI_eventRellay ); + }; if( XUI_EVENT_COUNTER[ XUI_Event._POINTER_MOVE ] ){ ++XUI_EVENT_COUNTER[ XUI_Event._POINTER_MOVE ]; @@ -151,7 +198,7 @@ var XUI_Root = XUI_Box.inherits( }, reserveCalc : function(){ - if( this.calcReserved === false ){ + if( !this.calcReserved ){ this.calcReserved = true; X_Timer_once( 0, this, this.calculate ); }; @@ -164,6 +211,8 @@ var XUI_Root = XUI_Box.inherits( return X_CALLBACK_NONE; }; + XUI_mousemoveFix && XUI_mousemoveFixResetScroll(); + size = X[ 'ViewPort' ][ 'getSize' ](); font = X[ 'ViewPort' ][ 'getBaseFontSize' ](); this.layout.calculate( this, false, 0, 0, size[ 0 ] / font, size[ 1 ] / font ); diff --git a/0.6.x/js/import.js b/0.6.x/js/import.js index 8063af2..41c69a2 100644 --- a/0.6.x/js/import.js +++ b/0.6.x/js/import.js @@ -10,11 +10,12 @@ document.write( [ 'js/01_core/01_X.js', 'js/01_core/02_XUA.js', - 'js/01_core/03_XType.js', - 'js/01_core/04_XObject.js', - 'js/01_core/05_XArray.js', - 'js/01_core/06_XString.js', - 'js/01_core/08_XURL.js', + 'js/01_core/03_XScript.js', + 'js/01_core/04_XType.js', + 'js/01_core/05_XObject.js', + 'js/01_core/06_XArray.js', + 'js/01_core/07_XString.js', + 'js/01_core/09_XURL.js', 'js/01_core/10_XPair.js', 'js/01_core/11_XCallback.js', -- 2.11.0