• R/O
  • HTTP
  • SSH
  • HTTPS

clientJs: コミット

クライアント側 js 開発用


コミットメタ情報

リビジョンeedd028ba64be2ea0828cf686f1d0ec3bb4010d5 (tree)
日時2015-04-16 22:01:49
作者itozyun <itozyun@user...>
コミッターitozyun

ログメッセージ

Version 0.6.138, working X.UI.ScrollBox!, fix Node.prev & Node.next.

変更サマリ

差分

--- a/0.6.x/js/01_core/03_XType.js
+++ b/0.6.x/js/01_core/03_XType.js
@@ -56,10 +56,11 @@ X[ 'Type' ] = {
5656
5757 /**
5858 * Object か?判定する。typeof null === 'object' に対策済なので null は Object ではない。
59+ * new String(), new Number(), new Boolean() も typeof object なので対策
5960 * @alias X.Type.isObject
6061 */
6162 function X_Type_isObject( v ){
62- return v && typeof v === 'object'; // typeof null === 'object' に対策
63+ return v && typeof v === 'object'; // && ( v !== v + '' && v !== v + 0 && v !== true ) ; // typeof null === 'object' に対策
6364 };
6465 /**
6566 * Function か?判定する。
--- a/0.6.x/js/01_core/06_XURL.js
+++ b/0.6.x/js/01_core/06_XURL.js
@@ -48,13 +48,13 @@ var X_URL_BASE_URL = ( function( parts ){
4848 */
4949 X[ 'URL' ] = {
5050
51- 'BASE_URL' : X_URL_BASE_URL,
51+ 'BASE_URL' : X_URL_BASE_URL,
5252
53- 'IS_FILE' : X_URL_IS_FILE,
53+ 'IS_FILE' : X_URL_IS_FILE,
5454
55- 'IS_LOCAL' : X_URL_IS_LOCAL,
55+ 'IS_LOCAL' : X_URL_IS_LOCAL,
5656
57- 'PARAMS' : X_URL_PARAMS,
57+ 'PARAMS' : X_URL_PARAMS,
5858
5959 'toAbsolutePath' : X_URL_toAbsolutePath,
6060
--- a/0.6.x/js/02_dom/02_XNode.js
+++ b/0.6.x/js/02_dom/02_XNode.js
@@ -142,7 +142,6 @@ var Node = X[ 'Node' ] = X_EventDispatcher[ 'inherits' ](
142142 /**
143143 * NodeList と動作を一致させるためのプロパティ。常に 1。
144144 * @type {number}
145- * @private
146145 * @alias Node.prototype.length
147146 */
148147 length : 1,
@@ -150,7 +149,6 @@ var Node = X[ 'Node' ] = X_EventDispatcher[ 'inherits' ](
150149 /**
151150 * 親 Node。
152151 * @type {Node}
153- * @private
154152 * @alias Node.prototype.parent
155153 */
156154 parent : null, // remove された枝も親子構造は維持している。
@@ -671,7 +669,14 @@ function X_Node_appendAt( start, v ){
671669 return this;
672670 case X_Node_TYPE.XNODE :
673671 // 親の xnodes から v を消す
674- v.parent && v[ 'remove' ]();
672+ if( v.parent ){
673+ if( v.parent === this ){
674+ i = v[ 'getOrder' ]();
675+ if( i === start ) return this;
676+ if( i < start ) --start;
677+ };
678+ v[ 'remove' ]();
679+ };
675680 // IE4 でテキストノードの追加、FIXED 済でない場合、親に要素の追加を通知
676681 if( X_UA[ 'IE4' ] && !v[ '_tag' ] && ( this[ '_flags' ] & X_Node_State.IE4_FIXED ) === 0 ) this[ '_flags' ] |= X_Node_State.IE4_DIRTY_CHILDREN;
677682 break;
@@ -716,14 +721,14 @@ function X_Node_appendTo( parent, opt_index ){
716721
717722
718723 /**
719- * ノードの直前の要素を取得。または直前に挿入。
724+ * ノードの直前の要素を取得。または直前に挿入。挿入する要素が先にいる兄弟でも正しく動作する。
720725 * @alias Node.prototype.prev
721- * @param {Node|string|HTMLElement|TextNode} [v] HTMLElement と TextNode は内部のみ。
726+ * @param {Node|string|HTMLElement|TextNode} [...v] HTMLElement と TextNode は内部のみ。
722727 * @return {Node} 自身。チェインメソッド
723728 * @example childNode.prev( prevNode );
724729 */
725730 function X_Node_prev( v ){
726- var parent = this.parent, xnodes, i, l, start;
731+ var parent = this.parent, xnodes, i, l;
727732
728733 // getter
729734 if( v === undefined ){
@@ -736,19 +741,18 @@ function X_Node_prev( v ){
736741 if( !parent ) return this;
737742
738743 l = arguments.length;
739- start = this[ 'getOrder' ]();
740744 if( 1 < l ){
741- for( ; l; ){
742- parent[ 'appendAt' ]( start, arguments[ --l ] );
745+ for( i = 0; l; ++i ){
746+ parent[ 'appendAt' ]( this[ 'getOrder' ]() - i, arguments[ --l ] );
743747 };
744748 return this;
745749 };
746- parent[ 'appendAt' ]( start, v );
750+ parent[ 'appendAt' ]( this[ 'getOrder' ](), v );
747751 return this;
748752 };
749753
750754 /**
751- * ノードの直後の要素を取得。または直後に挿入。
755+ * ノードの直後の要素を取得。または直後に挿入。挿入する要素が先にいる兄弟でも正しく動作する。
752756 * @alias Node.prototype.next
753757 * @param {Node|string|HTMLElement|TextNode} [v] HTMLElement と TextNode は内部のみ。
754758 * @return {Node} 自身。チェインメソッド
@@ -769,23 +773,19 @@ function X_Node_next( v ){
769773
770774 l = arguments.length;
771775 start = this[ 'getOrder' ]() + 1;
776+
772777 if( parent[ '_xnodes' ].length <= start ){
773- if( 1 < l ){
774- for( i = 0; i < l; ++i ){
775- parent[ 'append' ]( arguments[ i ] );
776- };
777- return this;
778+ for( i = 0; i < l; ++i ){
779+ parent[ 'append' ]( arguments[ i ] );
778780 };
779- parent[ 'append' ]( v );
780- return this;
781- };
781+ } else
782782 if( 1 < l ){
783783 for( ; l; ){
784- parent[ 'appendAt' ]( start, arguments[ --l ] );
784+ parent[ 'appendAt' ]( this[ 'getOrder' ]() + 1, arguments[ --l ] );
785785 };
786- return this;
786+ } else {
787+ parent[ 'appendAt' ]( start, v );
787788 };
788- parent[ 'appendAt' ]( start, v );
789789 return this;
790790 };
791791
@@ -1213,6 +1213,9 @@ function X_Node_call( name /*, opt_args... */ ){
12131213 return v;
12141214 case 'fontSize' :
12151215 return X_Node_CSS_getCharSize( this );
1216+ case 'GPU' :
1217+ return this[ '_flags' ] & X_Node_State.GPU_NOW ? 'NOW' :
1218+ this[ '_flags' ] & X_Node_State.GPU_RELEASE_RESERVED ? '解除予約' : '';
12161219 case 'inGPU' :
12171220 return !!( this[ '_flags' ] & ( X_Node_State.GPU_NOW | X_Node_State.GPU_RELEASE_RESERVED ) );
12181221 };
@@ -1359,13 +1362,12 @@ var X_Node__commitUpdate =
13591362 };
13601363
13611364 // 2. GPU解放予約
1362- // TODO もしかしたらこのタイミングで更新できるかも。
13631365 if( that[ '_flags' ] & X_Node_State.GPU_RELEASE_RESERVED ){
1364- console.log( 'GPU 解放 ' );
1366+ // console.log( 'GPU 解放 ' );
13651367 //X_Node_updateReservedByReleaseGPU = true;
13661368 //X_Node__updateRawNode( that, elm );
13671369 that[ '_flags' ] &= X_Node_BitMask_RESET_GPU;
1368- //return elm;
1370+ //return elm;// TODO もしかしたらこのタイミングで更新できるかも。
13691371 };
13701372
13711373 // 3. GPU予約 -> GPU
--- a/0.6.x/js/02_dom/09_XHTMLParser.js
+++ b/0.6.x/js/02_dom/09_XHTMLParser.js
@@ -8,7 +8,7 @@
88 var X_HTMLParser_CHARS = {
99 'A':1,'B':1,'C':1,'D':1,'E':1,'F':1,'G':1,'H':1,'I':1,'J':1,'K':1,'L':1,'M':1,'N':1,'O':1,'P':1,'Q':1,'R':1,'S':1,'T':1,'U':1,'V':1,'W':1,'X':1,'Y':1,'Z':1,
1010 'a':2,'b':2,'c':2,'d':2,'e':2,'f':2,'g':2,'h':2,'i':2,'j':2,'k':2,'l':2,'m':2,'n':2,'o':2,'p':2,'q':2,'r':2,'s':2,'t':2,'u':2,'v':2,'w':2,'x':2,'y':2,'z':2,
11- // "0" ': 4, "1" : 4, "2" : 4, "3" : 4, "4" : 4, "5" : 4, "6" : 4, "7" : 4, "8" : 4, "9" : 4, closure compiler で minify すると ie4 で error、eval使う
11+ '!':1,// "0" ': 4, "1" : 4, "2" : 4, "3" : 4, "4" : 4, "5" : 4, "6" : 4, "7" : 4, "8" : 4, "9" : 4, closure compiler で minify すると ie4 で error、eval使う
1212
1313 '\t' : 16, '\r\n' : 16, '\r' : 16, '\n' : 16, '\f' : 16, '\b' : 16, ' ' : 16
1414 },
@@ -55,8 +55,6 @@ var X_HTMLParser_CHARS = {
5555 var special = X_HTMLParser_special,
5656 //plainText = X_HTMLParser_plainText,
5757 startTime = async && X_Timer_now(),
58- _parseStartTag = X_HTMLParser__parseStartTag,
59- _parseEndTag = X_HTMLParser__parseEndTag,
6058 stack = async ? async[ 1 ] : [],
6159 lastHtml = html,
6260 chars, last, text, index;
@@ -66,10 +64,10 @@ var X_HTMLParser_CHARS = {
6664 last = stack[ stack.length - 1 ];
6765
6866 // Make sure we're not in a script or style element
69- if ( last && special[ last ] === 1 ) {
70- if( 0 <= ( index = html.toUpperCase().indexOf( '</' + last ) ) ){
67+ if ( last && special[ handler.isXML ? last.toUpperCase() : last ] === 1 ) {
68+ if( 0 <= ( index = html.toUpperCase().indexOf( '</' + ( handler.isXML ? last.toUpperCase() : last ) ) ) ){
7169 handler.chars( html.substring( 0, index ) );
72- if( index = _parseEndTag( stack, handler, html ) ){
70+ if( index = X_HTMLParser__parseEndTag( stack, handler, html ) ){
7371 html = html.substring( index );
7472 } else {
7573 handler.chars( html );
@@ -90,14 +88,14 @@ var X_HTMLParser_CHARS = {
9088
9189 // end tag
9290 } else if ( html.indexOf("</") === 0 ) {
93- if ( 2 < ( index = _parseEndTag( stack, handler, html ) ) ) {
91+ if ( 2 < ( index = X_HTMLParser__parseEndTag( stack, handler, html ) ) ) {
9492 html = html.substring( index );
9593 chars = false;
9694 };
9795
9896 // start tag
9997 } else if ( html.indexOf("<") === 0 ) {
100- if( index = _parseStartTag( stack, last, handler, html ) ){
98+ if( index = X_HTMLParser__parseStartTag( stack, last, handler, html ) ){
10199 html = html.substring( index );
102100 chars = false;
103101 } else
@@ -147,7 +145,7 @@ var X_HTMLParser_CHARS = {
147145 i = 0,
148146 attrs = [],
149147 tagName, empty = false,
150- chr, start, attrName, quot, escape;
148+ chr, start, attrName, quot, escape, tagUpper;
151149
152150 while( i < l && phase < 9 ){
153151 chr = html.charAt( i );
@@ -209,7 +207,24 @@ var X_HTMLParser_CHARS = {
209207 };
210208 if( phase === 9 ){
211209 if( empty ) ++i;
212- if( X_HTMLParser_parseStartTag( stack, last, handler, tagName.toUpperCase(), attrs, empty, i ) === false ) return false;
210+ //if( X_HTMLParser_parseStartTag( stack, last, handler, tagName, attrs, empty, i ) === false ) return false;
211+
212+ tagUpper = tagName.toUpperCase();
213+
214+ if( !X_HTMLParser_skipFixNesting && X_HTMLParser_block[ tagUpper ] === 1 ){
215+ while( last && X_HTMLParser_inline[ handler.isXML ? last.toUpperCase() : last ] === 1 ){
216+ X_HTMLParser_parseEndTag( stack, handler, last );
217+ last = stack[ stack.length - 1 ];
218+ };
219+ };
220+ last && X_HTMLParser_closeSelf[ tagUpper ] === 1 &&
221+ ( last === tagName || ( X_HTMLParser_sisters[ tagUpper ] && X_HTMLParser_sisters[ tagUpper ][ handler.isXML ? last.toUpperCase() : last ] === 1 ) ) &&
222+ X_HTMLParser_parseEndTag( stack, handler, last );
223+ empty = empty || X_Dom_DTD_EMPTY[ tagUpper ];
224+ !empty && ( stack[ stack.length ] = handler.isXML ? tagName : tagUpper );
225+
226+ if( handler.start( handler.isXML ? tagName : tagUpper, attrs, empty, i ) === false ) return false;
227+
213228 return i;
214229 };
215230 return 0; // error
@@ -245,7 +260,7 @@ var X_HTMLParser_CHARS = {
245260 ++i;
246261 };
247262 if( phase === 9 ){
248- X_HTMLParser_parseEndTag( stack, handler, tagName.toUpperCase() );
263+ X_HTMLParser_parseEndTag( stack, handler, handler.isXML ? tagName : tagName.toUpperCase() );
249264 return i;
250265 };
251266 return 0; // error
@@ -264,23 +279,6 @@ var X_HTMLParser_CHARS = {
264279 };
265280 };
266281
267- function X_HTMLParser_parseStartTag( stack, last, handler, tagName, attrs, empty, index ) {
268- var inline = X_HTMLParser_inline,
269- parseEndTag = X_HTMLParser_parseEndTag,
270- sisters = X_HTMLParser_sisters;
271- if( !X_HTMLParser_skipFixNesting && X_HTMLParser_block[ tagName ] === 1 ){
272- while( last && inline[ last ] === 1 ){
273- parseEndTag( stack, handler, last );
274- last = stack[ stack.length - 1 ];
275- };
276- };
277- last && X_HTMLParser_closeSelf[ tagName ] === 1 && ( last === tagName || ( sisters[ tagName ] && sisters[ tagName ][ last ] === 1 ) ) && parseEndTag( stack, handler, last );
278- empty = empty || X_Dom_DTD_EMPTY[ tagName ];
279- !empty && ( stack[ stack.length ] = tagName );
280-
281- return handler.start( tagName, attrs, empty, index );
282- };
283-
284282 function X_HTMLParser_parseEndTag( stack, handler, tagName ) {
285283 var pos = 0, i = stack.length;
286284 // If no tag name is provided, clean shop
@@ -304,6 +302,7 @@ var X_HTMLParser_CHARS = {
304302 var X_HTMLParser_htmlStringToXNode = {
305303 flat : null,
306304 nest : [],
305+ isXML : false,
307306 err : function( html ){
308307 X_HTMLParser_htmlStringToXNode.flat.length = 0;
309308 !X_HTMLParser_htmlStringToXNode.ignoreError && X.Logger.warn( 'X_Dom_Parser() error ' + html );
@@ -361,6 +360,7 @@ function X_HtmlParser_parse( html, ignoreError ){
361360 };
362361
363362 var X_HTMLParser_asyncHtmlStringToXNode = {
363+ isXML : false,
364364 err : function( html ){
365365 X_HTMLParser_htmlStringToXNode.err( html );
366366 this[ 'asyncDispatch' ]( X_EVENT_ERROR );
--- a/0.6.x/js/02_dom/10_XNodeAnime.js
+++ b/0.6.x/js/02_dom/10_XNodeAnime.js
@@ -129,14 +129,16 @@ Node.prototype[ 'animate' ] = function( start, dest, duration, easing, wait ){
129129 isNew && this[ 'dispatch' ]( { type : X_EVENT_ANIME_START, gpu : false } );
130130 };
131131
132- console.log( 'animate ' + this[ '_id' ] + ' y:' + obj.startX + ' > ' + obj.destX + ' d:' + obj.duration );
132+ // console.log( 'animate() ' + this[ '_id' ] + ' y:' + obj.startY + ' > ' + obj.destY + ' d:' + obj.duration );
133133
134134 return this;
135135 };
136136
137137 Node.prototype[ 'stop' ] = function(){
138138 var obj = this[ '_anime' ];
139- if( !obj ) return;
139+
140+ if( !obj ) return this;
141+
140142 if( X_Node_Anime_hasTransition ){
141143 obj.phase = 100;
142144 X_Node_Anime_needsDetection = true;
@@ -154,24 +156,26 @@ function X_Node_Anime_reserveUpdate( before ){
154156 X_Node_Anime_reserved = true;
155157
156158 if( X_Node_updateTimerID ){
157- console.log( before ? '> BEFORE_UPDATE' : '> UPDATED' );
159+ //console.log( before ? '> BEFORE_UPDATE' : '> UPDATED' );
158160 before = false;
159161 X_System[ 'listenOnce' ]( before ? X_EVENT_BEFORE_UPDATE : X_EVENT_UPDATED, X_Node_Anime_updateAnimations );
160162 } else {
161- console.log( '> Timer' );
163+ //console.log( '> Timer' );
162164 // Opera12 requestAnimationFrame では transition が動かない、、、
163165 X_Node_Anime_updateTimerID =
164166 X_UA[ 'Opera' ] ?
165167 X_Timer_once( 0, X_Node_Anime_updateAnimations ) :
166- X_Timer_requestFrame( X_Node_Anime_updateAnimations );
168+ X_Timer_requestFrame( X_Node_Anime_updateAnimations );
167169 };
170+ } else {
171+ // console.log( ' X_Node_Anime_reserved 済、予約なし' );
168172 };
169173 };
170174
171175 function X_Node_Anime_updateAnimations( v, updateNow ){
172176 var i = X_Node_ANIMATIONS.length, ret, c = false;
173177
174- //console.log( v.type || v );
178+ // console.log( v.type || v );
175179
176180 //console.log( 'updateAnimations len:' + i + ' time:' + v + ' det:' + X_Node_Anime_needsDetection );
177181
@@ -287,7 +291,7 @@ function X_Node_Anime_updateAnimation( xnode ){
287291 transitionDelay : '0s' // 0.001 にすると transitionend のタイミングが狂う、、、
288292 });
289293
290- console.log( '開始位置 ' + phase );
294+ //console.log( '開始位置 ' + phase );
291295 X_Node_Anime_updatePosition( xnode, obj.startX, obj.startY, obj.startA, phase === 8 );
292296
293297 xnode[ 'dispatch' ]( { type : X_EVENT_ANIME_START, gpu : phase === 8 } );
@@ -304,12 +308,12 @@ function X_Node_Anime_updateAnimation( xnode ){
304308 transitionDuration : obj.duration + 'ms'
305309 });
306310
307- console.log( '修了位置 ' + phase );
311+ //console.log( '修了位置 ' + phase );
308312 X_Node_Anime_updatePosition( xnode, obj.destX, obj.destY, obj.destA, obj.gpuParent );
309313 obj.phase = 2;
310314 break;
311315 };
312- console.log( 'duration = 0 の場合、アニメーションの解除' );
316+ //console.log( 'duration = 0 の場合、アニメーションの解除' );
313317 // duration = 0 の場合、アニメーションの解除
314318
315319 case 3 : // アニメーションの解除
@@ -367,7 +371,7 @@ function X_Node_Anime_updateAnimation( xnode ){
367371 case 15 :
368372 // GPU有効で停止(待機)している xnode の解除
369373 //console.log( 'GPU有効で停止(待機)している xnode の解除' + xnode[ '_tag' ] + xnode[ 'getOrder' ]() );
370- console.log( 'GPU有効で停止(待機)している xnode のGPU解除' );
374+ // console.log( 'GPU有効で停止(待機)している xnode のGPU解除' );
371375 X_Node_Anime_clearTransition( xnode );
372376 X_Node_Anime_updatePosition( xnode, obj.destX, obj.destY, obj.destA, false );
373377 obj.gpuTimerID && X_Timer_remove( obj.gpuTimerID );
@@ -376,7 +380,7 @@ function X_Node_Anime_updateAnimation( xnode ){
376380
377381 case 100 : // stop() : アニメーションを中断して削除
378382 //console.log( 'stop() gpu:' + obj.gpuParent );
379- console.log( 'アニメーションを中断して削除' );
383+ // console.log( 'アニメーションを中断して削除' );
380384 current = X_Node_Anime_getComputedPosition( xnode );
381385
382386 X_Node_Anime_clearTransition( xnode );
@@ -404,10 +408,15 @@ function X_Node_Anime_getComputedPosition( that ) {
404408 };
405409
406410 function X_Node_Anime_onTransitionEnd( e ){
407- if( !this[ '_anime' ] || this[ '_anime' ].phase !== 2 ) return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION;
408- this[ '_anime' ].phase = 3;
411+ // console.log( 'アニメ終了[onTransitionEnd] ' + ( this[ '_anime' ] && this[ '_anime' ].phase ) );
409412
410- console.log( 'トランジション終了' );
413+ if( !this[ '_anime' ] || this[ '_anime' ].phase !== 2 ){
414+ // ここで return してしまうと、view の更新イベント待ちの場合、アニメが止まる
415+ X_Node_Anime_reserved && !X_Node_Anime_updateTimerID && !X_Node_updateTimerID && X_Node_Anime_reserveUpdate( X_Node_Anime_reserved = false );
416+ return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION;
417+ };
418+
419+ this[ '_anime' ].phase = 3;
411420
412421 X_Node_Anime_onTransition = true;
413422 this[ 'dispatch' ]( { type : X_EVENT_ANIME_END, gpu : this[ '_anime' ].gpuParent } );
@@ -424,7 +433,7 @@ function X_Node_Anime_onTransitionEnd( e ){
424433 function X_Node_Anime_releaseGPULayer(){
425434 var obj = this[ '_anime' ], tmp;
426435 if( !obj ){
427- console.log( '_anime無' );
436+ // console.log( '_anime無' );
428437 return;
429438 };
430439 X_Node_Anime_clearTransition( this );
@@ -432,13 +441,13 @@ function X_Node_Anime_releaseGPULayer(){
432441 X_Node_ANIMATIONS.splice( X_Node_ANIMATIONS.indexOf( this ), 1 );
433442 delete obj.gpuTimerID;
434443 delete this[ '_anime' ];
435- console.log( 'GPUレイヤーの破棄を指示' );
444+ //console.log( 'GPUレイヤーの破棄を指示' );
436445
437446 X_ViewPort[ 'listenOnce' ]( X_EVENT_AFTER_UPDATE, this, X_Node_Anime_gpuReleased );
438447 };
439448
440449 function X_Node_Anime_gpuReleased(){
441- console.log( 'GPU レイヤーが解放されました' );
450+ //console.log( 'GPU レイヤーが解放されました' );
442451 this[ 'dispatch' ]( { type : X_EVENT_GPU_RELEASED, gpu : true } );
443452 };
444453
@@ -458,7 +467,7 @@ function X_Node_Anime_clearTransition( xnode ){
458467 };
459468
460469 function X_Node_Anime_updatePosition( xnode, x, y, opacity, useGPU ){
461- //console.log( 'y : ' + y + ' gpu : ' + !!useGPU );
470+ // console.log( 'updatePosition y:' + y + ' gpu:' + !!useGPU );
462471 if( X_Node_Anime_hasTransform ){
463472 xnode[ 'css' ]({
464473 transform : 'translate(' + ( x | 0 ) + 'px,' + ( y | 0 ) + 'px)' + ( useGPU ? X_Node_Anime_translateZ : '' ),
--- a/0.6.x/js/06_net/00_XNet.js
+++ b/0.6.x/js/06_net/00_XNet.js
@@ -104,7 +104,7 @@ var X_NET_Queue = X_EventDispatcher[ 'inherits' ](
104104
105105 'Constructor' : function( type, data ){
106106 this.type = type;
107- this.data = data;
107+ this.data = data;
108108
109109 //this[ 'listenOnce' ]( X_EVENT_COMPLETE, X_NET_proxyDispatch );
110110 X_EventDispatcher_systemListen( this, X_EVENT_COMPLETE, X_NET_proxyDispatch );
--- a/0.6.x/js/06_net/01_XNetXHR.js
+++ b/0.6.x/js/06_net/01_XNetXHR.js
@@ -68,8 +68,9 @@ X[ 'Net' ][ 'XHR' ] = {
6868 // Progress Events Chrome7, firefox3.5, ie10, opera12, Safari?, Chrome for Android 0.16
6969 'PROGRESS' : false, //
7070
71- 'UL_PROGRESS' : false
71+ 'UL_PROGRESS' : false,
7272
73+ 'CORS' : X_Net_XHR_X_DOMAIN || ( X_Net_XHR_W3C && X_Net_XHR_W3C.withCredentials !== undefined )
7374 };
7475
7576 if( X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X ){
--- a/0.6.x/js/20_ui/00_XUI.js
+++ b/0.6.x/js/20_ui/00_XUI.js
@@ -31,21 +31,6 @@ X.UI = {
3131 CONTENT : 4 // コンテンツが変更された
3232 },
3333
34- Util : {
35- createChecker : function( str ){
36- var ret = {},
37- ary = str.split( ',' ),
38- l = ary.length,
39- i = 0, v;
40- for( ; i < l; ){
41- v = ary[ i ];
42- ret[ v ] = ++i;
43- ret[ i ] = v;
44- };
45- return ret;
46- }
47- },
48-
4934 currentRootData : null,
5035
5136 Layout : {
@@ -63,3 +48,26 @@ X.UI = {
6348 }
6449 };
6550
51+/*
52+ * 'none,chrome,container' を受け取ったら、
53+ * {
54+ * 'none' : 1,
55+ * 'chrome' : 2,
56+ * 'container' : 3,
57+ * 1 : 'none',
58+ * 2 : 'chrome',
59+ * 3 : 'container'
60+ * } こんな object を返す。
61+ */
62+function XUI_createChecker( str ){
63+ var ret = {},
64+ ary = str.split( ',' ),
65+ l = ary.length,
66+ i = 0, v;
67+ for( ; i < l; ){
68+ v = ary[ i ];
69+ ret[ v ] = ++i;
70+ ret[ i ] = v;
71+ };
72+ return ret;
73+};
--- a/0.6.x/js/20_ui/02_XUI_Attr.js
+++ b/0.6.x/js/20_ui/02_XUI_Attr.js
@@ -4,61 +4,36 @@ X.UI.Attr = {
44
55 USER : {
66 XNODE : 0,
7- UINODE : 1,
7+ UINODE : 1, // 値は _uinode にコピーされます。
88 LAYOUT : 2
99 },
1010
1111 Type : {
12- LIST : 0,
13- LENGTH : 1, // '1.5em'
14- MINUS_LENGTH : 2,
15- PERCENT : 4, // '90%', 0.0 ~ 1.0 こういう指定はできない!
16- MINUS_PERCENT : 8,
17- NUMERICAL : 16, // 1.1 (lineHeight only)
18- AUTO : 32, // 'auto'
19- COLOR : 64, // 0x000000 ~ 0xFFFFFF, RED, #000000 ~ #FFFFFF, #000 ~ #FFF
20- URL : 128,
21- STRING : 128,
22- FONT_NAME : 256,
23- BOOLEAN : 512,
24- COMBI : 1024,
25- QUARTET : 2048,
26- DEFAULT_ONLY : 4096,
27- INIT_ONLY : 8192
12+ LIST : 16384,
13+ LENGTH : 1, // '1.5em'
14+ MINUS_LENGTH : 2,
15+ PERCENT : 4, // '90%', 0.0 ~ 1.0 こういう指定はできない!
16+ MINUS_PERCENT : 8,
17+ NUMERICAL : 16, // 1.1 (lineHeight only)
18+ AUTO : 32, // 'auto'
19+ COLOR : 64, // 0x000000 ~ 0xFFFFFF, RED, #000000 ~ #FFFFFF, #000 ~ #FFF
20+ URL : 128,
21+ STRING : 128,
22+ FONT_NAME : 256,
23+ BOOLEAN : 512,
24+ COMBI : 1024,
25+ QUARTET : 2048,
26+ DEFAULT_ONLY : 4096,
27+ INIT_ONLY : 8192
2828 },
2929
3030 Option : {
31- BORDER_STYLE : X.UI.Util.createChecker( 'none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset' ),
32- ALIGN : X.UI.Util.createChecker( 'left,center,right,justify' ),
33- TEXT_DECORATION : X.UI.Util.createChecker( 'none,underline,overline,line-through,blink' ),
34- TEXT_TRANSFORM : X.UI.Util.createChecker( 'none,capitalize,lowercase,uppercase' ),
35- BOX_SIZING : X.UI.Util.createChecker( 'content,padding,border' ),
36- CURSOR : X.UI.Util.createChecker( 'pointer,wait' )
37- },
38-
39- createAttrDef : function( base, defs ){
40- var F = base ? X_Object_clone( base ) : {},
41- z = base ? base._last : 0,
42- n = 1,
43- p, def;
44-
45- // 属性定義の上書き
46- for( p in defs ){
47- if( X_EMPTY_OBJECT[ p ] ) continue;
48- if( p === '_last' ) continue;
49- if( !X_Type_isArray( def = defs[ p ] ) ) continue;
50- F[ p ] = def;
51- if( !base || !X_Type_isArray( base[ p ] ) ){
52- def.No = z += n;
53- // add
54- n = def[ 3 ] & X.UI.Attr.Type.QUARTET ? 4 :
55- def[ 3 ] & X.UI.Attr.Type.COMBI ? 2 : 1;
56- } else {
57- def.No = base[ p ].No;
58- };
59- };
60- F._last = z;
61- return F;
31+ BORDER_STYLE : 'none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset',
32+ ALIGN : 'left,center,right,justify',
33+ TEXT_DECORATION : 'none,underline,overline,line-through,blink',
34+ TEXT_TRANSFORM : 'none,capitalize,lowercase,uppercase',
35+ BOX_SIZING : 'content,padding,border',
36+ CURSOR : 'pointer,wait'
6237 },
6338
6439 CSS3 : {
@@ -84,6 +59,34 @@ X.UI.Attr = {
8459 }
8560 };
8661
62+ function XUI_Attr_createAttrDef( base, defs ){
63+ var F = base ? X_Object_clone( base ) : {},
64+ z = base ? base._last : 0,
65+ n = 1,
66+ p, def;
67+
68+ // 属性定義の上書き
69+ for( p in defs ){
70+ if( X_EMPTY_OBJECT[ p ] ) continue;
71+ if( p === '_last' ) continue;
72+ if( !X_Type_isArray( def = defs[ p ] ) ) continue;
73+ F[ p ] = def;
74+ if( !base || !X_Type_isArray( base[ p ] ) ){
75+ def.No = z += n;
76+ // add
77+ n = def[ 3 ] & X.UI.Attr.Type.QUARTET ? 4 :
78+ def[ 3 ] & X.UI.Attr.Type.COMBI ? 2 : 1;
79+ } else {
80+ def.No = base[ p ].No;
81+ };
82+ if( def[ 3 ] & X.UI.Attr.Type.LIST && X_Type_isString( def[ 4 ] ) ){
83+ def[ 4 ] = XUI_createChecker( def[ 4 ] );
84+ };
85+ };
86+ F._last = z;
87+ return F;
88+ };
89+
8790 /*
8891 * 0: 初期値 : undefined は不可!
8992 * 1: dirty
@@ -91,20 +94,20 @@ X.UI.Attr = {
9194 * 3: 受け付けるデータ型
9295 * 4: 選択方式の場合、その候補
9396 */
94-X.UI.Attr.Support = X.UI.Attr.createAttrDef( false,
97+X.UI.Attr.Support = XUI_Attr_createAttrDef( 0,
9598 {
9699 className : [ null, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.DEFAULT_ONLY | X.UI.Attr.Type.STRING ],
97100 pointerHoverClass : [ null, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.DEFAULT_ONLY | X.UI.Attr.Type.STRING ],
98101 pointerDownClass : [ null, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.DEFAULT_ONLY | X.UI.Attr.Type.STRING ],
99102 invalidLayoutColor: [ null, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.DEFAULT_ONLY | X.UI.Attr.Type.COLOR ],
100103
101- role : [ 0, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.INIT_ONLY | X.UI.Attr.Type.LIST, 'none,chrome' ],
104+ role : [ 1, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.INIT_ONLY | X.UI.Attr.Type.LIST, 'none,chrome' ],
102105 selectable : [ false, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.INIT_ONLY | X.UI.Attr.Type.BOOLEAN ],
103106
104107 visible : [ true, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
105108 pointerEnabled : [ false, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
106109 pointerChildren : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
107- cursor : [ null, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.CURSOR ],
110+ cursor : [ 1, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.CURSOR ],
108111 tooltip : [ null, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.STRING ],
109112
110113 borderWidth : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.QUARTET | X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT ], // em [ top, right, bottom, left ]
@@ -116,14 +119,14 @@ X.UI.Attr.Support = X.UI.Attr.createAttrDef( false,
116119 height : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
117120 minHeight : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT ],
118121 maxHeight : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
119- sizing : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LIST, X.UI.Attr.Option.BOX_SIZING ],
122+ sizing : [ 1, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LIST, X.UI.Attr.Option.BOX_SIZING ],
120123 left : [ null, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.MINUS_LENGTH | X.UI.Attr.Type.MINUS_PERCENT ],
121124 top : [ null, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.MINUS_LENGTH | X.UI.Attr.Type.MINUS_PERCENT ],
122125 bottom : [ null, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.MINUS_LENGTH | X.UI.Attr.Type.MINUS_PERCENT ],
123126 right : [ null, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.MINUS_LENGTH | X.UI.Attr.Type.MINUS_PERCENT ],
124127
125128 borderColor : [ 0x0, X.UI.Dirty.PAINT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.QUARTET | X.UI.Attr.Type.COLOR ], // color [ top, right, bottom, left ]
126- borderStyle : [ 0, X.UI.Dirty.PAINT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.QUARTET | X.UI.Attr.Type.LIST, X.UI.Attr.Option.BORDER_STYLE ], // string [ top, right, bottom, left ]
129+ borderStyle : [ 1, X.UI.Dirty.PAINT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.QUARTET | X.UI.Attr.Type.LIST, X.UI.Attr.Option.BORDER_STYLE ], // string [ top, right, bottom, left ]
127130 bgColor : [ 0xFFFFFF, X.UI.Dirty.PAINT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.COLOR ], // color, none
128131
129132 fontColor : [ 0x0, X.UI.Dirty.PAINT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.COLOR ],
@@ -135,9 +138,9 @@ X.UI.Attr.Support = X.UI.Attr.createAttrDef( false,
135138 lineHeight : [ 1, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.NUMERICAL ], // percent
136139 letterSpacing : [ 0, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LENGTH ],
137140 wordSpacing : [ 0, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LENGTH ],
138- textAlign : [ 0, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.ALIGN ],
139- textDecoration : [ 0, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.TEXT_DECORATION ],
140- textTransform : [ 0, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.TEXT_TRANSFORM ]
141+ textAlign : [ 1, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.ALIGN ],
142+ textDecoration : [ 1, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.TEXT_DECORATION ],
143+ textTransform : [ 1, X.UI.Dirty.FONT, X.UI.Attr.USER.XNODE, X.UI.Attr.Type.LIST, X.UI.Attr.Option.TEXT_TRANSFORM ]
141144 }
142145 );
143146
--- a/0.6.x/js/20_ui/04_XUI_Event.js
+++ b/0.6.x/js/20_ui/04_XUI_Event.js
@@ -6,6 +6,9 @@ X.UI.Event = {
66 CREATION_COMPLETE : ++X_Event_last,
77 REMOVED : ++X_Event_last,
88
9+ LAYOUT_BEFORE : ++X_Event_last,
10+ LAYOUT_COMPLETE : ++X_Event_last,
11+
912 // http://d.hatena.ne.jp/edvakf/20100205/1265338487
1013 // http://d.hatena.ne.jp/uupaa/20100401/1270097629
1114 ENTER_VIEW : ++X_Event_last, // 要素が視界に入った
--- a/0.6.x/js/20_ui/05_XUI_Gesture.js
+++ b/0.6.x/js/20_ui/05_XUI_Gesture.js
@@ -91,7 +91,7 @@
9191 };
9292 numTouches = touches.length;
9393
94- console.log( 'numTouches ' + numTouches );
94+ ///console.log( 'numTouches ' + numTouches );
9595 } else
9696 // touch
9797 if ( type & TOUCH ){ //sourceEventType.match(/touch/)) {
--- a/0.6.x/js/20_ui/06_AbstractUINode.js
+++ b/0.6.x/js/20_ui/06_AbstractUINode.js
@@ -17,7 +17,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
1717 attrObject : null,
1818 unverifiedAttrs : null,
1919
20- role : null,
20+ role : 1,
2121 pointerDisabled : false,
2222 hoverClassName : null,
2323 hovering : false,
@@ -30,8 +30,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
3030
3131 boxX : 0,
3232 boxY : 0,
33- scrollWidth : 0,
34- scrollHeight : 0,
33+ scrollWidth : 0, // remove?
34+ scrollHeight : 0, // remove?
3535 boxWidth : X.UI.Attr.AUTO,
3636 minBoxWidth : 0,
3737 maxBoxWidth : X.UI.Attr.AUTO,
@@ -133,6 +133,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
133133 } else
134134 if( list && ( _v = list[ v ] ) ){
135135 // good
136+ console.log( v + ' ' + _v );
136137 v = _v;
137138 } else
138139 if( ( percent || minusPct ) && v.lastIndexOf( '%' ) !== -1 && isFinite( _v = parseFloat( v ) ) && v === _v + '%' ){
@@ -216,8 +217,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
216217 };
217218
218219 if( !X.UI.attrClassProto && user === X.UI.Attr.USER.XNODE && this.xnode ){
219- this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, this._createCssText( name ) );
220- //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + this._createCssText( name ) + ' ' + propID + ' ' + attrs[ propID ] );
220+ this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, XUI_AbstractUINode_createCssText( this, name ) );
221+ //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + XUI_AbstractUINode_createCssText( this, name ) + ' ' + propID + ' ' + attrs[ propID ] );
221222 };
222223 return;
223224 };
@@ -260,87 +261,15 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
260261 attrs[ propID ] = v;
261262 };
262263
264+ if( name && user === X.UI.Attr.USER.UINODE ){
265+ this[ name ] = v;
266+ };
267+
263268 if( name && user === X.UI.Attr.USER.XNODE && this.xnode ){
264- this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, this._createCssText( name ) );
265- //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + this._createCssText( name ) + ' ' + propID + ' ' + attrs[ propID ] );
269+ this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, XUI_AbstractUINode_createCssText( this, name ) );
270+ //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + XUI_AbstractUINode_createCssText( this, name ) + ' ' + propID + ' ' + attrs[ propID ] );
266271 } else
267- if( this.dirty < dirty ) this.dirty = dirty;
268- };
269- },
270-
271- _createCssText : function( name ){
272- var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,
273- def = this.supportAttrs[ name ],
274- no = def.No,
275- v = attrs[ def.No ],
276- type = def[ 3 ],
277- list = def[ 4 ],
278- flag = !!( type & X.UI.Attr.Type.BOOLEAN ),
279- combi = !!( type & X.UI.Attr.Type.COMBI ),
280- quartet = !!( type & X.UI.Attr.Type.QUARTET );
281-
282- if( quartet ){
283- if( attrs[ no + 1 ] === attrs[ no + 3 ] ){
284- if( v === attrs[ no + 2 ] ){
285- if( v === attrs[ no + 1 ] ){
286- return this._createCssValue( v, type, list );
287- };
288- return [
289- this._createCssValue( v, type, list ),
290- this._createCssValue( attrs[ no + 1 ], type, list )
291- ].join( ' ' );
292- };
293- return [
294- this._createCssValue( v, type, list ),
295- this._createCssValue( attrs[ no + 1 ], type, list ),
296- this._createCssValue( attrs[ no + 2 ], type, list )
297- ].join( ' ' );
298- };
299- return [
300- this._createCssValue( v, type, list ),
301- this._createCssValue( attrs[ no + 1 ], type, list ),
302- this._createCssValue( attrs[ no + 2 ], type, list ),
303- this._createCssValue( attrs[ no + 3 ], type, list )
304- ].join( ' ' );
305- } else
306- if( combi ){
307- return [
308- this._createCssValue( v, type, list ),
309- this._createCssValue( attrs[ no + 1 ], type, list )
310- ].join( ' ' );
311- } else
312- if( flag ){
313- return v ? list : 'normal'; //
314- };
315- return this._createCssValue( v, type, list );
316- },
317-
318- _createCssValue : function( v, type, list ){
319- var length = !!( type & X.UI.Attr.Type.LENGTH ),
320- minusLen = !!( type & X.UI.Attr.Type.MINUS_LENGTH ),
321- percent = !!( type & X.UI.Attr.Type.PERCENT ),
322- minusPct = !!( type & X.UI.Attr.Type.MINUS_PERCENT ),
323- numerical = !!( type & X.UI.Attr.Type.NUMERICAL ),
324- auto = !!( type & X.UI.Attr.Type.AUTO ),
325- color = !!( type & X.UI.Attr.Type.COLOR ),
326- url = !!( type & X.UI.Attr.Type.URL ),
327- fontName = !!( type & X.UI.Attr.Type.FONT_NAME );
328-
329- if( X_Type_isNumber( v ) ){
330- if( auto && v === X.UI.Attr.AUTO ) return 'auto';
331- if( length || minusLen ) return v + 'em';
332- if( numerical ) return v;
333- if( list && list[ v ] ) return list[ v ];
334- if( color ){
335- if( v < 0x100000 ){
336- v = '00000' + v.toString( 16 );
337- return '#' + v.substr( v.length - 6 );
338- };
339- return '#' + v.toString( 16 );
340- };
341- };
342- if( X_Type_isString( v ) ){
343- if( percent || minusPct || url || fontName ) return v;
272+ if( this.dirty < dirty ) this.dirty = dirty;
344273 };
345274 },
346275
@@ -420,10 +349,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
420349 this.xnode
421350 [ 'css' ]( 'left', x ? x + 'em' : 0 )
422351 [ 'css' ]( 'top', y ? y + 'em' : 0 )
423- [ 'css' ]( 'width', this.contentWidth ? X.UI._AbstractUINode.ceil( this.contentWidth ) + 'em' : 0 )
424- [ 'css' ]( 'height', this.contentHeight ? X.UI._AbstractUINode.ceil( this.contentHeight ) + 'em' : 0 )
425- [ 'css' ]( 'padding', this._createCssText( 'padding' ) )
426- [ 'css' ]( 'borderWidth', this._createCssText( 'borderWidth' ) );
352+ [ 'css' ]( 'width', this.contentWidth ? XUI_AbstractUINode_ceil( this.contentWidth ) + 'em' : 0 )
353+ [ 'css' ]( 'height', this.contentHeight ? XUI_AbstractUINode_ceil( this.contentHeight ) + 'em' : 0 )
354+ [ 'css' ]( 'padding', XUI_AbstractUINode_createCssText( this, 'padding' ) )
355+ [ 'css' ]( 'borderWidth', XUI_AbstractUINode_createCssText( this, 'borderWidth' ) );
427356 },
428357
429358 /*
@@ -431,7 +360,6 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
431360 */
432361 preMesure : function( allowedW, allowedH ){
433362 var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,
434- calc = X.UI._AbstractUINode.calcValue,
435363 box = attrs[ X.UI.Attr.Support.sizing.No ],
436364 min, max,
437365 boxL, boxT, boxR, boxB,
@@ -443,10 +371,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
443371 // 自身が constraintW の場合 親が AUTO ではない
444372 // 自身が constraintW でない場合自身が AUTO はなくかつ親 が AUTO の場合 or 自身は % でない
445373
446- paddingR = calc( attrs[ X.UI.Attr.Support.padding.No + 1 ], allowedW );
447- paddingL = calc( attrs[ X.UI.Attr.Support.padding.No + 3 ], allowedW );
448- borderR = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], allowedW );
449- borderL = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], allowedW );
374+ paddingR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 1 ], allowedW );
375+ paddingL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 3 ], allowedW );
376+ borderR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], allowedW );
377+ borderL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], allowedW );
450378 boxMinus = 0;
451379 switch( box ){
452380 case 3 : // border-box
@@ -460,9 +388,9 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
460388
461389 if( this.constraintW ? allowedW !== X.UI.Attr.AUTO : !this.autoWidth && ( allowedW !== X.UI.Attr.AUTO || !this.percentWidth ) ){
462390 if( this.constraintW ){ // 制約レイアウト
463- contentW = allowedW - ( boxL = calc( attrs[ X.UI.Attr.Support.left.No ], allowedW ) ) - ( boxR = calc( attrs[ X.UI.Attr.Support.right.No ], allowedW ) );
391+ contentW = allowedW - ( boxL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.left.No ], allowedW ) ) - ( boxR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.right.No ], allowedW ) );
464392 } else {
465- contentW = X.UI._AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.width.No ], attrs[ X.UI.Attr.Support.minWidth.No ], attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW );
393+ contentW = XUI_AbstractUINode_calcFinalValue( attrs[ X.UI.Attr.Support.width.No ], attrs[ X.UI.Attr.Support.minWidth.No ], attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW );
466394 };
467395 this.contentWidth = contentW + boxMinus;
468396 this.scrollWidth = this.contentWidth + this.contentL + this.contentR;
@@ -473,8 +401,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
473401 delete this.minBoxWidth;
474402 delete this.maxBoxWidth;
475403 } else {
476- this.minContentWidth = calc( attrs[ X.UI.Attr.Support.minWidth.No ], allowedW ) + boxMinus;
477- this.maxContentWidth = calc( attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ) + boxMinus;
404+ this.minContentWidth = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minWidth.No ], allowedW ) + boxMinus;
405+ this.maxContentWidth = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ) + boxMinus;
478406 this.scrollWidth = this.contentWidth + this.contentL + this.contentR;
479407 this.minBoxWidth = this.minContentWidth - boxMinus + this.contentL + this.contentR;
480408 this.maxBoxWidth = this.maxContentWidth - boxMinus + this.contentL + this.contentR;
@@ -484,10 +412,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
484412 //delete this.boxSizingOffsetLR;
485413 };
486414
487- paddingT = calc( attrs[ X.UI.Attr.Support.padding.No + 0 ], allowedH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して
488- paddingB = calc( attrs[ X.UI.Attr.Support.padding.No + 2 ], allowedH );
489- borderT = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], allowedH );
490- borderB = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], allowedH );
415+ paddingT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 0 ], allowedH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して
416+ paddingB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 2 ], allowedH );
417+ borderT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], allowedH );
418+ borderB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], allowedH );
491419 boxMinus = 0;
492420 switch( box ){
493421 case 3 : // border-box
@@ -502,9 +430,9 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
502430 // Height
503431 if( this.constraintH ? allowedH !== X.UI.Attr.AUTO : !this.autoHeight && ( allowedH !== X.UI.Attr.AUTO || !this.percentHeight ) ){
504432 if( this.constraintH ){ // 制約レイアウト
505- contentH = allowedH - ( boxT = calc( attrs[ X.UI.Attr.Support.top.No ], allowedH ) ) - ( boxB = calc( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) );
433+ contentH = allowedH - ( boxT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.top.No ], allowedH ) ) - ( boxB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) );
506434 } else {
507- contentH = X.UI._AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.height.No ], attrs[ X.UI.Attr.Support.minHeight.No ], attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH );
435+ contentH = XUI_AbstractUINode_calcFinalValue( attrs[ X.UI.Attr.Support.height.No ], attrs[ X.UI.Attr.Support.minHeight.No ], attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH );
508436 };
509437 this.contentHeight = contentH + boxMinus;
510438 this.scrollHeight = this.contentHeight + this.contentT + this.contentB;
@@ -515,8 +443,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
515443 delete this.minBoxHeight;
516444 delete this.maxBoxHeight;
517445 } else {
518- this.minContentHeight = calc( attrs[ X.UI.Attr.Support.minHeight.No ], allowedH ) + boxMinus;
519- this.maxContentHeight = calc( attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ) + boxMinus;
446+ this.minContentHeight = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minHeight.No ], allowedH ) + boxMinus;
447+ this.maxContentHeight = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ) + boxMinus;
520448 this.minBoxHeight = this.minContentHeight - boxMinus + this.contentT + this.contentB;
521449 this.maxBoxHeight = this.maxContentHeight - boxMinus + this.contentT + this.contentB;
522450
@@ -528,12 +456,12 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
528456
529457 if( this.parentData && this.parentData.layout.overrideAttrsForChild.left ){
530458 if( this.constraintW ){
531- this.boxX = ( boxL || boxL === 0 ) ? boxL : calc( attrs[ X.UI.Attr.Support.left.No ], allowedW );
459+ this.boxX = ( boxL || boxL === 0 ) ? boxL : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.left.No ], allowedW );
532460 } else
533461 if( attrs[ X.UI.Attr.Support.right.No ] === null ){
534- this.boxX = ( boxL || boxL === 0 ) ? boxL : calc( attrs[ X.UI.Attr.Support.left.No ], allowedW );
462+ this.boxX = ( boxL || boxL === 0 ) ? boxL : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.left.No ], allowedW );
535463 } else {
536- this.boxX = alllowW - this.boxWidth - ( ( boxR || boxR === 0 ) ? boxR : calc( attrs[ X.UI.Attr.Support.right.No ], allowedW ) );
464+ this.boxX = alllowW - this.boxWidth - ( ( boxR || boxR === 0 ) ? boxR : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.right.No ], allowedW ) );
537465 };
538466 } else {
539467 delete this.boxX;
@@ -541,12 +469,12 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
541469
542470 if( this.parentData && this.parentData.layout.overrideAttrsForChild.top ){
543471 if( this.constraintH ){
544- this.boxY = ( boxT || boxT === 0 ) ? boxT : calc( attrs[ X.UI.Attr.Support.top.No ], allowedH );
472+ this.boxY = ( boxT || boxT === 0 ) ? boxT : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.top.No ], allowedH );
545473 } else
546474 if( attrs[ X.UI.Attr.Support.bottom.No ] === null ){
547- this.boxY = ( boxT || boxT === 0 ) ? boxT : calc( attrs[ X.UI.Attr.Support.top.No ], allowedH );
475+ this.boxY = ( boxT || boxT === 0 ) ? boxT : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.top.No ], allowedH );
548476 } else {
549- this.boxY = allowedH - this.boxHeight - ( ( boxB || boxB === 0 ) ? boxB : calc( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) );
477+ this.boxY = allowedH - this.boxHeight - ( ( boxB || boxB === 0 ) ? boxB : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) );
550478 };
551479 } else {
552480 delete this.boxY;
@@ -608,7 +536,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
608536 if( w - this.boxSizingOffsetLR < this.minContentWidth ) this.contentWidth = this.minContentWidth + this.boxSizingOffsetLR;
609537 this.lastContentWidth = this.contentWidth;
610538
611- w !== this.contentWidth && xnode[ 'css' ]( 'width', X.UI._AbstractUINode.ceil( this.contentWidth ) + 'em' );
539+ w !== this.contentWidth && xnode[ 'css' ]( 'width', XUI_AbstractUINode_ceil( this.contentWidth ) + 'em' );
612540
613541 if( h === X.UI.Attr.AUTO ){
614542 this.contentHeight = h = xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ); // scrollHeight() ??
@@ -623,7 +551,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
623551 } else
624552 if( h === X.UI.Attr.AUTO ){
625553 if( w !== this.lastContentWidth ){
626- xnode[ 'css' ]( 'width', X.UI._AbstractUINode.ceil( w ) + 'em' );
554+ xnode[ 'css' ]( 'width', XUI_AbstractUINode_ceil( w ) + 'em' );
627555
628556 this.lastContentWidth = w;
629557 this.contentHeight = h = xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode );
@@ -666,7 +594,6 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
666594 */
667595 postMesure : function(){
668596 var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,
669- calc = X.UI._AbstractUINode.calcValue,
670597 box = attrs[ X.UI.Attr.Support.sizing.No ],
671598 contentW, contentH,
672599 contentPlus,
@@ -677,10 +604,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
677604 // Width
678605 if( this.boxWidth === X.UI.Attr.AUTO ){
679606 contentW = this.contentWidth;
680- paddingR = calc( attrs[ X.UI.Attr.Support.padding.No + 1 ], contentW );
681- paddingL = calc( attrs[ X.UI.Attr.Support.padding.No + 3 ], contentW );
682- borderR = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], contentW );
683- borderL = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], contentW );
607+ paddingR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 1 ], contentW );
608+ paddingL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 3 ], contentW );
609+ borderR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], contentW );
610+ borderL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], contentW );
684611 contentPlus = 0;
685612 switch( box ){
686613 case 3 : // border-box
@@ -692,8 +619,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
692619
693620 if( !this.constraintW ){
694621 contentW += contentPlus;
695- min = calc( attrs[ X.UI.Attr.Support.minWidth.No ], contentW );
696- max = calc( attrs[ X.UI.Attr.Support.maxWidth.No ], contentW );
622+ min = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minWidth.No ], contentW );
623+ max = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxWidth.No ], contentW );
697624 if( contentW < min && contentPlus < min ){
698625 this.contentWidth = min - contentPlus;
699626 } else
@@ -708,10 +635,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
708635 // Height
709636 if( this.boxHeight === X.UI.Attr.AUTO ){
710637 contentH = this.contentHeight;
711- paddingT = calc( attrs[ X.UI.Attr.Support.padding.No + 0 ], contentH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して
712- paddingB = calc( attrs[ X.UI.Attr.Support.padding.No + 2 ], contentH );
713- borderT = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], contentH );
714- borderB = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], contentH );
638+ paddingT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 0 ], contentH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して
639+ paddingB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 2 ], contentH );
640+ borderT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], contentH );
641+ borderB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], contentH );
715642 contentPlus = 0;
716643 switch( box ){
717644 case 3 : // border-box
@@ -722,8 +649,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
722649 };
723650 if( !this.constraintH ){
724651 contentH += contentPlus;
725- min = calc( attrs[ X.UI.Attr.Support.minHeight.No ], contentH );
726- max = calc( attrs[ X.UI.Attr.Support.maxHeight.No ], contentH );
652+ min = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minHeight.No ], contentH );
653+ max = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxHeight.No ], contentH );
727654 if( contentH < min && contentPlus < min ){
728655 this.contentHeight = min - contentPlus;
729656 } else
@@ -750,7 +677,9 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
750677 };
751678 },
752679
753-
680+ /*
681+ * context を明示しない場合、User が context になる!
682+ */
754683 listen : function( type, arg1, arg2, arg3 ){
755684 var root, events, counter, f;
756685 if( X.UI.Event._START_POINTER <= type && type <= X.UI.Event._END_POINTER ){
@@ -777,7 +706,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
777706 };
778707 };
779708 };
780- f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 );
709+ arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) );
781710 if( !f.kind ){
782711 return X_EventDispatcher_listen.call( this, type, this.User, f );
783712 } else
@@ -814,7 +743,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
814743 };
815744 };
816745 };
817- f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 );
746+ arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) );
818747 if( !f.kind ){
819748 return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f ] );
820749 } else
@@ -843,7 +772,83 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
843772 }
844773 );
845774
846-X.UI._AbstractUINode.calcValue = function( styleValue, srcValue ){
775+function XUI_AbstractUINode_createCssText( that, name ){
776+ var attrs = that.attrObject || that.attrClass.prototype || X.UI.AttrClass,
777+ def = that.supportAttrs[ name ],
778+ no = def.No,
779+ v = attrs[ def.No ],
780+ type = def[ 3 ],
781+ list = def[ 4 ],
782+ flag = !!( type & X.UI.Attr.Type.BOOLEAN ),
783+ combi = !!( type & X.UI.Attr.Type.COMBI ),
784+ quartet = !!( type & X.UI.Attr.Type.QUARTET );
785+
786+ if( quartet ){
787+ if( attrs[ no + 1 ] === attrs[ no + 3 ] ){
788+ if( v === attrs[ no + 2 ] ){
789+ if( v === attrs[ no + 1 ] ){
790+ return XUI_AbstractUINode_createCssValue( v, type, list );
791+ };
792+ return [
793+ XUI_AbstractUINode_createCssValue( v, type, list ),
794+ XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list )
795+ ].join( ' ' );
796+ };
797+ return [
798+ XUI_AbstractUINode_createCssValue( v, type, list ),
799+ XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list ),
800+ XUI_AbstractUINode_createCssValue( attrs[ no + 2 ], type, list )
801+ ].join( ' ' );
802+ };
803+ return [
804+ XUI_AbstractUINode_createCssValue( v, type, list ),
805+ XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list ),
806+ XUI_AbstractUINode_createCssValue( attrs[ no + 2 ], type, list ),
807+ XUI_AbstractUINode_createCssValue( attrs[ no + 3 ], type, list )
808+ ].join( ' ' );
809+ } else
810+ if( combi ){
811+ return [
812+ XUI_AbstractUINode_createCssValue( v, type, list ),
813+ XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list )
814+ ].join( ' ' );
815+ } else
816+ if( flag ){
817+ return v ? list : 'normal'; //
818+ };
819+ return XUI_AbstractUINode_createCssValue( v, type, list );
820+};
821+
822+function XUI_AbstractUINode_createCssValue( v, type, list ){
823+ var length = !!( type & X.UI.Attr.Type.LENGTH ),
824+ minusLen = !!( type & X.UI.Attr.Type.MINUS_LENGTH ),
825+ percent = !!( type & X.UI.Attr.Type.PERCENT ),
826+ minusPct = !!( type & X.UI.Attr.Type.MINUS_PERCENT ),
827+ numerical = !!( type & X.UI.Attr.Type.NUMERICAL ),
828+ auto = !!( type & X.UI.Attr.Type.AUTO ),
829+ color = !!( type & X.UI.Attr.Type.COLOR ),
830+ url = !!( type & X.UI.Attr.Type.URL ),
831+ fontName = !!( type & X.UI.Attr.Type.FONT_NAME );
832+
833+ if( X_Type_isNumber( v ) ){
834+ if( auto && v === X.UI.Attr.AUTO ) return 'auto';
835+ if( length || minusLen ) return v + 'em';
836+ if( numerical ) return v;
837+ if( list && list[ v ] ) return list[ v ];
838+ if( color ){
839+ if( v < 0x100000 ){
840+ v = '00000' + v.toString( 16 );
841+ return '#' + v.substr( v.length - 6 );
842+ };
843+ return '#' + v.toString( 16 );
844+ };
845+ };
846+ if( X_Type_isString( v ) ){
847+ if( percent || minusPct || url || fontName ) return v;
848+ };
849+};
850+
851+function XUI_AbstractUINode_calcValue( styleValue, srcValue ){
847852 /*
848853 * String の場合は必ず %
849854 */
@@ -854,14 +859,13 @@ X.UI._AbstractUINode.calcValue = function( styleValue, srcValue ){
854859 return styleValue;
855860 };
856861
857-X.UI._AbstractUINode.finalValue = function( styleValue, styleMin, styleMax, srcValue ){
858- var calc = X.UI._AbstractUINode.calcValue,
859- v = calc( styleValue, srcValue ),
860- min = calc( styleMin, srcValue ),
861- max = calc( styleMax, srcValue );
862+function XUI_AbstractUINode_calcFinalValue( styleValue, styleMin, styleMax, srcValue ){
863+ var v = XUI_AbstractUINode_calcValue( styleValue, srcValue ),
864+ min = XUI_AbstractUINode_calcValue( styleMin, srcValue ),
865+ max = XUI_AbstractUINode_calcValue( styleMax, srcValue );
862866 return v <= min ? min : max <= v ? max : v;
863867 };
864-X.UI._AbstractUINode.ceil = function( v ){
868+function XUI_AbstractUINode_ceil( v ){
865869 if( 0 <= v ){
866870 return ( v * 10 + 0.999 | 0 ) / 10;
867871 };
@@ -939,10 +943,10 @@ X.UI.AbstractUINode = X_Class_create(
939943 return X_Class_getPrivate( this )[ 'dispatch' ]( e );
940944 },
941945
942- getNextNode : function(){
946+ nextNode : function(){
943947
944948 },
945- getPrevNode : function(){
949+ prevNode : function(){
946950
947951 },
948952 nodeIndex : function( v ){
@@ -979,23 +983,6 @@ X.UI.AbstractUINode = X_Class_create(
979983 getHeight : function(){
980984 // dirty の場合、rootData.calculate
981985 return X_Class_getPrivate( this ).boxHeight;
982- },
983- scrollTo : function( x, y ){
984- X_Class_getPrivate( this ).scrollTo( x, y );
985- },
986- getScrollX : function( v ){
987- // dirty の場合、rootData.calculate
988- return X_Class_getPrivate( this ).scrollX( v );
989- },
990- getScrollY : function( v ){
991- // dirty の場合、rootData.calculate
992- return X_Class_getPrivate( this ).scrollY( v );
993- },
994- disabled : function( v ){
995- return X_Class_getPrivate( this ).disabled( v );
996- },
997- cursor : function( v ){
998- return X_Class_getPrivate( this ).cursor( v );
999986 }
1000987 }
1001988 );
--- a/0.6.x/js/20_ui/08_Box.js
+++ b/0.6.x/js/20_ui/08_Box.js
@@ -53,6 +53,8 @@ X.UI._Box = X.UI._AbstractUINode.inherits(
5353 'X.UI._Box',
5454 X_Class.PRIVATE_DATA | X_Class.SUPER_ACCESS, // 現状 super 指定がないとconstructor未定擬時に親のconstructor が使われない
5555 {
56+ supportAttrs : XUI_Attr_createAttrDef( X.UI._AbstractUINode.prototype.supportAttrs, X.UI.Layout.Canvas.overrideAttrsForSelf ),
57+
5658 layout : null,
5759 uinodes : null,
5860 xnodes : null,
@@ -66,9 +68,11 @@ X.UI._Box = X.UI._AbstractUINode.inherits(
6668
6769 Constructor : function( layout, args ){
6870 var i = 0,
69- l = args.length,
71+ l = args.length || 1,
7072 j = -1,
71- uinodes, arg, _data, attrs, support;
73+ uinodes, arg, _data, attrs, support, p;
74+
75+ //if( !args.length ) args = [ args ];
7276
7377 if( !this.User[ 'instanceOf' ]( X.UI.Box ) ){
7478 //throw new Error( 'Box を継承したインスタンスだけが _Box のオーナーになれます' );
@@ -373,13 +377,13 @@ X.UI.Box.presets = function(){
373377 };
374378
375379 if( privateKlass ){
376- supports = X.UI.Attr.createAttrDef( privateKlass.prototype.supportAttrs, layout.overrideAttrsForSelf );
380+ supports = XUI_Attr_createAttrDef( privateKlass.prototype.supportAttrs, layout.overrideAttrsForSelf );
377381
378382 klass = this.inherits( privateKlass );
379383 privateKlass.prototype.supportAttrs = supports,
380384 privateKlass.prototype.attrClass = X.UI.Attr.preset( privateKlass.prototype.attrClass, supports, attrs );
381385 } else {
382- supports = X.UI.Attr.createAttrDef( shadow.prototype.supportAttrs, layout.overrideAttrsForSelf );
386+ supports = XUI_Attr_createAttrDef( shadow.prototype.supportAttrs, layout.overrideAttrsForSelf );
383387
384388 klass = this.inherits(
385389 boxName,
--- a/0.6.x/js/20_ui/11_VBox.js
+++ b/0.6.x/js/20_ui/11_VBox.js
@@ -5,6 +5,8 @@ X.UI.Layout.Vertical = X.UI.Layout.create( {
55 overrideAttrsForSelf : {
66 selectable : false,
77 role : [ 0, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.INIT_ONLY | X.UI.Attr.Type.LIST, 'none,chrome,container' ],
8+ width : [ '100%', X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
9+ height : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
810 childWidth : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
911 childHeight : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
1012 gapY : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH ]
@@ -34,9 +36,9 @@ X.UI.Layout.Vertical = X.UI.Layout.create( {
3436 autoW = contentW === X.UI.Attr.AUTO;
3537 autoH = contentH === X.UI.Attr.AUTO;
3638 detectionPhase = autoW || autoH;
37- gapY = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.gapY.No ], contentH );
38- childW = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
39- childH = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
39+ gapY = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.gapY.No ], contentH );
40+ childW = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
41+ childH = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
4042 _x = data.contentL;
4143 _y = data.contentT;
4244
--- a/0.6.x/js/20_ui/12_HBox.js
+++ b/0.6.x/js/20_ui/12_HBox.js
@@ -4,6 +4,8 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( {
44 overrideAttrsForSelf : {
55 selectable : false,
66 role : [ 0, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.INIT_ONLY | X.UI.Attr.Type.LIST, 'none,chrome,container' ],
7+ width : [ '100%', X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
8+ height : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
79 childWidth : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
810 childHeight : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
911 gapX : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH ]
@@ -32,9 +34,9 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( {
3234 autoW = contentW === X.UI.Attr.AUTO;
3335 autoH = contentH === X.UI.Attr.AUTO;
3436 detectionPhase = autoW || autoH;
35- gapX = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );
36- childW = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
37- childH = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
37+ gapX = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );
38+ childW = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
39+ childH = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
3840 _x = data.contentL;
3941 _y = data.contentT;
4042
--- a/0.6.x/js/20_ui/13_TileBox.js
+++ b/0.6.x/js/20_ui/13_TileBox.js
@@ -35,10 +35,10 @@ X.UI.Layout.Tile = X.UI.Layout.create( {
3535 _x = data.contentL;
3636 _y = data.contentT;
3737 _w = data.contentWidth;
38- gapX = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );
39- gapY = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.gapY.No ], contentH );
40- childW = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
41- childH = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
38+ gapX = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );
39+ gapY = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.gapY.No ], contentH );
40+ childW = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
41+ childH = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
4242 numH = X.UI.Attr.FLOOR( ( _w + gapX ) / ( childW + gapX ) );
4343 numV = l % numH ? X.UI.Attr.FLOOR( l / numH ) + 1 : l / numH;
4444 _h = _y + data.contentB + ( childH + gapY ) * numH - gapY;
--- a/0.6.x/js/20_ui/14_ChromeBox.js
+++ b/0.6.x/js/20_ui/14_ChromeBox.js
@@ -15,13 +15,14 @@ X.UI._ChromeBox = X.UI._Box.inherits(
1515
1616 for( ; i; ){
1717 node = uinodes[ --i ];
18- if( node.forContainer === true ){
18+ if( node.role === 3 ){
1919 if( this.containerNode ){
2020 //throw new Error( 'ContainerNode が複数設定されています!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' + node );
2121 };
22- this.containerNode = node;
22+ this.containerNode = node.User;
23+ this._containerNode = node;
2324 } else {
24- if( !this.chromeNodes ) this.chromeNodes = [];
25+ if( !this.chromeNodes ) this.chromeNodes = [];
2526 this.chromeNodes[ this.chromeNodes.length ] = node;
2627 };
2728 };
--- a/0.6.x/js/20_ui/15_ScrollBox.js
+++ b/0.6.x/js/20_ui/15_ScrollBox.js
@@ -30,14 +30,16 @@ function X_UI_ScrollBox_momentum( current, start, time, lowerMargin, wrapperSize
3030
3131 var X_UI_ScrollBox_SUPPORT_ATTRS = {
3232 // スクロール開始するために必要な移動距離、縦か横、どちらか制限する場合、より重要
33- directionLockThreshold : [ 10, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.LENGTH ],
34- scrollX : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
35- scrollY : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
36- enabled : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
37- bounce : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
38- bounceTime : [ 600, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.TIME ],
39- useWheel : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
40- useKey : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
33+ directionLockThreshold : [ 10, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.LENGTH ],
34+ scrollXEnabled : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
35+ scrollYEnabled : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
36+ scrollEnabled : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
37+ bounceEnabled : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
38+ bounceTime : [ 600, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.TIME ],
39+ useWheel : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
40+ useKey : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
41+ hasScrollShadow : [ true, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.BOOLEAN ],
42+ scrollShadowColor : [ '#000', X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.COLOR ]
4143 };
4244
4345
@@ -49,28 +51,30 @@ X.UI._ScrollBox = X.UI._ChromeBox.inherits(
4951 //elmScroller : null,
5052 //elmScrollbar : null,
5153
52- supportAttrs : X.UI.Attr.createAttrDef( X.UI.Attr.Support, X_UI_ScrollBox_SUPPORT_ATTRS ),
54+ directionLockThreshold : 10,
55+ scrollXEnabled : true,
56+ scrollYEnabled : true,
57+ scrollEnabled : true,
58+ bounceEnabled : true,
59+ momentumEnabled : true,
60+ bounceTime : 600,
61+ useWheel : true,
62+ useKey : true,
63+ hasScrollShadow : true,
64+ scrollShadowColor : '#000',
5365
54- scrolling : false,
66+ supportAttrs : XUI_Attr_createAttrDef( X.UI.Attr.Support, X_UI_ScrollBox_SUPPORT_ATTRS ),
67+
68+ scrolling : false,
5569
5670 initiated : '',
5771 moved : false,
58- distX : 0,
59- distY : 0,
60- directionX : 0,
61- directionY : 0,
6272 directionLocked : '',
6373 startTime : 0,
6474 endTime : 0,
6575 isAnimating : false,
66- startX : 0,
67- startY : 0,
68- absStartX : 0,
69- absStartY : 0,
70- pointX : 0,
71- pointY : 0,
72- maxScrollX : 0,
73- maxScrollY : 0,
76+ isInTransition : false,
77+
7478 hasHScroll : false,
7579 hasVScroll : false,
7680
@@ -78,9 +82,23 @@ X.UI._ScrollBox = X.UI._ChromeBox.inherits(
7882 wheelTimeout : 0,
7983 requestFrameID : 0,
8084
81- _scrollX : 0,
82- _scrollY : 0,
83- scrollXPercent : 0,
85+ fontSize : 0,
86+
87+ scrollX : 0, // px
88+ scrollY : 0, // px
89+ maxScrollX : 0, // px
90+ maxScrollY : 0, // px
91+ startX : 0, // px
92+ startY : 0, // px
93+ absStartX : 0, // px
94+ absStartY : 0, // px
95+ pointX : 0, // px
96+ pointY : 0, // px
97+ distX : 0, // px
98+ distY : 0, // px
99+ directionX : 0, // px
100+ directionY : 0, // px
101+ scrollXPercent : 0, // この値は scroll 不要になっても保持される。 scroll 必要時に参照される
84102 scrollYPercent : 0,
85103
86104 lastScrollWidth : 0,
@@ -94,97 +112,49 @@ X.UI._ScrollBox = X.UI._ChromeBox.inherits(
94112 Constructor : function( layout, args ){
95113 this[ 'Super' ]( layout, args );
96114 this._containerNode = X_Class_getPrivate( this.containerNode );
115+ this._containerXNode = this._containerNode.xnode[ 'className' ]( 'ScrollSlider' ).listen( X_EVENT_ANIME_END, this, X_UI_ScrollBox_onAnimeEnd );
116+ this.xnode[ 'className' ]( 'ScrollBox' );
97117 },
98118
99119 creationComplete : function(){
100120 X.UI._Box.prototype.creationComplete.apply( this, arguments );
101121 this.scrollManager;
102- this._check();
103122 },
104123
105124 calculate : function(){
106- this.lastScrollWidth = this.scrollWidth;
107- this.lastScrollHeight = this.scrollHeight;
125+ this.lastScrollWidth = this._containerNode.boxWidth;
126+ this.lastScrollHeight = this._containerNode.boxHeight;
108127 this.lastBoxWidth = this.boxWidth;
109128 this.lastBoxHeight = this.boxHeight;
110129
111130 X.UI._Box.prototype.calculate.apply( this, arguments );
112131
132+ // TODO root の layout_complete 後に。
133+ // TODO calculate 前に scroll の解放。
134+
113135 if(
114- this.lastScrollWidth !== this.scrollWidth || this.lastScrollHeight !== this.scrollHeight ||
136+ this.lastScrollWidth !== this._containerNode.boxWidth ||
137+ this.lastScrollHeight !== this._containerNode.boxHeight ||
115138 this.lastBoxWidth !== this.boxWidth || this.lastBoxHeight !== this.boxHeight
116139 ){
117- // scroll の停止、GPU の解除
118- this._check();
140+ X_UI_rootData[ 'listenOnce' ]( X.UI.Event.LAYOUT_COMPLETE, this, X_UI_ScrollBox_onLayoutComplete );
119141 };
120-
121142 },
122143
123144 scrollBy : function( x, y, opt_time, opt_easing ){
124- this.scrollTo( this.x + x, this.y + y, opt_time, opt_easing );
145+ this.scrollTo( this.scrollX + x, this.scrollY + y, opt_time, opt_easing );
125146 },
126147
127- scrollTo : function( x, y, opt_time, opt_easing ){
128- opt_time = 0 <= opt_time ? opt_time : 0;
129- opt_easing = opt_easing || 'circular';
130-
131- this.isInTransition = !!opt_time;
132-
133- this.containerNode.animate(
134- {
135- x : this.x,
136- y : this.y
137- },
138- {
139- x : x,
140- y : y
141- },
142- opt_time, opt_easing, 1000
143- );
148+ scrollTo : function( x, y, opt_time, opt_easing, opt_release ){
149+ //if( this.scrollX === x && this.scrollY === y ) return;
150+
151+ opt_time = 0 <= opt_time ? opt_time : 0;
152+ opt_easing = opt_easing || 'circular';
153+ opt_release = 0 <= opt_release ? opt_release : 300;
144154
145- this.x = x;
146- this.y = y;
155+ this.isInTransition = 0 < opt_time;
147156
148- if( this.indicators ){
149- for( i = this.indicators.length; i--; ){
150- this.indicators[ i ].updatePosition( opt_time, opt_easing );
151- };
152- };
153- },
154-
155- _check : function(){
156- var needVScroll, needHScroll;
157- if( this.boxWidth < this._containerNode.scrollWidth || this.boxHeight < this._containerNode.scrollHeight ){
158- // scroll
159- if( this.scrolling ){
160- // fix scroll position from scrollXPercent, scrollYPercent
161- //
162-
163- } else {
164- // create scroller
165-
166-
167- this[ 'listen' ]( X.UI.Event.POINTER_START, X_UI_ScrollBox_onStart );
168-
169-
170- this._move( 0, 0 );
171-
172- this.scrolling = true;
173- };
174- } else
175- // no scroll
176- if( this.scrolling ){
177- // remove scroller
178- this[ 'unlisten' ]( X.UI.Event.POINTER_START );
179-
180- ( this._scrollX !== 0 || this._scrollY !== 0 ) && this._move( 0, 0 );
181-
182- delete this.scrolling;
183- };
184- },
185-
186- _move : function( x, y ){
187-
157+ X_UI_ScrollBox_translate( this, x, y, opt_time, opt_easing, opt_release );
188158 },
189159
190160 _remove : function(){
@@ -197,16 +167,102 @@ X.UI._ScrollBox = X.UI._ChromeBox.inherits(
197167 }
198168 );
199169
170+function X_UI_ScrollBox_onLayoutBefore( e ){
171+ //this._containerXNode.stop();
172+};
173+
174+function X_UI_ScrollBox_onLayoutComplete( e ){
175+ // scroll の停止、GPU の解除
176+ var font = this.fontSize = this._containerXNode.call( 'fontSize' );
177+
178+ this.maxScrollX = ( this.boxWidth - this._containerNode.boxWidth ) * font;
179+ this.maxScrollY = ( this.boxHeight - this._containerNode.boxHeight ) * font;
180+
181+ this.hasHScroll = this.scrollXEnabled && this.maxScrollX < 0;
182+ this.hasVScroll = this.scrollYEnabled && this.maxScrollY < 0;
183+
184+ if( !this.hasHScroll ){
185+ this.maxScrollX = 0;
186+ //this.scrollWidth = this.boxWidth;
187+ };
188+
189+ if( !this.hasVScroll ){
190+ this.maxScrollY = 0;
191+ //this.scrollHeight = this.boxHeight;
192+ };
193+
194+ delete this.endTime;
195+ delete this.directionX;
196+ delete this.directionY;
197+
198+ //this.wrapperOffset = this.xnodeWrapper[ 'offset' ]();
199+
200+ //this[ 'dispatch' ]('refresh');
201+
202+ X_UI_ScrollBox_resetPosition( this, 0 );
203+
204+ if( this.hasHScroll || this.hasVScroll ){
205+ // scroll が必要。
206+ if( this.scrolling ){
207+ this.scrollTo( this.maxScrollX * this.scrollXPercent, this.maxScrollY * this.scrollYPercent, 100 );
208+ } else {
209+ // scroller 作る
210+ this[ 'listen' ]( X.UI.Event._POINTER_DOWN, this, X_UI_ScrollBox_onStart );
211+ X_UI_rootData[ 'listen' ]( X.UI.Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore );
212+
213+ this.scrollTo( this.maxScrollX * this.scrollXPercent, this.maxScrollY * this.scrollYPercent );
214+ this.scrolling = true;
215+ };
216+ } else
217+ // scroll 不要
218+ if( this.scrolling ){
219+ // scroller 削除
220+ this[ 'unlisten' ]( X.UI.Event._POINTER_DOWN, this, X_UI_ScrollBox_onStart );
221+ X_UI_rootData[ 'unlisten' ]( X.UI.Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore );
222+
223+ ( this.scrollX !== 0 || this.scrollY !== 0 ) && this.scrollTo( 0, 0 );
224+
225+ delete this.scrolling;
226+ };
227+};
228+
229+ function X_UI_ScrollBox_translate( that, x, y, opt_time, opt_easing, opt_release ){
230+
231+ opt_time = 0 <= opt_time ? opt_time : 0;
232+ opt_easing = opt_easing === '' ? '' : opt_easing || 'circular';
233+ opt_release = 0 <= opt_release ? opt_release : 300;
234+
235+ that._containerXNode.animate(
236+ {
237+ x : that.scrollX,
238+ y : that.scrollY
239+ },
240+ {
241+ x : x | 0,
242+ y : y | 0
243+ },
244+ opt_time, opt_easing, opt_release
245+ );
246+
247+ that.scrollX = x | 0;
248+ that.scrollY = y | 0;
249+
250+ if( that.indicators ){
251+ for( i = that.indicators.length; i--; ){
252+ that.indicators[ i ].updatePosition();
253+ };
254+ };
255+ };
200256
201257 function X_UI_ScrollBox_onStart( e ){
202258 var ret = X_Callback_NONE;
203-
259+
204260 // React to left mouse button only
205261 if( e.pointerType === 'mouse' && e.button !== 0 ){
206262 return ret;
207263 };
208-
209- if( !this.enabled || ( this.initiated && e.pointerType !== this.initiated ) ){
264+
265+ if( !this.scrollEnabled || ( this.initiated && e.pointerType !== this.initiated ) ){
210266 return ret;
211267 };
212268
@@ -220,22 +276,21 @@ function X_UI_ScrollBox_onStart( e ){
220276 this.startTime = X_Timer_now();
221277
222278 // スクロール中の停止
223- if( this.isAnimating ){
224- delete this.isAnimating;
279+ if( this.isInTransition || this.isAnimating ){
280+ this.isInTransition = this.isAnimating = false;
225281 this[ 'dispatch' ]( X.UI.Event.SCROLL_END );
226282 };
227283
228- this.startX = this.x;
229- this.startY = this.y;
230- this.absStartX = this.x;
231- this.absStartY = this.y;
284+ this.startX = this.scrollX;
285+ this.startY = this.scrollY;
286+ this.absStartX = this.scrollX;
287+ this.absStartY = this.scrollY;
232288 this.pointX = e.pageX;
233289 this.pointY = e.pageY;
234290
235- this[ 'listen' ]( X.UI.Event.POINTER_MOVE, X_UI_ScrollBox_onMove );
236- this[ 'listen' ]( X.UI.Event.POINTER_END , X_UI_ScrollBox_onEnd );
291+ this[ 'listen' ]( X.UI.Event._POINTER_MOVE, this, X_UI_ScrollBox_onMove );
292+ this[ 'listen' ]( [ X.UI.Event._POINTER_UP, X.UI.Event._POINTER_CANCEL ], this, X_UI_ScrollBox_onEnd );
237293
238- //console.log( 'start : 3' );
239294 return ret | X_Callback_PREVENT_DEFAULT;
240295 };
241296
@@ -246,14 +301,15 @@ function X_UI_ScrollBox_onMove( e ){
246301 absDistX, absDistY;
247302 // 規定以上の move でスクロール開始
248303
249- if( !this.enabled || e.pointerType !== this.initiated ){
304+ if( !this.scrollEnabled || e.pointerType !== this.initiated ){
250305 return ret;
251306 };
252307
253308 // gpu の用意
254- if( !this.containerNode[ '_anime' ] ){
255- console.log( 'gpuレイヤーの用意' );
256- this._translate( this.x, this.y );
309+ if( !this._containerXNode[ '_anime' ] ){
310+ //console.log( 'gpuレイヤーの用意 ' + e.pageY );
311+ //console.log( 'mov1 x:' + this.scrollX + ' y:' + this.scrollY );
312+ X_UI_ScrollBox_translate( this, this.scrollX, this.scrollY, 0, '', 300 );
257313 return ret;
258314 };
259315
@@ -305,26 +361,29 @@ function X_UI_ScrollBox_onMove( e ){
305361 this[ 'dispatch' ]( X.UI.Event.SCROLL_MOVE );
306362 };
307363
308- newX = this.x + deltaX;// - this.minusX;
309- newY = this.y + deltaY;// - this.minusY;
364+ newX = this.scrollX + deltaX;// - this.minusX;
365+ newY = this.scrollY + deltaY;// - this.minusY;
310366
311367 // Slow down if outside of the boundaries
312368 if( 0 < newX || newX < this.maxScrollX ){
313- newX = this.bounce ? this.x + ( deltaX ) / 3 : 0 < newX ? 0 : this.maxScrollX;
369+ newX = this.bounceEnabled ? this.scrollX + ( deltaX ) / 3 : 0 < newX ? 0 : this.maxScrollX;
314370 };
371+
315372 if( 0 < newY || newY < this.maxScrollY ){
316- newY = this.bounce ? this.y + ( deltaY ) / 3 : 0 < newY ? 0 : this.maxScrollY;
373+ //console.log( 'slow... ' + newY + ' ' + this.maxScrollY );
374+ newY = this.bounceEnabled ? this.scrollY + ( deltaY ) / 3 : 0 < newY ? 0 : this.maxScrollY;
317375 };
318376
319377 this.directionX = 0 < deltaX ? -1 : deltaX < 0 ? 1 : 0;
320378 this.directionY = 0 < deltaY ? -1 : deltaY < 0 ? 1 : 0;
321379
322- this._translate( newX, newY );
380+ //console.log( 'mov2 x:' + newX + ' y:' + newY );
381+ X_UI_ScrollBox_translate( this, newX, newY, 0, '', 300 );
323382
324383 if( 300 < timestamp - this.startTime ){
325384 this.startTime = timestamp;
326- this.startX = this.x;
327- this.startY = this.y;
385+ this.startX = this.scrollX;
386+ this.startY = this.scrollY;
328387 };
329388 // イベントの拘束
330389 return ret | X_Callback_PREVENT_DEFAULT | X_Callback_MONOPOLY;
@@ -336,12 +395,12 @@ function X_UI_ScrollBox_onEnd( e ){
336395 easing = '',
337396 newX, newY,
338397 momentumX, momentumY,
339- duration, distanceX, distanceY;
398+ duration, distanceX, distanceY, font;
340399
341- this[ 'unlisten' ]( X.UI.Event.POINTER_MOVE, X_UI_ScrollBox_onMove );
342- this[ 'unlisten' ]( X.UI.Event.POINTER_END, X_UI_ScrollBox_onEnd );
400+ this[ 'unlisten' ]( X.UI.Event._POINTER_MOVE, this, X_UI_ScrollBox_onMove );
401+ this[ 'unlisten' ]( [ X.UI.Event._POINTER_UP, X.UI.Event._POINTER_CANCEL ], this, X_UI_ScrollBox_onEnd );
343402
344- if( !this.enabled || e.pointerType !== this.initiated ){
403+ if( !this.scrollEnabled || e.pointerType !== this.initiated ){
345404 return ret;
346405 };
347406
@@ -350,13 +409,13 @@ function X_UI_ScrollBox_onEnd( e ){
350409 this.endTime = X_Timer_now();
351410
352411 duration = this.endTime - this.startTime;
353- newX = Math.round( this.x );
354- newY = Math.round( this.y );
412+ newX = Math.round( this.scrollX );
413+ newY = Math.round( this.scrollY );
355414 distanceX = Math.abs(newX - this.startX);
356415 distanceY = Math.abs(newY - this.startY);
357416
358417 // reset if we are outside of the boundaries
359- if( X_UI_ScrollBox_resetPosition( this, this.options.bounceTime ) ){
418+ if( X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){
360419 return ret;
361420 };
362421
@@ -365,116 +424,85 @@ function X_UI_ScrollBox_onEnd( e ){
365424 // this[ 'dispatch' ]( X_EVENT_CANCELED );
366425 return ret;
367426 };
368-
369- this.scrollTo( newX, newY, 0 ); // ensures that the last position is rounded
370427
371428 // start momentum animation if needed
372- if( this.options.momentum && duration < 300 ){
429+ if( this.momentumEnabled && duration < 300 ){
430+ font = this.fontSize;
373431 momentumX = this.hasHScroll ?
374- X_UI_ScrollBox_momentum( this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration ) :{ destination: newX, duration: 0 };
432+ X_UI_ScrollBox_momentum( this.scrollX, this.startX, duration, this.maxScrollX, this.bounceEnabled ? this.boxWidth * font : 0, this.deceleration ) :
433+ { destination: newX, duration: 0 };
375434 momentumY = this.hasVScroll ?
376- X_UI_ScrollBox_momentum( this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration ) : { destination: newY, duration: 0 };
435+ X_UI_ScrollBox_momentum( this.scrollY, this.startY, duration, this.maxScrollY, this.bounceEnabled ? this.boxHeight * font : 0, this.deceleration ) :
436+ { destination: newY, duration: 0 };
377437 newX = momentumX.destination;
378438 newY = momentumY.destination;
379- time = Math.max( momentumX.duration, momentumY.duration );
380- this.isInTransition = 1;
439+ time = Math.max( momentumX.duration, momentumY.duration ) | 0;
440+ this.isInTransition = true;
441+ } else {
442+ //console.log( '慣性無し' );
381443 };
382444
383- if( newX != this.x || newY != this.y ){
445+ if( newX != this.scrollX || newY != this.scrollY ){
384446 // change easing function when scroller goes out of the boundaries
385447 if( 0 < newX || newX < this.maxScrollX || 0 < newY || newY < this.maxScrollY ){
386448 easing = 'quadratic';
387449 };
388450
389- this.scrollTo( newX, newY, time, easing );
451+ //console.log( 'end2 x:' + newX + ' y:' + newY + ' t:' + time );
452+ this.scrollTo( newX, newY, time, easing, 1000 );
390453 return ret;
391454 };
392455
456+ //console.log( 'end1 x:' + newX + ' y:' + newY );
457+ this.scrollTo( newX, newY, 0, '', 1000 ); // ensures that the last position is rounded
458+
393459 this[ 'dispatch' ]( X.UI.Event.SCROLL_END );
394460
395461 return ret;
396462 };
397463
398464 function X_UI_ScrollBox_resetPosition( that, time ){
399- var x = this.x,
400- y = this.y;
465+ var x = that.scrollX,
466+ y = that.scrollY;
401467
402468 time = time || 0;
403469
404- if( !this.hasHScroll || 0 < this.x ){
470+ if( !that.hasHScroll || 0 < that.scrollX ){
405471 x = 0;
406472 } else
407- if( this.x < this.maxScrollX ){
408- x = this.maxScrollX;
473+ if( that.scrollX < that.maxScrollX ){
474+ x = that.maxScrollX;
409475 };
410476
411- if( !this.hasVScroll || 0 < this.y ){
477+ if( !that.hasVScroll || 0 < that.scrollY ){
412478 y = 0;
413479 } else
414- if( this.y < this.maxScrollY ){
415- y = this.maxScrollY;
480+ if( that.scrollY < that.maxScrollY ){
481+ y = that.maxScrollY;
416482 };
417483
418- if( x === this.x && y === this.y ){
419- console.log( 'no バウンド' );
484+ if( x === that.scrollX && y === that.scrollY ){
485+ //console.log( 'no バウンド y:' + y + ' max:' + that.maxScrollY );
420486 return false;
421487 };
422488
423- console.log( 'バウンド!' );
424- this.scrollTo( x, y, time, this.options.bounceEasing );
489+ //console.log( 'バウンド!' );
490+ //console.log( 'rese x:' + x + ' y:' + y );
491+ that.scrollTo( x, y, time, that.bounceEasing, 1000 );
425492
426493 return true;
427494 };
428495
429-function X_UI_ScrollBox_translate( x, y ){
430- this.containerNode.animate(
431- {
432- x : this.x,
433- y : this.y
434- },
435- {
436- x : x,
437- y : y
438- },
439- 0, '', 300
440- );
441-
442- this.x = x;
443- this.y = y;
444-
445- if( this.indicators ){
446- for( i = this.indicators.length; i--; ){
447- this.indicators[ i ].updatePosition();
448- };
449- };
450-};
451-
452-function X_UI_ScrollBox_refresh( remove ){
453- this.maxScrollX = this.boxWidth - this.containerNode.boxWidth;
454- this.maxScrollY = this.boxHeight - this.containerNode.boxHeight;
455-
456- this.hasHScroll = this.User[ 'attr' ]( 'scrollX' ) && this.maxScrollX < 0;
457- this.hasVScroll = this.User[ 'attr' ]( 'scrollY' ) && this.maxScrollY < 0;
458-
459- if( !this.hasHScroll ){
460- this.maxScrollX = 0;
461- this.scrollerWidth = this.wrapperWidth;
496+function X_UI_ScrollBox_onAnimeEnd( e ){
497+ if( e.target !== this._containerXNode || !this.isInTransition ){
498+ return X_Callback_NONE;
462499 };
463-
464- if( !this.hasVScroll ){
465- this.maxScrollY = 0;
466- this.scrollerHeight = this.wrapperHeight;
500+ //this.xnodeScroller.stop();
501+ if( !X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){
502+ this.isInTransition = false;
503+ this.dispatch( X.UI.Event.SCROLL_END );
467504 };
468-
469- delete this.endTime;
470- delete this.directionX;
471- delete this.directionY;
472-
473- this.wrapperOffset = this.xnodeWrapper[ 'offset' ]();
474-
475- //this[ 'dispatch' ]('refresh');
476-
477- X_UI_ScrollBox_resetPosition( this, 0 );
505+ return X_Callback_NONE;
478506 };
479507
480508 X.UI.ScrollBox = X.UI.ChromeBox.inherits(
@@ -483,7 +511,17 @@ X.UI.ScrollBox = X.UI.ChromeBox.inherits(
483511 X.UI._ScrollBox,
484512 {
485513 Constructor : function(){
486- var args = [],
514+ var args = [
515+ 0, // layout
516+ {
517+ name : 'ScrollBox-Scroller',
518+ role : 'container',
519+ width : 'auto',
520+ minWidth : '100%',
521+ height : 'auto',
522+ minHeight : '100%'
523+ }
524+ ],
487525 i = arguments.length,
488526 arg, layout;
489527
@@ -495,24 +533,20 @@ X.UI.ScrollBox = X.UI.ChromeBox.inherits(
495533 args[ args.length ] = arg;
496534 };
497535 };
498- /*
499- this.style = DisplayNodeStyle( this,
500- X_Class_newPrivate(
501- this,
502- X.UI.Layout.Canvas,
503- [
504- Box(
505- layout || VerticalLayoutManager,
506- {
507- name : 'ScrollBox-Scroller',
508- role : 'container'
509- },
510- args
511- )
512- ]
513- )
536+
537+ args[ 0 ] = X.UI.Layout.Vertical;
538+
539+ X_Class_newPrivate(
540+ this,
541+ X.UI.Layout.Canvas,
542+ [
543+ {
544+ width : '100%',
545+ height : '100%'
546+ },
547+ X.UI.VBox.apply( 0, args )
548+ ]
514549 );
515- this.style.addName( 'ScrollBox' ); */
516550 },
517551 scrollX : function(){
518552
--- a/0.6.x/js/20_ui/20_PageRoot.js
+++ b/0.6.x/js/20_ui/20_PageRoot.js
@@ -114,7 +114,7 @@ X.UI._PageRoot = X.UI._Box.inherits(
114114 } );
115115
116116 // hover や rollover rollout のための move イベントの追加
117- this.xnodeInteractiveLayer[ 'listen' ]( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], X_UI_eventRellay );
117+ this.xnodeInteractiveLayer[ 'listen' ]( 'pointermove', X_UI_eventRellay );
118118 if( counter[ X.UI.Event._POINTER_MOVE ] ){
119119 ++counter[ X.UI.Event._POINTER_MOVE ];
120120 } else {
@@ -145,12 +145,16 @@ X.UI._PageRoot = X.UI._Box.inherits(
145145 };
146146 },
147147 calculate : function( e ){
148- var size = X[ 'ViewPort' ][ 'getSize' ](),
149- font = X[ 'ViewPort' ][ 'getBaseFontSize' ](),
150- w = size[ 0 ],
151- h = size[ 1 ];
152- this.layout.calculate( this, false, 0, 0, w / font, h / font );
148+ var size, font, w, h;
149+
150+ this[ 'dispatch' ]( X.UI.Event.LAYOUT_BEFORE );
151+
152+ size = X[ 'ViewPort' ][ 'getSize' ]();
153+ font = X[ 'ViewPort' ][ 'getBaseFontSize' ]();
154+ this.layout.calculate( this, false, 0, 0, size[ 0 ] / font, size[ 1 ] / font );
153155 this.calcReserved = false;
156+
157+ X_ViewPort[ 'listenOnce' ]( X_EVENT_AFTER_UPDATE, this, XUI_PageRoot_onViewUpdate );
154158 },
155159
156160 updateCoursor : function( cursor ){
@@ -164,6 +168,10 @@ X.UI._PageRoot = X.UI._Box.inherits(
164168 }
165169 );
166170
171+function XUI_PageRoot_onViewUpdate( e ){
172+ this[ 'dispatch' ]( X.UI.Event.LAYOUT_COMPLETE );
173+};
174+
167175 X.UI.PageRoot = X.UI.Box.presets(
168176 'PageRoot',
169177 X.UI._PageRoot,
旧リポジトリブラウザで表示