• R/O
  • HTTP
  • SSH
  • HTTPS

pettanr: コミット

サーバ側、Railsシステム本体


コミットメタ情報

リビジョン0d4a780c015a71a5a9aff4effd6d5db1de879646 (tree)
日時2013-02-04 23:23:58
作者itozyun <itozyun@user...>
コミッターitozyun

ログメッセージ

Client is version 0.5.46, fixed picture.id

変更サマリ

差分

--- a/app/assets/javascripts/peta-apps.js
+++ b/app/assets/javascripts/peta-apps.js
@@ -1,6 +1,6 @@
11 /*
22 * pettanR peta.apps.js
3- * version 0.5.44
3+ * version 0.5.46
44 *
55 * author:
66 * itozyun
@@ -447,6 +447,7 @@
447447 this.viewerApplicationList = function( file ){
448448 var data = FileAPI.getFileData( file ),
449449 type = data !== null ? data.type : null;
450+ if( data === FILE_DATA_MY_ORIGINAL_PICTURES_ROOT ) return [ PremiumSatge ];
450451 switch( type ){
451452 case FILE_TYPE.COMIC :
452453 case FILE_TYPE.PANEL :
@@ -458,10 +459,7 @@
458459 break;
459460 case FILE_TYPE.ARTIST :
460461 return [ PremiumSatge ];
461- default :
462- if( data === FILE_DATA_MY_ORIGINAL_PICTURES_ROOT ){
463- return [ PremiumSatge ];
464- };
462+ default :
465463 };
466464 return [];
467465 };
@@ -853,9 +851,9 @@ var PremiumSatge = gOS.registerApplication( function(){
853851 var ImageGroupIconClass = function( index, data ){
854852 var elmIconWrap = elmIconOrigin.cloneNode( true ),
855853 elmIconTitle = Util.getElementsByClassName( elmIconWrap, 'image-group-item-title' )[ 0 ],
856- originalPicture = data.original_picture,
854+ originalPicture = data.original_picture || data,
857855 SRC = [ BASE_PATH, data.id, '.', data.ext ].join( ''),
858- LOW_SRC = originalPicture.filesize && originalPicture.filesize > LIMIT_FILESIZE ? [ THUMB_PATH, data.id, '.', originalPicture.ext ].join( '') : null,
856+ LOW_SRC = originalPicture.filesize && originalPicture.filesize > LIMIT_FILESIZE ? [ THUMB_PATH, data.id, '.', data.ext ].join( '' ) : null,
859857 reversibleImage = null,
860858 timer = null,
861859 onEnterFlag = false,
@@ -3488,7 +3486,7 @@ var Editor = gOS.registerApplication( function(){
34883486 };
34893487 function change(){
34903488 if( currentElement === null ) return;
3491- PremiumSatge.boot( currentElement.artistID, currentElement.resourcePicture, currentElement );
3489+ PremiumSatge.boot( currentElement.artistID, currentElement.realPicture, currentElement );
34923490 };
34933491
34943492 return {
@@ -3685,8 +3683,6 @@ var Editor = gOS.registerApplication( function(){
36853683 this.flipV = data.height < 0 ? -1 : 1;
36863684 this.flipH = data.width < 0 ? -1 : 1;
36873685 this.rPicture = data.picture;
3688- //this.oPicture = this.rPicture.original_picture;
3689- //this.artistID = this.oPicture.artist.id || -1;
36903686
36913687 var self = this;
36923688 function animeComplete(){
@@ -3712,7 +3708,7 @@ var Editor = gOS.registerApplication( function(){
37123708 this.flipV = updateV === true ? -this.flipV : this.flipV;
37133709 this.reversibleImage.resize( this.flipH * this.w, this.flipV * this.h );
37143710 },
3715- resourcePicture : function( _rPicture ){
3711+ realPicture : function( _rPicture ){
37163712 if( _rPicture && _rPicture !== this.rPicture ){
37173713 HISTORY_CONTROL.saveState( this._updateResourcePicture, this.rPicture, _rPicture, this );
37183714 this._updateResourcePicture( _rPicture );
@@ -3757,7 +3753,7 @@ var Editor = gOS.registerApplication( function(){
37573753 this.actualH = this.oPicture.height;
37583754
37593755 var _reversibleImage = pettanr.image.createReversibleImage(
3760- [ pettanr.CONST.RESOURCE_PICTURE_PATH, this.rPicture.id, '.', this.rPicture.ext ].join( '' ),
3756+ [ pettanr.CONST.PICTURE_PATH, this.rPicture.id, '.', this.rPicture.ext ].join( '' ),
37613757 this.flipH * this.w, this.flipV * this.h
37623758 );
37633759 if( this.reversibleImage !== null ){
@@ -4071,7 +4067,7 @@ var Editor = gOS.registerApplication( function(){
40714067 var _panelElement;
40724068 if( isPanelPictureData !== true ){
40734069 _panelElement = new ImageElementClass( {
4074- picture : data,
4070+ picture : data.picture,
40754071 x : Math.floor( panelW / 2 - data.width / 2 ),
40764072 y : Math.floor( panelH / 2 - data.height / 2 ),
40774073 z : -1,
@@ -5041,7 +5037,7 @@ var Model = ( function(){
50415037 function getPanelElementByTiming(){
50425038 var i, l = panelElementArray.length;
50435039 while( timing < l * 2 ){
5044- for( i=0; i<l; ++i ){
5040+ for( i = 0; i < l; ++i ){
50455041 if( timing === panelElementArray[ i ].timing ){
50465042 // console.log( timing + ' , ' + panelElementArray[ i ].timing );
50475043 ++timing;
@@ -5053,9 +5049,10 @@ var Model = ( function(){
50535049 return null;
50545050 };
50555051 function panelElementToHtml( _panelElement, isAbsoluteUrl, isXHTML ){
5056- var url;
5052+ var rPic, url;
50575053 if( _panelElement.type === 0 ){
5058- url = [ pettanr.CONST.RESOURCE_PICTURE_PATH, _panelElement.resourcePicture().id, '.', _panelElement.resourcePicture().ext ].join( '' );
5054+ rPic = _panelElement.realPicture();
5055+ url = [ pettanr.CONST.RESOURCE_PICTURE_PATH, rPic.id, '.', rPic.ext ].join( '' );
50595056 return [
50605057 '<img ',
50615058 'src="', isAbsoluteUrl !== true ? url : Util.getAbsolutePath( url ), '" ',
@@ -5094,12 +5091,13 @@ var Model = ( function(){
50945091 };
50955092 };
50965093 function getImageJsonGET( _imageElement ){
5097- var cr = pettanr.LINE_FEED_CODE_TEXTAREA;
5094+ var cr = pettanr.LINE_FEED_CODE_TEXTAREA,
5095+ rPic = _imageElement.realPicture();
50985096 return [
50995097 '{', cr,
51005098 '"resource_picture": {', cr,
5101- '"id": ', _imageElement.resourcePicture().id, ',', cr,
5102- '"ext": ', '"',_imageElement.resourcePicture().ext, '"', cr,
5099+ '"id": ', rPic.id, ',', cr,
5100+ '"ext": ', '"', rPic.ext, '"', cr,
51035101 '},', cr,
51045102 '"x": ', _imageElement.x, ',', cr,
51055103 '"y": ', _imageElement.y, ',', cr,
@@ -5114,7 +5112,7 @@ var Model = ( function(){
51145112 var cr = pettanr.LINE_FEED_CODE_TEXTAREA;
51155113 return [
51165114 '{', cr,
5117- '"picture_id": ', _imageElement.resourcePicture().id, ',', cr,
5115+ '"picture_id": ', _imageElement.realPicture().id, ',', cr,
51185116 '"x": ', _imageElement.x, ',', cr,
51195117 '"y": ', _imageElement.y, ',', cr,
51205118 '"z": ', _imageElement.z + 1, ',', cr,
--- a/app/assets/javascripts/peta-common.js
+++ b/app/assets/javascripts/peta-common.js
@@ -1,6 +1,6 @@
11 /*
22 * pettanR peta.common.js
3- * version 0.5.45
3+ * version 0.5.46
44 *
55 * author:
66 * itozyun
@@ -96,6 +96,7 @@ pettanr.CONST = ( function(){
9696 NS_PETTANR_COMIC : 'pettanr-comic',
9797 THUMBNAIL_PATH : SERVER_SUPPORT === false ? RELATIVE + 'resource_pictures\/thumbnail\/' : PETTANR_ROOT_PATH + 'resource_pictures\/',
9898 RESOURCE_PICTURE_PATH : SERVER_SUPPORT === false ? RELATIVE + 'resource_pictures\/' : PETTANR_ROOT_PATH + 'resource_pictures\/full\/',
99+ ORIGINAL_PICTURE_PATH : SERVER_SUPPORT === false ? RELATIVE + 'resource_pictures\/' : PETTANR_ROOT_PATH + 'original_pictures\/',
99100 PICTURE_PATH : SERVER_SUPPORT === false ? RELATIVE + 'pictures\/' : PETTANR_ROOT_PATH + 'pictures\/',
100101 SYSTEM_PICTURE_PATH : ( SERVER_SUPPORT === false ? RELATIVE : PETTANR_ROOT_PATH ) + 'system_pictures\/',
101102 CREATE_COMIC_JS : SERVER_SUPPORT === false ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js',
--- a/app/assets/javascripts/system.js
+++ b/app/assets/javascripts/system.js
@@ -1,6 +1,6 @@
11 /*
22 * pettanR system.js
3- * version 0.5.44
3+ * version 0.5.46
44 *
55 * gadgetOS
66 * author:
@@ -135,8 +135,7 @@ var Class = ( function(){
135135 dataUser = null,
136136 traits = null,
137137 f = true,
138- c = Util.copyArray,
139- a; /* arguments */
138+ copyArray = Util.copyArray;
140139
141140 function getClass( instance ){
142141 var cList = CLASS_LIST,
@@ -186,7 +185,7 @@ var Class = ( function(){
186185 * http://d.hatena.ne.jp/m-hiyama/20051018/1129605002
187186 */
188187 function inherits( /* displayName, classSetting, opt_PrivateClass, props */ ){
189- var args = c( arguments ),
188+ var args = copyArray( arguments ),
190189 params = [],
191190 Super = this,
192191 superDef = getClassDef( Super ),
@@ -307,7 +306,7 @@ var Class = ( function(){
307306
308307 /* privateDataclass をもつクラスに追加されるメソッド */
309308 function newPrivateData( /* instance, args */ ){
310- var args = c( arguments ),
309+ var args = copyArray( arguments ),
311310 user = args.shift(),
312311 def = getClassDef( user ),
313312 privateClass = def.privateClass,
@@ -361,7 +360,7 @@ var Class = ( function(){
361360 userDef.userList.push( dataUser );
362361 } else {
363362 def.live && def.live.push( instance );
364- args = c( arguments );
363+ args = copyArray( arguments );
365364 };
366365 def[ CONSTRUCTOR ] && def[ CONSTRUCTOR ].apply( instance, args );
367366 return instance;
@@ -374,7 +373,7 @@ var Class = ( function(){
374373 SUPER_ACCESS : 8,
375374 PRIVATE_DATA : 16,
376375 create : function( /* displayName, classSetting, opt_PrivateClass, props */ ){
377- var args = c( arguments ),
376+ var args = copyArray( arguments ),
378377 displayName = args[ 0 ],
379378 classSetting,
380379 opt_pool, opt_abstract, opt_final, opt_private,
@@ -417,7 +416,7 @@ var Class = ( function(){
417416 classDef[ CONSTRUCTOR ] = props[ CONSTRUCTOR ];
418417 };
419418
420- klass = function(){ a = arguments; if( f ) return C.apply( a.callee, c( a ) )};
419+ klass = function(){ var a = arguments; if( f ) return C.apply( a.callee, a )};
421420 klass.prototype = override( override( traits || {}, props, true ), CommonProps, false );
422421
423422 if( opt_abstract === true ){
@@ -1112,30 +1111,30 @@ var File = ( function(){
11121111 // simpleDeepCopy
11131112 var driver = FILE_CONTROLER.getDriver( this ),
11141113 data;
1115- if( Type.isFunction( driver.read ) === true ){
1114+ if( Type.isFunction( driver.read ) === true ){
11161115 data = driver.read( this );
11171116 };
11181117 return BASE_DRIVER.read( data || this );
11191118 },
11201119 write: function( _newData, _onUpdateFunction ){
11211120 var driver = FILE_CONTROLER.getDriver( this );
1122- if( typeof driver.write === 'function'){
1121+ if( typeof driver.write === 'function' ){
11231122 return driver.write( this, _newData, _onUpdateFunction );
1124- }
1123+ };
11251124 return BASE_DRIVER.write( this, _newData, _onUpdateFunction );
11261125 },
11271126 viewerApplicationList: function(){
11281127 var driver = FILE_CONTROLER.getDriver( this );
1129- if( typeof driver.viewerApplicationList === 'function'){
1128+ if( typeof driver.viewerApplicationList === 'function' ){
11301129 return driver.viewerApplicationList( this );
1131- }
1130+ };
11321131 return BASE_DRIVER.viewerApplicationList( this );
11331132 },
11341133 editorApplicationList: function(){
11351134 var driver = FILE_CONTROLER.getDriver( this );
1136- if( typeof driver.editorApplicationList === 'function'){
1135+ if( typeof driver.editorApplicationList === 'function' ){
11371136 return driver.editorApplicationList( this );
1138- }
1137+ };
11391138 return BASE_DRIVER.viwerApps( this );
11401139 },
11411140 create: function(){
@@ -7167,41 +7166,289 @@ var XBrowserStyle = ( function(){
71677166
71687167 var XDocument = ( function( window, document ){
71697168
7170- var getIndex = Util.getIndex;
7169+ var getIndex = Util.getIndex;
7170+ var ROOT_LIST = [];
7171+ var DEF_ATTRS = {};
7172+ var AUTO = undefined;
7173+ var FULL = DEF_ATTRS; // something unigue value;
7174+ var FLOOR = Math.floor;
71717175
7172- var DEF_ATTRS = [];
7176+ DEF_ATTRS.LENGTH = 1;
7177+ DEF_ATTRS.PERCENT = 2;
7178+ DEF_ATTRS.COLOR = 4;
7179+ DEF_ATTRS.U_DECIMAL = 8;
7180+ DEF_ATTRS.NUMERICAL = 16;
7181+ DEF_ATTRS.BOOLEAN = 32;
7182+ DEF_ATTRS.QUARTET = 64;
7183+ DEF_ATTRS.URL = 128;
7184+ DEF_ATTRS.FONT_NAME = 256;
7185+ DEF_ATTRS.LIST = 512;
7186+ DEF_ATTRS.AUTO = 1024;
7187+ DEF_ATTRS.COMBI = 2048;
7188+ DEF_ATTRS.BORDER_STYLE = 'none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset'.split(',');
7189+ DEF_ATTRS.POSITION_X = 'left,center,right'.split(',');
7190+ DEF_ATTRS.POSITION_Y = 'top,center,bottom'.split(',');
7191+ DEF_ATTRS.ALIGN = 'left,center,right,justify'.split(',');
7192+ DEF_ATTRS.TEXT_DECORATION = 'none,underline,overline,line-through,blink'.split(',');
7193+ DEF_ATTRS.TEXT_TRANSFORM = 'none,capitalize,lowercase,uppercase'.split(',');
7194+ DEF_ATTRS.WIDTH_HEIGHT = 'auto'.split(',');
7195+ DEF_ATTRS.BOX_SIZING = 'content-box,padding-box,border-box,margin-box'.split(',');
7196+ DEF_ATTRS.PAINT = 1; // 再描画のみ必要
7197+ DEF_ATTRS.REFLOW = 2; // レイアウトの再計算が必要
71737198
7174- var AbstractLayoutManager = Class.create(
7175- 'AbstractLayoutManager',
7176- Class.ABSTRACT, {
7177- reflow : function(){}
7178- }
7179- );
7199+ DEF_ATTRS.borderWidth = [ DEF_ATTRS.REFLOW, 0, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH ]; // em [ top, right, bottom, left ]
7200+ DEF_ATTRS.borderColor = [ DEF_ATTRS.PAINT, 4, DEF_ATTRS.QUARTET | DEF_ATTRS.DEF_COLOR ]; // color [ top, right, bottom, left ]
7201+ DEF_ATTRS.borderStyle = [ DEF_ATTRS.REFLOW, 8, DEF_ATTRS.QUARTET | DEF_ATTRS.LIST, DEF_ATTRS.BORDER_STYLE ]; // string [ top, right, bottom, left ]
7202+ DEF_ATTRS.cornerRadius = [ DEF_ATTRS.PAINT, 12, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ]; // em, px [ top, right, bottom, left ]
7203+ DEF_ATTRS.bgColor = [ DEF_ATTRS.PAINT, 16, DEF_ATTRS.COLOR ]; // color
7204+ DEF_ATTRS.bgAlpha = [ DEF_ATTRS.PAINT, 17, DEF_ATTRS.U_DECIMAL ]; // 0 - 1
7205+ DEF_ATTRS.bgImgUrl = [ DEF_ATTRS.PAINT, 18, DEF_ATTRS.URL ]; // url
7206+ DEF_ATTRS.bgImgRepeatX = [ DEF_ATTRS.PAINT, 19, DEF_ATTRS.BOOLEAN ]; // true / false
7207+ DEF_ATTRS.bgImgRepeatY = [ DEF_ATTRS.PAINT, 20, DEF_ATTRS.BOOLEAN ]; // true / false
7208+ DEF_ATTRS.bgImgPositionX = [ DEF_ATTRS.PAINT, 21, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT | DEF_ATTRS.LIST, DEF_ATTRS.POSITION_X ]; // em %, px, string
7209+ DEF_ATTRS.bgImgPositionY = [ DEF_ATTRS.PAINT, 22, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT | DEF_ATTRS.LIST, DEF_ATTRS.POSITION_Y ]; // em %, px, string
7210+ DEF_ATTRS.shadowColor = [ DEF_ATTRS.PAINT, 23, DEF_ATTRS.COLOR ]; // color
7211+ DEF_ATTRS.shadowAlpha = [ DEF_ATTRS.PAINT, 24, DEF_ATTRS.U_DECIMAL ]; // 0 - 1
7212+ DEF_ATTRS.shadowOffsetX = [ DEF_ATTRS.PAINT, 25, DEF_ATTRS.LENGTH ]; // em
7213+ DEF_ATTRS.shadowOffsetY = [ DEF_ATTRS.PAINT, 26, DEF_ATTRS.LENGTH ]; // em
7214+ DEF_ATTRS.shadowBlur = [ DEF_ATTRS.PAINT, 27, DEF_ATTRS.LENGTH ]; // em
7215+ DEF_ATTRS.shadowSpread = [ DEF_ATTRS.PAINT, 28, DEF_ATTRS.LENGTH ]; // em
7216+ DEF_ATTRS.shadowInset = [ DEF_ATTRS.PAINT, 29, DEF_ATTRS.BOOLEAN ]; // true / false
7217+
7218+ DEF_ATTRS.color = [ DEF_ATTRS.PAINT, 30, DEF_ATTRS.COLOR ]; // color
7219+ DEF_ATTRS.fontFamily = [ DEF_ATTRS.REFLOW, 31, DEF_ATTRS.FONT_NAME ]; // string
7220+ DEF_ATTRS.fontSize = [ DEF_ATTRS.REFLOW, 32, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ]; // em, %
7221+ DEF_ATTRS.bold = [ DEF_ATTRS.REFLOW, 33, DEF_ATTRS.BOOLEAN ]; // true / false
7222+ DEF_ATTRS.italic = [ DEF_ATTRS.REFLOW, 34, DEF_ATTRS.BOOLEAN ]; // true / false
7223+ DEF_ATTRS.lineHeight = [ DEF_ATTRS.REFLOW, 35, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT | DEF_ATTRS.NUMERICAL ]; // em, %,
7224+ DEF_ATTRS.letterSpacing = [ DEF_ATTRS.REFLOW, 36, DEF_ATTRS.LENGTH ]; // em
7225+ DEF_ATTRS.wordSpacing = [ DEF_ATTRS.REFLOW, 37, DEF_ATTRS.LENGTH ];
7226+ DEF_ATTRS.align = [ DEF_ATTRS.REFLOW, 38, DEF_ATTRS.LIST, DEF_ATTRS.ALIGN ];
7227+ DEF_ATTRS.decoration = [ DEF_ATTRS.PAINT, 39, DEF_ATTRS.LIST, DEF_ATTRS.TEXT_DECORATION ];
7228+ DEF_ATTRS.transform = [ DEF_ATTRS.REFLOW, 40, DEF_ATTRS.LIST, DEF_ATTRS.TEXT_TRANSFORM ];
7229+ DEF_ATTRS.shadowColor = [ DEF_ATTRS.PAINT, 41, DEF_ATTRS.COLOR ];
7230+ DEF_ATTRS.shadowOffsetX = [ DEF_ATTRS.PAINT, 42, DEF_ATTRS.LENGTH ];
7231+ DEF_ATTRS.shadowOffsetY = [ DEF_ATTRS.PAINT, 43, DEF_ATTRS.LENGTH ];
7232+ DEF_ATTRS.shadowBlur = [ DEF_ATTRS.PAINT, 44, DEF_ATTRS.LENGTH ];
7233+
7234+ DEF_ATTRS.width = [ DEF_ATTRS.REFLOW, 45, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT, DEF_ATTRS.WIDTH_HEIGHT ];
7235+ DEF_ATTRS.minWidth = [ DEF_ATTRS.REFLOW, 46, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7236+ DEF_ATTRS.maxWidth = [ DEF_ATTRS.REFLOW, 47, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7237+ DEF_ATTRS.height = [ DEF_ATTRS.REFLOW, 48, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT, DEF_ATTRS.WIDTH_HEIGHT ];
7238+ DEF_ATTRS.minHeight = [ DEF_ATTRS.REFLOW, 49, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7239+ DEF_ATTRS.maxHeight = [ DEF_ATTRS.REFLOW, 50, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7240+ DEF_ATTRS.padding = [ DEF_ATTRS.REFLOW, 51, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7241+ DEF_ATTRS.margin = [ DEF_ATTRS.REFLOW, 55, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7242+ DEF_ATTRS.sizing = [ DEF_ATTRS.REFLOW, 59, DEF_ATTRS.LIST, DEF_ATTRS.BOX_SIZING ];
7243+ DEF_ATTRS.pageBox = [ DEF_ATTRS.REFLOW, 60, DEF_ATTRS.BOOLEAN ]; // true / false
7244+ DEF_ATTRS.x = DEF_ATTRS.left = [ DEF_ATTRS.REFLOW, 61, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7245+ DEF_ATTRS.y = DEF_ATTRS.top = [ DEF_ATTRS.REFLOW, 62, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7246+ DEF_ATTRS.bottom = [ DEF_ATTRS.REFLOW, 63, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7247+ DEF_ATTRS.right = [ DEF_ATTRS.REFLOW, 64, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
71807248
7181- var BasicLayoutManager = AbstractLayoutManager.inherits(
7249+ /**
7250+ * 再計算と再描画
7251+ * redraw 再描画はパラメータ変更後に setTimeout で
7252+ * reflow 再計算は値が get された場合 invalidate が サイズだったら
7253+ * または再描画前に invalidate がサイズなフラグが足っていたら
7254+ */
7255+
7256+ var BasicLayoutManager = Class.create(
71827257 'BasicLayoutManager',
7258+ Class.POOL_OBJECT,
71837259 {
71847260 Constructor : function(){
71857261
7262+ },
7263+ redraw : function( nodeData ){
7264+ var root = nodeData.__root;
7265+ root.dirty === DEF_ATTRS.REFLOW && this.reflow( root );
7266+
7267+ // draw
7268+ },
7269+ reflow : function( nodeData ){
7270+ var parent = nodeData.__parent,
7271+ allowW = parent.contentWidth,
7272+ allowH = parent.contentHeight,
7273+ autoW = parent.autoWidth,
7274+ autoH = parent.autoHeight,
7275+ offsetX = parent.offsetX,
7276+ offsetY = parent.offsetY,
7277+ children = nodeData.children,
7278+ style = nodeData.__style,
7279+ x, y, w, minW, maxW, h, minH, maxH,
7280+ contentW, contentH, boxW, boxH,
7281+ autoSize, sizing, page,
7282+ paddingT, paddingR, paddingB, paddingL,
7283+ borderT, borderR, borderB, borderL,
7284+ marginT, marginR, marginB, marginL,
7285+ childW = 0,
7286+ childH = 0,
7287+ styles, child, calc, i;
7288+
7289+ if( style ){
7290+ styles = style.data;
7291+ calc = BasicLayoutManager.calcValue;
7292+ sizing = styles[ 53 ];
7293+ page = styles[ 54 ];
7294+ x = calc( styles[ 55 ], allowW );
7295+ y = calc( styles[ 56 ], page === true ? allowH : allowW );
7296+ w = styles[ 45 ];
7297+ minW = styles[ 46 ];
7298+ maxW = styles[ 47 ];
7299+ contentW = BasicLayoutManager.finalValue( w, minW, maxW, allowW );
7300+ h = styles[ 48 ];
7301+ minW = styles[ 49 ];
7302+ maxW = styles[ 50 ];
7303+ contentH = BasicLayoutManager.finalValue( h, minW, maxW, allowH );
7304+ autoSize = w === AUTO || h === AUTO;
7305+ paddingT = calc( styles[ 51 ], page === true ? allowH : allowW );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して
7306+ paddingR = calc( styles[ 52 ], allowW );
7307+ paddingT = calc( styles[ 53 ], page === true ? allowH : allowW );
7308+ paddingL = calc( styles[ 54 ], allowW, autoW );
7309+ borderT = styles[ 0 ];
7310+ borderR = styles[ 1 ];
7311+ borderB = styles[ 2 ];
7312+ borderL = styles[ 3 ];
7313+ marginT = calc( styles[ 55 ], page === true ? allowH : allowW );// marginTRBL の % 指定は 最大幅に対して TB でも幅に対して
7314+ marginR = calc( styles[ 56 ], allowW );
7315+ marginB = calc( styles[ 57 ], page === true ? allowH : allowW );
7316+ marginL = calc( styles[ 58 ], allowW );
7317+ boxW = contentW;
7318+ boxH = contentH;
7319+ switch( sizing ){
7320+ case 3 : // margin-box
7321+ contentW -= ( marginR + marginL );
7322+ contentH -= ( marginT + marginR );
7323+
7324+ case 2 : // border-box
7325+ contentW -= ( borderR + borderL );
7326+ contentH -= ( borderT + borderR );
7327+ case 1 : // padding-box
7328+ contentW -= ( paddingR + paddingL );
7329+ contentH -= ( paddingT + paddingR );
7330+ // case 0 : // content-box
7331+ };
7332+ } else {
7333+ boxW = contentW = w = allowW;
7334+ boxH = contentH = h = allowH;
7335+ minW = minH = 0;
7336+ maxW = maxH = Infinity;
7337+ autoSize = false;
7338+ };
7339+
7340+ if( nodeData.contentWidth !== contentW || nodeData.contentHeight === contentH ){
7341+ if( autoSize === false ){
7342+ nodeData.updateLayout();
7343+ nodeData.contentWidth = contentW;
7344+ nodeData.contentHeight = contentH;
7345+ nodeData.boxWidth = boxW;
7346+ nodeData.boxHeight = boxH;
7347+ };
7348+ if( node instanceof LayoutBoxPrivate ){
7349+ nodeData.Super.reflow.call( nodeData );
7350+ } else {
7351+ node.reflow();
7352+ };
7353+ };
7354+
7355+ if( children ){
7356+ for( i = children.length; i; ){
7357+ child = children[ --i ];
7358+ if( child instanceof LayoutBoxPrivate ){
7359+ child.layoutManager.reflow( child );
7360+ } else {
7361+ child.reflow();
7362+ };
7363+ if( autoSize === false ) continue;
7364+ if( childW < child.rectRight ) childW = child.rectRight;
7365+ if( childH < child.rectBottom ) childH = child.rectBottom;
7366+ };
7367+ if( autoSize === true ){
7368+ if( w === AUTO && childW < contentW ) contentW = childW;
7369+ if( h === AUTO && childH < contentH ) contentH = childH;
7370+ if( contentW < minW ) contentW = minW;
7371+ if( maxW < contentW ){
7372+ nodeData.scrollWidth = contentW;
7373+ contentW = maxW;
7374+ };
7375+ if( contentH < minH ) contentH = minH;
7376+ if( maxH < contentH ){
7377+ nodeData.scrollHeight = contentH;
7378+ contentH = maxH;
7379+ };
7380+ nodeData.contentWidth = boxW = contentW;
7381+ nodeData.contentHeight = boxH = contentH;
7382+ switch( sizing ){
7383+ case 3 : // margin-box
7384+ boxW += ( marginR + marginL );
7385+ boxH += ( marginT + marginR );
7386+ case 2 : // border-box
7387+ boxW += ( borderR + borderL );
7388+ boxH += ( borderT + borderR );
7389+ case 1 : // padding-box
7390+ boxW += ( paddingR + paddingL );
7391+ boxH += ( paddingT + paddingR );
7392+ // case 0 : // content-box
7393+ };
7394+ nodeData.boxWidth = boxW;
7395+ nodeData.boxHeight = boxH;
7396+ };
7397+ };
7398+ delete nodeData.dirty;
71867399 }
71877400 }
71887401 );
7402+ BasicLayoutManager.finalValue = function( styleValue, styleMin, styleMax, srcValue ){
7403+ var calc = BasicLayoutManager.calcValue,
7404+ v = calc( styleValue, srcValue ),
7405+ min = calc( styleMin, srcValue ),
7406+ max = calc( styleMax, srcValue );
7407+ if( v < min ) return min;
7408+ if( max < v ) return max;
7409+ return v;
7410+ };
7411+ BasicLayoutManager.calcValue = function( styleValue, srcValue ){
7412+ if( styleValue === 0 ) return 0;
7413+ // 100%
7414+ if( styleValue === FULL || styleValue === AUTO ) return srcValue;
7415+ if( 1 <= styleValue ) return styleValue; // legth
7416+ if( -1 < styleValue ) return FLOOR( srcValue * styleValue ); // %
7417+ return styleValue; // - length
7418+ };
71897419
7190- var AbstractStylePrivate = Class.create(
7191- Class.ABSTRACT | Class.PRIVATE_DATA,
7420+ var NodeStylePrivate = Class.create(
7421+ Class.PRIVATE_DATA | Class.POOL_OBJECT,
71927422 {
7423+ colorCssText : null,
7424+ layoutCssText : null,
7425+ Constructor : function(){
7426+ this.data = [];
7427+ this.dirty = 0;
7428+ },
71937429 register : function( node ){
7194- var list = this.nodeList;
7195- if( !list ){
7430+ var root = node.__root,
7431+ roots = this.rootList,
7432+ nodes = this.nodeList;
7433+ if( !roots ){
7434+ this.rootList = [ root ];
7435+ } else
7436+ if( getIndex( roots, root ) === -1 ) roots[ roots.length ] = root;
7437+
7438+ if( !nodes ){
71967439 this.nodeList = [ node ];
71977440 return;
71987441 };
7199- if( getIndex( list, node ) === -1 ) list[ list.length ] = node;
7442+ if( getIndex( nodes, node ) === -1 ) nodes[ nodes.length ] = node;
72007443 },
72017444 unRegister : function( node ){
7202- var list = this.nodeList,
7203- i = getIndex( list, node );
7204- if( i !== -1 && list.splice( i, 1 ) && list.length === 0 ) delete this.nodeList;
7445+ var nodes = this.nodeList,
7446+ i = getIndex( nodes, node ),
7447+ root = node._root,
7448+ roots = this.rootList,
7449+ j = getIndex( roots, root );
7450+ if( i !== -1 && nodes.splice( i, 1 ) && nodes.length === 0 ) delete this.nodeList;
7451+ if( j !== -1 && roots.splice( j, 1 ) && roots.length === 0 ) delete this.rootList;
72057452 },
72067453 clone : function(){
72077454 var styleClass = Class.getClass( this.User ),
@@ -7221,12 +7468,14 @@ var XDocument = ( function( window, document ){
72217468 quartet = !!( type & DEF_ATTRS.QUARTET ),
72227469 url = !!( type & DEF_ATTRS.URL ),
72237470 fontName = !!( type & DEF_ATTRS.FONT_NAME ),
7224- list = !!( type & DEF_ATTRS.LIST ),
7471+ //list = !!( type & DEF_ATTRS.LIST ),
72257472 combi = !!( type & DEF_ATTRS.COMBI ),
72267473 data = this.data,
72277474 _v = -1,
7228- _type, i, l, nodes;
7229-
7475+ i, l, nodes, root;
7476+ /*
7477+ * Setter
7478+ */
72307479 if( v !== undefined ){
72317480 if( Type.isNumber( v ) === true ){
72327481 if( numerical === false ){
@@ -7247,53 +7496,68 @@ var XDocument = ( function( window, document ){
72477496 };
72487497 if( Type.isArray( v ) === true ){
72497498 if( v.length <= 4 && quartet === true ){
7250- _type = type ^ DEF_ATTRS.QUARTET;
7499+ type ^= DEF_ATTRS.QUARTET;
72517500 } else
72527501 if( v.length === 2 && combi === true ){
7253- _type = type ^ DEF_ATTRS.COMBI;
7502+ type ^= DEF_ATTRS.COMBI;
72547503 } else {
72557504 throw new Error( '' );
72567505 };
72577506 switch( v.length ){
72587507 case 1 :
7259- this.attr( [ propID , _type, list ], v[ 0 ] );
7260- this.attr( [ ++propID, _type, list ], v[ 0 ] );
7261- this.attr( [ ++propID, _type, list ], v[ 0 ] );
7262- this.attr( [ ++propID, _type, list ], v[ 0 ] );
7508+ this.attr( [ propID , type, list ], v[ 0 ] );
7509+ this.attr( [ ++propID, type, list ], v[ 0 ] );
7510+ this.attr( [ ++propID, type, list ], v[ 0 ] );
7511+ this.attr( [ ++propID, type, list ], v[ 0 ] );
72637512 break;
72647513 case 2 :
7265- this.attr( [ propID , _type, list ], v[ 0 ] );
7266- this.attr( [ ++propID, _type, list ], v[ 1 ] );
7267- this.attr( [ ++propID, _type, list ], v[ 0 ] );
7268- this.attr( [ ++propID, _type, list ], v[ 1 ] );
7514+ this.attr( [ propID , type, list ], v[ 0 ] );
7515+ this.attr( [ ++propID, type, list ], v[ 1 ] );
7516+ this.attr( [ ++propID, type, list ], v[ 0 ] );
7517+ this.attr( [ ++propID, type, list ], v[ 1 ] );
72697518 break;
72707519 case 3 :
7271- this.attr( [ propID , _type, list ], v[ 0 ] );
7272- this.attr( [ ++propID, _type, list ], v[ 1 ] );
7273- this.attr( [ ++propID, _type, list ], v[ 2 ] );
7274- this.attr( [ ++propID, _type, list ], v[ 1 ] );
7520+ this.attr( [ propID , type, list ], v[ 0 ] );
7521+ this.attr( [ ++propID, type, list ], v[ 1 ] );
7522+ this.attr( [ ++propID, type, list ], v[ 2 ] );
7523+ this.attr( [ ++propID, type, list ], v[ 1 ] );
72757524 break;
72767525 case 4 :
7277- this.attr( [ propID , _type, list ], v[ 0 ] );
7278- this.attr( [ ++propID, _type, list ], v[ 1 ] );
7279- this.attr( [ ++propID, _type, list ], v[ 2 ] );
7280- this.attr( [ ++propID, _type, list ], v[ 3 ] );
7526+ this.attr( [ propID , type, list ], v[ 0 ] );
7527+ this.attr( [ ++propID, type, list ], v[ 1 ] );
7528+ this.attr( [ ++propID, type, list ], v[ 2 ] );
7529+ this.attr( [ ++propID, type, list ], v[ 3 ] );
72817530 break;
72827531 default :
72837532 };
72847533 return this.User;
72857534 };
7286- if( this.invalidateLayout < update ) this.invalidate = update;
7535+ if( update === DEF_ATTRS.REFLOW ){
7536+ delete this.layoutCssText;
7537+ } else {
7538+ delete this.colorCssText;
7539+ };
7540+ if( this.dirty < update ){
7541+ this.dirty = update;
7542+ roots = this.rootList;
7543+ for( i = 0, l = roots.length; i < l; ++i ){
7544+ root = roots[ i ];
7545+ if( root.dirty < update ) root.dirty = update;
7546+ };
7547+ };
72877548
72887549 if( list ) _v = Util.getIndex( list, v );
72897550 data[ propID ] = _v !== -1 ? _v : v;
72907551 return this.User;
72917552 };
7292- if( this.invalidate === DEF_ATTRS.REFLOW ){
7293- nodes = this.nodeList;
7294- if( nodes ){
7295- for( i = 0, l = nodes.length; i < l; ++i ){
7296- nodes[ i ].reflow();
7553+ /*
7554+ * Getter
7555+ */
7556+ if( this.dirty === DEF_ATTRS.REFLOW ){
7557+ roots = this.rootList;
7558+ if( roots ){
7559+ for( i = 0, l = roots.length; i < l; ++i ){
7560+ roots[ i ].reflow();
72977561 };
72987562 };
72997563 };
@@ -7302,251 +7566,133 @@ var XDocument = ( function( window, document ){
73027566 if( combi === true ) return [ v, data[ ++propID ] ];
73037567 if( list && Type.isNumber( v ) === true ) return list[ v ];
73047568 return v;
7305- }
7306- }
7307- );
7308-
7309- var PaintPrivate = AbstractStylePrivate.inherits(
7310- 'PaintPrivate',
7311- Class.PRIVATE_DATA | Class.POOL_OBJECT,
7312- {
7313- Constructor : function(){
7314- this.data = [];
7315- this.invalidate = 0;
73167569 },
73177570 cssText : function(){
7318-
7571+ if( this.colorCssText === null ) this.colorCssText = this.createColorCssText();
7572+ if( this.layoutCssText === null ) this.layoutCssText = this.createLayoutCssText();
7573+ return this.colorCssText + ';' + this.layoutCssText;
73197574 },
7320- cssObject : function(){
7575+ createColorCssText : function(){
73217576
73227577 },
7323- paint : function( node ){
7578+ createLayoutCssText : function(){
73247579
73257580 }
73267581 }
73277582 );
73287583
7329- var PaintStyle = Class.create(
7330- 'PaintStyle',
7584+ var NodeStyle = Class.create(
7585+ 'NodeStyle',
73317586 Class.POOL_OBJECT,
7332- PaintPrivate,
7587+ NodeStylePrivate,
73337588 {
73347589 Constructor : function(){
7335- PaintStyle.newPrivateData( this );
7590+ NodeStyle.newPrivateData( this );
73367591 },
73377592 borderWidth : function( v ){
7338- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.borderWidth, v );
7593+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.borderWidth, v );
73397594 },
73407595 borderColor : function(){
7341- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.borderColor, v );
7596+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.borderColor, v );
73427597 },
73437598 borderStyle : function(){
7344- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.borderStyle, v );
7599+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.borderStyle, v );
73457600 },
73467601 cornerRadius : function(){
7347- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.cornerRadius, v );
7602+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.cornerRadius, v );
73487603 },
73497604 bgColor : function(){
7350- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgColor, v );
7605+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgColor, v );
73517606 },
73527607 bgAlpha : function(){
7353- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgAlpha, v );
7608+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgAlpha, v );
73547609 },
73557610 bgImgUrl : function(){
7356- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgUrl, v );
7611+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgUrl, v );
73577612 },
73587613 bgImgRepeatX : function(){
7359- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgRepeatX, v );
7614+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgRepeatX, v );
73607615 },
73617616 bgImgRepeatY : function(){
7362- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgRepeatY, v );
7617+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgRepeatY, v );
73637618 },
73647619 bgImgPositionX : function(){
7365- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgPositionX, v );
7620+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgPositionX, v );
73667621 },
73677622 bgImgPositionY : function(){
7368- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgPositionY, v );
7623+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgPositionY, v );
73697624 },
73707625 shadowColor : function(){
7371- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowColor, v );
7626+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowColor, v );
73727627 },
73737628 shadowAlpha : function(){
7374- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowAlpha, v );
7629+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowAlpha, v );
73757630 },
73767631 shadowOffsetX : function(){
7377- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowOffsetX, v );
7632+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetX, v );
73787633 },
73797634 shadowOffsetY : function(){
7380- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowOffsetY, v );
7635+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetY, v );
73817636 },
73827637 shadowBlur : function(){
7383- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowBlur, v );
7638+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowBlur, v );
73847639 },
73857640 shadowSpread : function(){
7386- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowSpread, v );
7641+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowSpread, v );
73877642 },
73887643 shadowInset : function(){
7389- return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowInset, v );
7390- }
7391- }
7392- );
7393-
7394- var TypoPrivate = AbstractStylePrivate.inherits(
7395- 'TypoPrivate',
7396- Class.PRIVATE_DATA | Class.POOL_OBJECT,
7397- {
7398- Constructor : function(){
7399- this.data = [];
7400- this.invalidate = 0;
7401- },
7402- cssText : function(){
7403-
7404- },
7405- cssObject : function(){
7406-
7407- }
7408- }
7409- );
7410-
7411- var TypoStyle = Class.create(
7412- 'TypoStyle',
7413- Class.POOL_OBJECT,
7414- TypoPrivate,
7415- {
7416- Constructor : function( v ){
7417- TypoStyle.newPrivateData( this );
7644+ return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowInset, v );
74187645 },
74197646 color : function( v ){
7420- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.color, v );
7647+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.color, v );
74217648 },
74227649 fontFamily : function( v ){
7423- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.fontFamily, v );
7650+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.fontFamily, v );
74247651 },
74257652 fontSize : function( v ){
7426- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.fontSize, v );
7653+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.fontSize, v );
74277654 },
74287655 bold : function( v ){
7429- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.bold, v );
7656+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.bold, v );
74307657 },
74317658 italic : function( v ){
7432- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.italic, v );
7659+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.italic, v );
74337660 },
74347661 lineHeight : function( v ){
7435- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.lineHeight, v );
7662+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.lineHeight, v );
74367663 },
74377664 letterSpacing : function( v ){
7438- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.letterSpacing, v );
7665+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.letterSpacing, v );
74397666 },
74407667 wordSpacing : function( v ){
7441- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.wordSpacing, v );
7668+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.wordSpacing, v );
74427669 },
74437670 align : function( v ){
7444- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.align, v );
7671+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.align, v );
74457672 },
74467673 decoration : function( v ){
7447- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.decoration, v );
7674+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.decoration, v );
74487675 },
74497676 transform : function( v ){
7450- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.transform, v );
7677+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.transform, v );
74517678 },
74527679 shadowColor : function( v ){
7453- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.shadowColor, v );
7680+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowColor, v );
74547681 },
74557682 shadowOffsetX : function( v ){
7456- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.shadowOffsetX, v );
7683+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetX, v );
74577684 },
74587685 shadowOffsetY : function( v ){
7459- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.shadowOffsetY, v );
7686+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetY, v );
74607687 },
74617688 shadowBlur : function( v ){
7462- return TypoStyle.getPrivateData( this ).attr( TypoPrivate.shadowBlur, v );
7463- }
7464- }
7465- );
7466-
7467- var LayoutPrivate = AbstractStylePrivate.inherits(
7468- 'LayoutPrivate',
7469- Class.PRIVATE_DATA | Class.POOL_OBJECT,
7470- {
7471- Constructor : function(){
7472- this.data = [];
7473- this.invalidate = 0;
7689+ return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowBlur, v );
74747690 },
74757691 cssText : function(){
7476-
7477- },
7478- cssObject : function(){
7479-
7692+ return TypoStyle.getPrivateData( this ).cssText();
74807693 }
74817694 }
74827695 );
7483-
7484- DEF_ATTRS.LENGTH = 1;
7485- DEF_ATTRS.PERCENT = 2;
7486- DEF_ATTRS.COLOR = 4;
7487- DEF_ATTRS.U_DECIMAL = 8;
7488- DEF_ATTRS.NUMERICAL = 16;
7489- DEF_ATTRS.BOOLEAN = 32;
7490- DEF_ATTRS.QUARTET = 64;
7491- DEF_ATTRS.URL = 128;
7492- DEF_ATTRS.FONT_NAME = 256;
7493- DEF_ATTRS.LIST = 512;
7494- DEF_ATTRS.AUTO = 1024;
7495- DEF_ATTRS.COMBI = 2048;
7496- DEF_ATTRS.BORDER_STYLE = 'none,hidden,dotted,dashed,solid,double,groove,ridge,inset,outset'.split(',');
7497- DEF_ATTRS.POSITION_X = 'left,center,right'.split(',');
7498- DEF_ATTRS.POSITION_Y = 'top,center,bottom'.split(',');
7499- DEF_ATTRS.ALIGN = 'left,center,right,justify'.split(',');
7500- DEF_ATTRS.TEXT_DECORATION = 'none,underline,overline,line-through,blink'.split(',');
7501- DEF_ATTRS.TEXT_TRANSFORM = 'none,capitalize,lowercase,uppercase'.split(',');
7502- DEF_ATTRS.WIDTH_HEIGHT = 'auto'.split(',');
7503- DEF_ATTRS.PAINT = 1; // 再描画のみ必要
7504- DEF_ATTRS.REFLOW = 2; // レイアウトの再計算が必要
7505-
7506- PaintPrivate.borderWidth = [ DEF_ATTRS.REFLOW, 0, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH ]; // em [ top, right, bottom, left ]
7507- PaintPrivate.borderColor = [ DEF_ATTRS.PAINT, 4, DEF_ATTRS.QUARTET | DEF_ATTRS.DEF_COLOR ]; // color [ top, right, bottom, left ]
7508- PaintPrivate.borderStyle = [ DEF_ATTRS.REFLOW, 8, DEF_ATTRS.QUARTET | DEF_ATTRS.LIST, DEF_ATTRS.BORDER_STYLE ]; // string [ top, right, bottom, left ]
7509- PaintPrivate.cornerRadius = [ DEF_ATTRS.PAINT, 12, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ]; // em, px [ top, right, bottom, left ]
7510- PaintPrivate.bgColor = [ DEF_ATTRS.PAINT, 16, DEF_ATTRS.COLOR ]; // color
7511- PaintPrivate.bgAlpha = [ DEF_ATTRS.PAINT, 17, DEF_ATTRS.U_DECIMAL ]; // 0 - 1
7512- PaintPrivate.bgImgUrl = [ DEF_ATTRS.PAINT, 18, DEF_ATTRS.URL ]; // url
7513- PaintPrivate.bgImgRepeatX = [ DEF_ATTRS.PAINT, 19, DEF_ATTRS.BOOLEAN ]; // true / false
7514- PaintPrivate.bgImgRepeatY = [ DEF_ATTRS.PAINT, 20, DEF_ATTRS.BOOLEAN ]; // true / false
7515- PaintPrivate.bgImgPositionX = [ DEF_ATTRS.PAINT, 21, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT | DEF_ATTRS.LIST, DEF_ATTRS.POSITION_X ]; // em %, px, string
7516- PaintPrivate.bgImgPositionY = [ DEF_ATTRS.PAINT, 22, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT | DEF_ATTRS.LIST, DEF_ATTRS.POSITION_Y ]; // em %, px, string
7517- PaintPrivate.shadowColor = [ DEF_ATTRS.PAINT, 23, DEF_ATTRS.COLOR ]; // color
7518- PaintPrivate.shadowAlpha = [ DEF_ATTRS.PAINT, 24, DEF_ATTRS.U_DECIMAL ]; // 0 - 1
7519- PaintPrivate.shadowOffsetX = [ DEF_ATTRS.PAINT, 25, DEF_ATTRS.LENGTH ]; // em
7520- PaintPrivate.shadowOffsetY = [ DEF_ATTRS.PAINT, 26, DEF_ATTRS.LENGTH ]; // em
7521- PaintPrivate.shadowBlur = [ DEF_ATTRS.PAINT, 27, DEF_ATTRS.LENGTH ]; // em
7522- PaintPrivate.shadowSpread = [ DEF_ATTRS.PAINT, 28, DEF_ATTRS.LENGTH ]; // em
7523- PaintPrivate.shadowInset = [ DEF_ATTRS.PAINT, 29, DEF_ATTRS.BOOLEAN ]; // true / false
7524-
7525- TypoPrivate.color = [ DEF_ATTRS.PAINT, 0, DEF_ATTRS.COLOR ]; // color
7526- TypoPrivate.fontFamily = [ DEF_ATTRS.REFLOW, 1, DEF_ATTRS.FONT_NAME ]; // string
7527- TypoPrivate.fontSize = [ DEF_ATTRS.REFLOW, 2, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ]; // em, %
7528- TypoPrivate.bold = [ DEF_ATTRS.REFLOW, 3, DEF_ATTRS.BOOLEAN ]; // true / false
7529- TypoPrivate.italic = [ DEF_ATTRS.REFLOW, 4, DEF_ATTRS.BOOLEAN ]; // true / false
7530- TypoPrivate.lineHeight = [ DEF_ATTRS.REFLOW, 5, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT | DEF_ATTRS.NUMERICAL ]; // em, %,
7531- TypoPrivate.letterSpacing = [ DEF_ATTRS.REFLOW, 6, DEF_ATTRS.LENGTH ]; // em
7532- TypoPrivate.wordSpacing = [ DEF_ATTRS.REFLOW, 7, DEF_ATTRS.LENGTH ];
7533- TypoPrivate.align = [ DEF_ATTRS.REFLOW, 8, DEF_ATTRS.LIST, DEF_ATTRS.ALIGN ];
7534- TypoPrivate.decoration = [ DEF_ATTRS.PAINT, 9, DEF_ATTRS.LIST, DEF_ATTRS.TEXT_DECORATION ];
7535- TypoPrivate.transform = [ DEF_ATTRS.REFLOW, 10, DEF_ATTRS.LIST, DEF_ATTRS.TEXT_TRANSFORM ];
7536- TypoPrivate.shadowColor = [ DEF_ATTRS.PAINT, 11, DEF_ATTRS.COLOR ];
7537- TypoPrivate.shadowOffsetX = [ DEF_ATTRS.PAINT, 12, DEF_ATTRS.LENGTH ];
7538- TypoPrivate.shadowOffsetY = [ DEF_ATTRS.PAINT, 13, DEF_ATTRS.LENGTH ];
7539- TypoPrivate.shadowBlur = [ DEF_ATTRS.PAINT, 14, DEF_ATTRS.LENGTH ];
7540-
7541- LayoutPrivate.width = [ DEF_ATTRS.REFLOW, 0, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT, DEF_ATTRS.WIDTH_HEIGHT ];
7542- LayoutPrivate.minWidth = [ DEF_ATTRS.REFLOW, 1, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7543- LayoutPrivate.maxWidth = [ DEF_ATTRS.REFLOW, 2, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7544- LayoutPrivate.height = [ DEF_ATTRS.REFLOW, 3, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT, DEF_ATTRS.WIDTH_HEIGHT ];
7545- LayoutPrivate.minHeight = [ DEF_ATTRS.REFLOW, 4, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7546- LayoutPrivate.maxHeight = [ DEF_ATTRS.REFLOW, 5, DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7547- LayoutPrivate.padding = [ DEF_ATTRS.REFLOW, 6, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7548- LayoutPrivate.margin = [ DEF_ATTRS.REFLOW, 10, DEF_ATTRS.QUARTET | DEF_ATTRS.LENGTH | DEF_ATTRS.PERCENT ];
7549-
75507696
75517697 var NodePrivate = Class.create(
75527698 'NodePrivate',
@@ -7554,43 +7700,38 @@ var XDocument = ( function( window, document ){
75547700 {
75557701 elmWrap : null,
75567702 textNode : null,
7703+ autoWidth : false,
7704+ autoHeight : false,
7705+ autoSize : false,
7706+ boxX : 0,
7707+ boxY : 0,
7708+ boxWidth : 0,
7709+ boxHeight : 0,
7710+ boxRight : 0,
7711+ boxBottom : 0,
7712+ contentX : 0,
7713+ contentY : 0,
75577714 contentWidth : 0,
75587715 contentHeight : 0,
75597716 Constructor : function( __root, __parent ){
75607717 this.__root = __root;
75617718 if( __parent ) this.__parent = __parent;
75627719 },
7563- paint : function( v ){
7564- if( v instanceof PaintStyle ){
7565- this.__paint && this.__paint.unRegister( this );
7566- this._paint = v;
7567- this.__paint = PaintStyle.getPrivateData( v );
7568- this.__paint.register( this );
7720+ style : function( v ){
7721+ if( v instanceof NodeStyle ){
7722+ this.__style && this.__style.unRegister( this );
7723+ this._style = v;
7724+ this.__style = StylePrivate.getPrivateData( v );
7725+ this.__style.register( this );
75697726 return this.User;
75707727 } else
75717728 if( v === null ){
7572- this.__paint && this.__paint.unRegister( this );
7573- delete this._paint;
7574- delete this.__paint;
7729+ this.__style && this.__style.unRegister( this );
7730+ delete this._style;
7731+ delete this.__style;
75757732 return this.User;
75767733 };
7577- return this._paint;
7578- },
7579- typo : function( v ){
7580- if( v instanceof TypoStyle ){
7581- this.__typo && this.__typo.unRegister( this );
7582- this._typo = v;
7583- this.__typo = TypoStyle.getPrivateData( v );
7584- this.__typo.register( this );
7585- return this.User;
7586- } else
7587- if( v === null ){
7588- this.__typo && this.__typo.unRegister( this );
7589- delete this._typo;
7590- delete this.__typo;
7591- return this.User;
7592- };
7593- return this._typo;
7734+ return this._style;
75947735 },
75957736 /**
75967737 * 1. 要素の追加・削除
@@ -7600,20 +7741,24 @@ var XDocument = ( function( window, document ){
76007741 */
76017742 reflow : function(){
76027743 var content = this._textContent,
7603- layout = this.__layout,
7604- targetW = this.__parent.childWidth,
7605- targetH = this.__parent.childHeight,
7744+ style = this.__style,
7745+ parent = this.__parent,
76067746 size, data, w, h;
76077747
7608- if( content || ( this.__paint && this.__paint.hasStyle === true ) || ( this.__typo && this.__typo.hasStyle === true ) ){
7609- if( !this.elmWrap ) this.elmWrap = DOM.createDiv();
7610- this.__parent.addDiv( this );
7611- if( conetnt ){
7748+ if( content || ( style && style.hasPaint === true ) ){
7749+ if( !this.elmWrap ){
7750+ this.elmWrap = DOM.createDiv();
7751+ parent.addDisplayElement( this );
7752+ };
7753+ if( style && style.hasStyle === true ){
7754+ this.elmWrap.style.cssText = style.cssText();
7755+ };
7756+ if( content ){
76127757 if( !this.textNode ){
76137758 this.textNode = DOM.cerateText();
76147759 this.elmWrap.appendChild( this.textNode );
76157760 };
7616- if( layout && ( layout.autoWidth === true || layout.autoHeight === true ) ){
7761+ if( style && ( style.autoWidth === true || style.autoHeight === true ) ){
76177762 size = DOM.getTextSize( this.elmWrap, content );
76187763 this.contentWidth = size[ 0 ];
76197764 this.conetntHeight = size[ 1 ];
@@ -7626,24 +7771,94 @@ var XDocument = ( function( window, document ){
76267771 delete this.contentWidth;
76277772 delete this.conetntHeight;
76287773 };
7629- this.currentWidth = this.elmWrap.offsetWidth;
7630- this.currentHeight = this.elmWrap.offsetHeight;
7774+ this.boxWidth = this.elmWrap.offsetWidth;
7775+ this.boxHeight = this.elmWrap.offsetHeight;
76317776 } else
76327777 if( this.elmWrap ){
7633- DOM.correct( this.elmWrap );
7634- delete this.elmWrap;
7635- delete this.textNode;
7636- delete this.contentWidth;
7637- delete this.conetntHeight;
7638- delete this.currentWidth;
7639- delete this.currentHeight
7778+ parent.removeDisplayElement( this );
7779+ };
7780+ },
7781+ preSizing : function(){
7782+ var parent = nodeData.__parent,
7783+ allowW = parent.contentWidth,
7784+ allowH = parent.contentHeight,
7785+ style = nodeData.__style,
7786+ x, y, w, minW, maxW, h, minH, maxH,
7787+ contentW, contentH,
7788+ page,
7789+ paddingT, paddingR, paddingB, paddingL,
7790+ borderT, borderR, borderB, borderL,
7791+ marginT, marginR, marginB, marginL,
7792+ styles, calc;
7793+
7794+ if( style ){
7795+ styles = style.data;
7796+ calc = BasicLayoutManager.calcValue;
7797+ page = styles[ 54 ] === true ? allowH : allowW ;
7798+ w = styles[ 45 ];
7799+ minW = styles[ 46 ];
7800+ maxW = styles[ 47 ];
7801+ contentW = BasicLayoutManager.finalValue( w, minW, maxW, allowW );
7802+ h = styles[ 48 ];
7803+ minW = styles[ 49 ];
7804+ maxW = styles[ 50 ];
7805+ contentH = BasicLayoutManager.finalValue( h, minW, maxW, allowH );
7806+ paddingT = calc( styles[ 51 ], page );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して
7807+ paddingR = calc( styles[ 52 ], allowW );
7808+ paddingB = calc( styles[ 53 ], page );
7809+ paddingL = calc( styles[ 54 ], allowW );
7810+ borderT = styles[ 0 ];
7811+ borderR = styles[ 1 ];
7812+ borderB = styles[ 2 ];
7813+ borderL = styles[ 3 ];
7814+ marginT = calc( styles[ 55 ], page );// marginTRBL の % 指定は 最大幅に対して TB でも幅に対して
7815+ marginR = calc( styles[ 56 ], allowW );
7816+ marginB = calc( styles[ 57 ], page );
7817+ marginL = calc( styles[ 58 ], allowW );
7818+ this.boxWidth = contentW;
7819+ this.boxHeight = contentH;
7820+ switch( styles[ 53 ] ){
7821+ case 3 : // margin-box
7822+ contentW -= ( marginR + marginL );
7823+ contentH -= ( marginT + marginR );
7824+
7825+ case 2 : // border-box
7826+ contentW -= ( borderR + borderL );
7827+ contentH -= ( borderT + borderR );
7828+ case 1 : // padding-box
7829+ contentW -= ( paddingR + paddingL );
7830+ contentH -= ( paddingT + paddingR );
7831+ // case 0 : // content-box
7832+ };
7833+ this.contentX = marginL + borderL + paddingL;
7834+ this.contentY = marginT + borderT + paddingT;
7835+ this.contentWidth = contentW;
7836+ this.contentHeight = contentH;
7837+ this.autoHeight = h === AUTO;
7838+ this.autoWidth = w === AUTO;
7839+ this.autoSize = this.autoWidth || this.autoHeight;
7840+ } else {
7841+ this.boxWidth = this.contentWidth = allowW;
7842+ this.boxHeight = this.contentHeight = allowH;
7843+ delete this.contentX;
7844+ delete this.contentY;
7845+ delete this.autoSize;
7846+ delete this.autoWidth;
7847+ delete this.autoHeight;
76407848 };
7641-
7642- // this.__parent.layoutManager.reflow();
76437849 },
7644- addDiv : function( nodeData ){
7850+ addDisplayElement : function( nodeData ){
76457851
7646- }
7852+ },
7853+ removeDisplayElement : function( nodeData ){
7854+ DOM.correct( nodeData.elmWrap );
7855+ delete nodeData.elmWrap;
7856+ delete nodeData.textNode;
7857+ delete nodeData.contentWidth;
7858+ delete nodeData.conetntHeight;
7859+ delete nodeData.currentWidth;
7860+ delete nodeData.currentHeight;
7861+ }
76477862 }
76487863 );
76497864 var Node = Class.create(
@@ -7654,12 +7869,9 @@ var XDocument = ( function( window, document ){
76547869 Constructor : function( root, parent ){
76557870 Node.newPrivateData( this, LayoutBox.getPrivateData( root ), parent ? LayoutBox.getPrivateData( parent ) : undefined, this );
76567871 },
7657- paint : function( v ){
7872+ style : function( v ){
76587873 return Node.getPrivateData( this ).paint( v );
76597874 },
7660- typo : function( v ){
7661- return Node.getPrivateData( this ).typo( v );
7662- },
76637875 remove : function(){
76647876 Node.getPrivateData( this ).remove();
76657877 },
@@ -7701,7 +7913,7 @@ var XDocument = ( function( window, document ){
77017913
77027914 var LayoutBoxPrivate = NodePrivate.inherits(
77037915 'LayoutBoxPrivate',
7704- Class.POOL_OBJECT,
7916+ Class.POOL_OBJECT | Class.SUPER_ACCESS,
77057917 {
77067918 Constructor : function( layoutManager, root, parent ){
77077919 this.layoutManager = layoutManager;
@@ -7709,10 +7921,7 @@ var XDocument = ( function( window, document ){
77097921 if( _parent ) this._parent = _parent;
77107922 },
77117923 reflow : function(){
7712- this.manager.reflow( this );
7713- },
7714- repaint : function(){
7715- this.manager.repaint( this );
7924+ this.layoutManager.reflow( this );
77167925 }
77177926 }
77187927 );
旧リポジトリブラウザで表示