リビジョン | 0d4a780c015a71a5a9aff4effd6d5db1de879646 (tree) |
---|---|
日時 | 2013-02-04 23:23:58 |
作者 | itozyun <itozyun@user...> |
コミッター | itozyun |
Client is version 0.5.46, fixed picture.id
@@ -1,6 +1,6 @@ | ||
1 | 1 | /* |
2 | 2 | * pettanR peta.apps.js |
3 | - * version 0.5.44 | |
3 | + * version 0.5.46 | |
4 | 4 | * |
5 | 5 | * author: |
6 | 6 | * itozyun |
@@ -447,6 +447,7 @@ | ||
447 | 447 | this.viewerApplicationList = function( file ){ |
448 | 448 | var data = FileAPI.getFileData( file ), |
449 | 449 | type = data !== null ? data.type : null; |
450 | + if( data === FILE_DATA_MY_ORIGINAL_PICTURES_ROOT ) return [ PremiumSatge ]; | |
450 | 451 | switch( type ){ |
451 | 452 | case FILE_TYPE.COMIC : |
452 | 453 | case FILE_TYPE.PANEL : |
@@ -458,10 +459,7 @@ | ||
458 | 459 | break; |
459 | 460 | case FILE_TYPE.ARTIST : |
460 | 461 | return [ PremiumSatge ]; |
461 | - default : | |
462 | - if( data === FILE_DATA_MY_ORIGINAL_PICTURES_ROOT ){ | |
463 | - return [ PremiumSatge ]; | |
464 | - }; | |
462 | + default : | |
465 | 463 | }; |
466 | 464 | return []; |
467 | 465 | }; |
@@ -853,9 +851,9 @@ var PremiumSatge = gOS.registerApplication( function(){ | ||
853 | 851 | var ImageGroupIconClass = function( index, data ){ |
854 | 852 | var elmIconWrap = elmIconOrigin.cloneNode( true ), |
855 | 853 | elmIconTitle = Util.getElementsByClassName( elmIconWrap, 'image-group-item-title' )[ 0 ], |
856 | - originalPicture = data.original_picture, | |
854 | + originalPicture = data.original_picture || data, | |
857 | 855 | 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, | |
859 | 857 | reversibleImage = null, |
860 | 858 | timer = null, |
861 | 859 | onEnterFlag = false, |
@@ -3488,7 +3486,7 @@ var Editor = gOS.registerApplication( function(){ | ||
3488 | 3486 | }; |
3489 | 3487 | function change(){ |
3490 | 3488 | if( currentElement === null ) return; |
3491 | - PremiumSatge.boot( currentElement.artistID, currentElement.resourcePicture, currentElement ); | |
3489 | + PremiumSatge.boot( currentElement.artistID, currentElement.realPicture, currentElement ); | |
3492 | 3490 | }; |
3493 | 3491 | |
3494 | 3492 | return { |
@@ -3685,8 +3683,6 @@ var Editor = gOS.registerApplication( function(){ | ||
3685 | 3683 | this.flipV = data.height < 0 ? -1 : 1; |
3686 | 3684 | this.flipH = data.width < 0 ? -1 : 1; |
3687 | 3685 | this.rPicture = data.picture; |
3688 | - //this.oPicture = this.rPicture.original_picture; | |
3689 | - //this.artistID = this.oPicture.artist.id || -1; | |
3690 | 3686 | |
3691 | 3687 | var self = this; |
3692 | 3688 | function animeComplete(){ |
@@ -3712,7 +3708,7 @@ var Editor = gOS.registerApplication( function(){ | ||
3712 | 3708 | this.flipV = updateV === true ? -this.flipV : this.flipV; |
3713 | 3709 | this.reversibleImage.resize( this.flipH * this.w, this.flipV * this.h ); |
3714 | 3710 | }, |
3715 | - resourcePicture : function( _rPicture ){ | |
3711 | + realPicture : function( _rPicture ){ | |
3716 | 3712 | if( _rPicture && _rPicture !== this.rPicture ){ |
3717 | 3713 | HISTORY_CONTROL.saveState( this._updateResourcePicture, this.rPicture, _rPicture, this ); |
3718 | 3714 | this._updateResourcePicture( _rPicture ); |
@@ -3757,7 +3753,7 @@ var Editor = gOS.registerApplication( function(){ | ||
3757 | 3753 | this.actualH = this.oPicture.height; |
3758 | 3754 | |
3759 | 3755 | 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( '' ), | |
3761 | 3757 | this.flipH * this.w, this.flipV * this.h |
3762 | 3758 | ); |
3763 | 3759 | if( this.reversibleImage !== null ){ |
@@ -4071,7 +4067,7 @@ var Editor = gOS.registerApplication( function(){ | ||
4071 | 4067 | var _panelElement; |
4072 | 4068 | if( isPanelPictureData !== true ){ |
4073 | 4069 | _panelElement = new ImageElementClass( { |
4074 | - picture : data, | |
4070 | + picture : data.picture, | |
4075 | 4071 | x : Math.floor( panelW / 2 - data.width / 2 ), |
4076 | 4072 | y : Math.floor( panelH / 2 - data.height / 2 ), |
4077 | 4073 | z : -1, |
@@ -5041,7 +5037,7 @@ var Model = ( function(){ | ||
5041 | 5037 | function getPanelElementByTiming(){ |
5042 | 5038 | var i, l = panelElementArray.length; |
5043 | 5039 | while( timing < l * 2 ){ |
5044 | - for( i=0; i<l; ++i ){ | |
5040 | + for( i = 0; i < l; ++i ){ | |
5045 | 5041 | if( timing === panelElementArray[ i ].timing ){ |
5046 | 5042 | // console.log( timing + ' , ' + panelElementArray[ i ].timing ); |
5047 | 5043 | ++timing; |
@@ -5053,9 +5049,10 @@ var Model = ( function(){ | ||
5053 | 5049 | return null; |
5054 | 5050 | }; |
5055 | 5051 | function panelElementToHtml( _panelElement, isAbsoluteUrl, isXHTML ){ |
5056 | - var url; | |
5052 | + var rPic, url; | |
5057 | 5053 | 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( '' ); | |
5059 | 5056 | return [ |
5060 | 5057 | '<img ', |
5061 | 5058 | 'src="', isAbsoluteUrl !== true ? url : Util.getAbsolutePath( url ), '" ', |
@@ -5094,12 +5091,13 @@ var Model = ( function(){ | ||
5094 | 5091 | }; |
5095 | 5092 | }; |
5096 | 5093 | function getImageJsonGET( _imageElement ){ |
5097 | - var cr = pettanr.LINE_FEED_CODE_TEXTAREA; | |
5094 | + var cr = pettanr.LINE_FEED_CODE_TEXTAREA, | |
5095 | + rPic = _imageElement.realPicture(); | |
5098 | 5096 | return [ |
5099 | 5097 | '{', cr, |
5100 | 5098 | '"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, | |
5103 | 5101 | '},', cr, |
5104 | 5102 | '"x": ', _imageElement.x, ',', cr, |
5105 | 5103 | '"y": ', _imageElement.y, ',', cr, |
@@ -5114,7 +5112,7 @@ var Model = ( function(){ | ||
5114 | 5112 | var cr = pettanr.LINE_FEED_CODE_TEXTAREA; |
5115 | 5113 | return [ |
5116 | 5114 | '{', cr, |
5117 | - '"picture_id": ', _imageElement.resourcePicture().id, ',', cr, | |
5115 | + '"picture_id": ', _imageElement.realPicture().id, ',', cr, | |
5118 | 5116 | '"x": ', _imageElement.x, ',', cr, |
5119 | 5117 | '"y": ', _imageElement.y, ',', cr, |
5120 | 5118 | '"z": ', _imageElement.z + 1, ',', cr, |
@@ -1,6 +1,6 @@ | ||
1 | 1 | /* |
2 | 2 | * pettanR peta.common.js |
3 | - * version 0.5.45 | |
3 | + * version 0.5.46 | |
4 | 4 | * |
5 | 5 | * author: |
6 | 6 | * itozyun |
@@ -96,6 +96,7 @@ pettanr.CONST = ( function(){ | ||
96 | 96 | NS_PETTANR_COMIC : 'pettanr-comic', |
97 | 97 | THUMBNAIL_PATH : SERVER_SUPPORT === false ? RELATIVE + 'resource_pictures\/thumbnail\/' : PETTANR_ROOT_PATH + 'resource_pictures\/', |
98 | 98 | 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\/', | |
99 | 100 | PICTURE_PATH : SERVER_SUPPORT === false ? RELATIVE + 'pictures\/' : PETTANR_ROOT_PATH + 'pictures\/', |
100 | 101 | SYSTEM_PICTURE_PATH : ( SERVER_SUPPORT === false ? RELATIVE : PETTANR_ROOT_PATH ) + 'system_pictures\/', |
101 | 102 | CREATE_COMIC_JS : SERVER_SUPPORT === false ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js', |
@@ -1,6 +1,6 @@ | ||
1 | 1 | /* |
2 | 2 | * pettanR system.js |
3 | - * version 0.5.44 | |
3 | + * version 0.5.46 | |
4 | 4 | * |
5 | 5 | * gadgetOS |
6 | 6 | * author: |
@@ -135,8 +135,7 @@ var Class = ( function(){ | ||
135 | 135 | dataUser = null, |
136 | 136 | traits = null, |
137 | 137 | f = true, |
138 | - c = Util.copyArray, | |
139 | - a; /* arguments */ | |
138 | + copyArray = Util.copyArray; | |
140 | 139 | |
141 | 140 | function getClass( instance ){ |
142 | 141 | var cList = CLASS_LIST, |
@@ -186,7 +185,7 @@ var Class = ( function(){ | ||
186 | 185 | * http://d.hatena.ne.jp/m-hiyama/20051018/1129605002 |
187 | 186 | */ |
188 | 187 | function inherits( /* displayName, classSetting, opt_PrivateClass, props */ ){ |
189 | - var args = c( arguments ), | |
188 | + var args = copyArray( arguments ), | |
190 | 189 | params = [], |
191 | 190 | Super = this, |
192 | 191 | superDef = getClassDef( Super ), |
@@ -307,7 +306,7 @@ var Class = ( function(){ | ||
307 | 306 | |
308 | 307 | /* privateDataclass をもつクラスに追加されるメソッド */ |
309 | 308 | function newPrivateData( /* instance, args */ ){ |
310 | - var args = c( arguments ), | |
309 | + var args = copyArray( arguments ), | |
311 | 310 | user = args.shift(), |
312 | 311 | def = getClassDef( user ), |
313 | 312 | privateClass = def.privateClass, |
@@ -361,7 +360,7 @@ var Class = ( function(){ | ||
361 | 360 | userDef.userList.push( dataUser ); |
362 | 361 | } else { |
363 | 362 | def.live && def.live.push( instance ); |
364 | - args = c( arguments ); | |
363 | + args = copyArray( arguments ); | |
365 | 364 | }; |
366 | 365 | def[ CONSTRUCTOR ] && def[ CONSTRUCTOR ].apply( instance, args ); |
367 | 366 | return instance; |
@@ -374,7 +373,7 @@ var Class = ( function(){ | ||
374 | 373 | SUPER_ACCESS : 8, |
375 | 374 | PRIVATE_DATA : 16, |
376 | 375 | create : function( /* displayName, classSetting, opt_PrivateClass, props */ ){ |
377 | - var args = c( arguments ), | |
376 | + var args = copyArray( arguments ), | |
378 | 377 | displayName = args[ 0 ], |
379 | 378 | classSetting, |
380 | 379 | opt_pool, opt_abstract, opt_final, opt_private, |
@@ -417,7 +416,7 @@ var Class = ( function(){ | ||
417 | 416 | classDef[ CONSTRUCTOR ] = props[ CONSTRUCTOR ]; |
418 | 417 | }; |
419 | 418 | |
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 )}; | |
421 | 420 | klass.prototype = override( override( traits || {}, props, true ), CommonProps, false ); |
422 | 421 | |
423 | 422 | if( opt_abstract === true ){ |
@@ -1112,30 +1111,30 @@ var File = ( function(){ | ||
1112 | 1111 | // simpleDeepCopy |
1113 | 1112 | var driver = FILE_CONTROLER.getDriver( this ), |
1114 | 1113 | data; |
1115 | - if( Type.isFunction( driver.read ) === true ){ | |
1114 | + if( Type.isFunction( driver.read ) === true ){ | |
1116 | 1115 | data = driver.read( this ); |
1117 | 1116 | }; |
1118 | 1117 | return BASE_DRIVER.read( data || this ); |
1119 | 1118 | }, |
1120 | 1119 | write: function( _newData, _onUpdateFunction ){ |
1121 | 1120 | var driver = FILE_CONTROLER.getDriver( this ); |
1122 | - if( typeof driver.write === 'function'){ | |
1121 | + if( typeof driver.write === 'function' ){ | |
1123 | 1122 | return driver.write( this, _newData, _onUpdateFunction ); |
1124 | - } | |
1123 | + }; | |
1125 | 1124 | return BASE_DRIVER.write( this, _newData, _onUpdateFunction ); |
1126 | 1125 | }, |
1127 | 1126 | viewerApplicationList: function(){ |
1128 | 1127 | var driver = FILE_CONTROLER.getDriver( this ); |
1129 | - if( typeof driver.viewerApplicationList === 'function'){ | |
1128 | + if( typeof driver.viewerApplicationList === 'function' ){ | |
1130 | 1129 | return driver.viewerApplicationList( this ); |
1131 | - } | |
1130 | + }; | |
1132 | 1131 | return BASE_DRIVER.viewerApplicationList( this ); |
1133 | 1132 | }, |
1134 | 1133 | editorApplicationList: function(){ |
1135 | 1134 | var driver = FILE_CONTROLER.getDriver( this ); |
1136 | - if( typeof driver.editorApplicationList === 'function'){ | |
1135 | + if( typeof driver.editorApplicationList === 'function' ){ | |
1137 | 1136 | return driver.editorApplicationList( this ); |
1138 | - } | |
1137 | + }; | |
1139 | 1138 | return BASE_DRIVER.viwerApps( this ); |
1140 | 1139 | }, |
1141 | 1140 | create: function(){ |
@@ -7167,41 +7166,289 @@ var XBrowserStyle = ( function(){ | ||
7167 | 7166 | |
7168 | 7167 | var XDocument = ( function( window, document ){ |
7169 | 7168 | |
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; | |
7171 | 7175 | |
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; // レイアウトの再計算が必要 | |
7173 | 7198 | |
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 ]; | |
7180 | 7248 | |
7181 | - var BasicLayoutManager = AbstractLayoutManager.inherits( | |
7249 | + /** | |
7250 | + * 再計算と再描画 | |
7251 | + * redraw 再描画はパラメータ変更後に setTimeout で | |
7252 | + * reflow 再計算は値が get された場合 invalidate が サイズだったら | |
7253 | + * または再描画前に invalidate がサイズなフラグが足っていたら | |
7254 | + */ | |
7255 | + | |
7256 | + var BasicLayoutManager = Class.create( | |
7182 | 7257 | 'BasicLayoutManager', |
7258 | + Class.POOL_OBJECT, | |
7183 | 7259 | { |
7184 | 7260 | Constructor : function(){ |
7185 | 7261 | |
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; | |
7186 | 7399 | } |
7187 | 7400 | } |
7188 | 7401 | ); |
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 | + }; | |
7189 | 7419 | |
7190 | - var AbstractStylePrivate = Class.create( | |
7191 | - Class.ABSTRACT | Class.PRIVATE_DATA, | |
7420 | + var NodeStylePrivate = Class.create( | |
7421 | + Class.PRIVATE_DATA | Class.POOL_OBJECT, | |
7192 | 7422 | { |
7423 | + colorCssText : null, | |
7424 | + layoutCssText : null, | |
7425 | + Constructor : function(){ | |
7426 | + this.data = []; | |
7427 | + this.dirty = 0; | |
7428 | + }, | |
7193 | 7429 | 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 ){ | |
7196 | 7439 | this.nodeList = [ node ]; |
7197 | 7440 | return; |
7198 | 7441 | }; |
7199 | - if( getIndex( list, node ) === -1 ) list[ list.length ] = node; | |
7442 | + if( getIndex( nodes, node ) === -1 ) nodes[ nodes.length ] = node; | |
7200 | 7443 | }, |
7201 | 7444 | 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; | |
7205 | 7452 | }, |
7206 | 7453 | clone : function(){ |
7207 | 7454 | var styleClass = Class.getClass( this.User ), |
@@ -7221,12 +7468,14 @@ var XDocument = ( function( window, document ){ | ||
7221 | 7468 | quartet = !!( type & DEF_ATTRS.QUARTET ), |
7222 | 7469 | url = !!( type & DEF_ATTRS.URL ), |
7223 | 7470 | fontName = !!( type & DEF_ATTRS.FONT_NAME ), |
7224 | - list = !!( type & DEF_ATTRS.LIST ), | |
7471 | + //list = !!( type & DEF_ATTRS.LIST ), | |
7225 | 7472 | combi = !!( type & DEF_ATTRS.COMBI ), |
7226 | 7473 | data = this.data, |
7227 | 7474 | _v = -1, |
7228 | - _type, i, l, nodes; | |
7229 | - | |
7475 | + i, l, nodes, root; | |
7476 | + /* | |
7477 | + * Setter | |
7478 | + */ | |
7230 | 7479 | if( v !== undefined ){ |
7231 | 7480 | if( Type.isNumber( v ) === true ){ |
7232 | 7481 | if( numerical === false ){ |
@@ -7247,53 +7496,68 @@ var XDocument = ( function( window, document ){ | ||
7247 | 7496 | }; |
7248 | 7497 | if( Type.isArray( v ) === true ){ |
7249 | 7498 | if( v.length <= 4 && quartet === true ){ |
7250 | - _type = type ^ DEF_ATTRS.QUARTET; | |
7499 | + type ^= DEF_ATTRS.QUARTET; | |
7251 | 7500 | } else |
7252 | 7501 | if( v.length === 2 && combi === true ){ |
7253 | - _type = type ^ DEF_ATTRS.COMBI; | |
7502 | + type ^= DEF_ATTRS.COMBI; | |
7254 | 7503 | } else { |
7255 | 7504 | throw new Error( '' ); |
7256 | 7505 | }; |
7257 | 7506 | switch( v.length ){ |
7258 | 7507 | 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 ] ); | |
7263 | 7512 | break; |
7264 | 7513 | 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 ] ); | |
7269 | 7518 | break; |
7270 | 7519 | 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 ] ); | |
7275 | 7524 | break; |
7276 | 7525 | 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 ] ); | |
7281 | 7530 | break; |
7282 | 7531 | default : |
7283 | 7532 | }; |
7284 | 7533 | return this.User; |
7285 | 7534 | }; |
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 | + }; | |
7287 | 7548 | |
7288 | 7549 | if( list ) _v = Util.getIndex( list, v ); |
7289 | 7550 | data[ propID ] = _v !== -1 ? _v : v; |
7290 | 7551 | return this.User; |
7291 | 7552 | }; |
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(); | |
7297 | 7561 | }; |
7298 | 7562 | }; |
7299 | 7563 | }; |
@@ -7302,251 +7566,133 @@ var XDocument = ( function( window, document ){ | ||
7302 | 7566 | if( combi === true ) return [ v, data[ ++propID ] ]; |
7303 | 7567 | if( list && Type.isNumber( v ) === true ) return list[ v ]; |
7304 | 7568 | 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; | |
7316 | 7569 | }, |
7317 | 7570 | 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; | |
7319 | 7574 | }, |
7320 | - cssObject : function(){ | |
7575 | + createColorCssText : function(){ | |
7321 | 7576 | |
7322 | 7577 | }, |
7323 | - paint : function( node ){ | |
7578 | + createLayoutCssText : function(){ | |
7324 | 7579 | |
7325 | 7580 | } |
7326 | 7581 | } |
7327 | 7582 | ); |
7328 | 7583 | |
7329 | - var PaintStyle = Class.create( | |
7330 | - 'PaintStyle', | |
7584 | + var NodeStyle = Class.create( | |
7585 | + 'NodeStyle', | |
7331 | 7586 | Class.POOL_OBJECT, |
7332 | - PaintPrivate, | |
7587 | + NodeStylePrivate, | |
7333 | 7588 | { |
7334 | 7589 | Constructor : function(){ |
7335 | - PaintStyle.newPrivateData( this ); | |
7590 | + NodeStyle.newPrivateData( this ); | |
7336 | 7591 | }, |
7337 | 7592 | borderWidth : function( v ){ |
7338 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.borderWidth, v ); | |
7593 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.borderWidth, v ); | |
7339 | 7594 | }, |
7340 | 7595 | borderColor : function(){ |
7341 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.borderColor, v ); | |
7596 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.borderColor, v ); | |
7342 | 7597 | }, |
7343 | 7598 | borderStyle : function(){ |
7344 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.borderStyle, v ); | |
7599 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.borderStyle, v ); | |
7345 | 7600 | }, |
7346 | 7601 | cornerRadius : function(){ |
7347 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.cornerRadius, v ); | |
7602 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.cornerRadius, v ); | |
7348 | 7603 | }, |
7349 | 7604 | bgColor : function(){ |
7350 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgColor, v ); | |
7605 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgColor, v ); | |
7351 | 7606 | }, |
7352 | 7607 | bgAlpha : function(){ |
7353 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgAlpha, v ); | |
7608 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgAlpha, v ); | |
7354 | 7609 | }, |
7355 | 7610 | bgImgUrl : function(){ |
7356 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgUrl, v ); | |
7611 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgUrl, v ); | |
7357 | 7612 | }, |
7358 | 7613 | bgImgRepeatX : function(){ |
7359 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgRepeatX, v ); | |
7614 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgRepeatX, v ); | |
7360 | 7615 | }, |
7361 | 7616 | bgImgRepeatY : function(){ |
7362 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgRepeatY, v ); | |
7617 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgRepeatY, v ); | |
7363 | 7618 | }, |
7364 | 7619 | bgImgPositionX : function(){ |
7365 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgPositionX, v ); | |
7620 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgPositionX, v ); | |
7366 | 7621 | }, |
7367 | 7622 | bgImgPositionY : function(){ |
7368 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.bgImgPositionY, v ); | |
7623 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.bgImgPositionY, v ); | |
7369 | 7624 | }, |
7370 | 7625 | shadowColor : function(){ |
7371 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowColor, v ); | |
7626 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowColor, v ); | |
7372 | 7627 | }, |
7373 | 7628 | shadowAlpha : function(){ |
7374 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowAlpha, v ); | |
7629 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowAlpha, v ); | |
7375 | 7630 | }, |
7376 | 7631 | shadowOffsetX : function(){ |
7377 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowOffsetX, v ); | |
7632 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetX, v ); | |
7378 | 7633 | }, |
7379 | 7634 | shadowOffsetY : function(){ |
7380 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowOffsetY, v ); | |
7635 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetY, v ); | |
7381 | 7636 | }, |
7382 | 7637 | shadowBlur : function(){ |
7383 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowBlur, v ); | |
7638 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowBlur, v ); | |
7384 | 7639 | }, |
7385 | 7640 | shadowSpread : function(){ |
7386 | - return PaintStyle.getPrivateData( this ).attr( PaintPrivate.shadowSpread, v ); | |
7641 | + return NodeStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowSpread, v ); | |
7387 | 7642 | }, |
7388 | 7643 | 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 ); | |
7418 | 7645 | }, |
7419 | 7646 | color : function( v ){ |
7420 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.color, v ); | |
7647 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.color, v ); | |
7421 | 7648 | }, |
7422 | 7649 | fontFamily : function( v ){ |
7423 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.fontFamily, v ); | |
7650 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.fontFamily, v ); | |
7424 | 7651 | }, |
7425 | 7652 | fontSize : function( v ){ |
7426 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.fontSize, v ); | |
7653 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.fontSize, v ); | |
7427 | 7654 | }, |
7428 | 7655 | bold : function( v ){ |
7429 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.bold, v ); | |
7656 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.bold, v ); | |
7430 | 7657 | }, |
7431 | 7658 | italic : function( v ){ |
7432 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.italic, v ); | |
7659 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.italic, v ); | |
7433 | 7660 | }, |
7434 | 7661 | lineHeight : function( v ){ |
7435 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.lineHeight, v ); | |
7662 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.lineHeight, v ); | |
7436 | 7663 | }, |
7437 | 7664 | letterSpacing : function( v ){ |
7438 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.letterSpacing, v ); | |
7665 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.letterSpacing, v ); | |
7439 | 7666 | }, |
7440 | 7667 | wordSpacing : function( v ){ |
7441 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.wordSpacing, v ); | |
7668 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.wordSpacing, v ); | |
7442 | 7669 | }, |
7443 | 7670 | align : function( v ){ |
7444 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.align, v ); | |
7671 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.align, v ); | |
7445 | 7672 | }, |
7446 | 7673 | decoration : function( v ){ |
7447 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.decoration, v ); | |
7674 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.decoration, v ); | |
7448 | 7675 | }, |
7449 | 7676 | transform : function( v ){ |
7450 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.transform, v ); | |
7677 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.transform, v ); | |
7451 | 7678 | }, |
7452 | 7679 | shadowColor : function( v ){ |
7453 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.shadowColor, v ); | |
7680 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowColor, v ); | |
7454 | 7681 | }, |
7455 | 7682 | shadowOffsetX : function( v ){ |
7456 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.shadowOffsetX, v ); | |
7683 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetX, v ); | |
7457 | 7684 | }, |
7458 | 7685 | shadowOffsetY : function( v ){ |
7459 | - return TypoStyle.getPrivateData( this ).attr( TypoPrivate.shadowOffsetY, v ); | |
7686 | + return TypoStyle.getPrivateData( this ).attr( DEF_ATTRS.shadowOffsetY, v ); | |
7460 | 7687 | }, |
7461 | 7688 | 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 ); | |
7474 | 7690 | }, |
7475 | 7691 | cssText : function(){ |
7476 | - | |
7477 | - }, | |
7478 | - cssObject : function(){ | |
7479 | - | |
7692 | + return TypoStyle.getPrivateData( this ).cssText(); | |
7480 | 7693 | } |
7481 | 7694 | } |
7482 | 7695 | ); |
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 | - | |
7550 | 7696 | |
7551 | 7697 | var NodePrivate = Class.create( |
7552 | 7698 | 'NodePrivate', |
@@ -7554,43 +7700,38 @@ var XDocument = ( function( window, document ){ | ||
7554 | 7700 | { |
7555 | 7701 | elmWrap : null, |
7556 | 7702 | 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, | |
7557 | 7714 | contentWidth : 0, |
7558 | 7715 | contentHeight : 0, |
7559 | 7716 | Constructor : function( __root, __parent ){ |
7560 | 7717 | this.__root = __root; |
7561 | 7718 | if( __parent ) this.__parent = __parent; |
7562 | 7719 | }, |
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 ); | |
7569 | 7726 | return this.User; |
7570 | 7727 | } else |
7571 | 7728 | 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; | |
7575 | 7732 | return this.User; |
7576 | 7733 | }; |
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; | |
7594 | 7735 | }, |
7595 | 7736 | /** |
7596 | 7737 | * 1. 要素の追加・削除 |
@@ -7600,20 +7741,24 @@ var XDocument = ( function( window, document ){ | ||
7600 | 7741 | */ |
7601 | 7742 | reflow : function(){ |
7602 | 7743 | 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, | |
7606 | 7746 | size, data, w, h; |
7607 | 7747 | |
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 ){ | |
7612 | 7757 | if( !this.textNode ){ |
7613 | 7758 | this.textNode = DOM.cerateText(); |
7614 | 7759 | this.elmWrap.appendChild( this.textNode ); |
7615 | 7760 | }; |
7616 | - if( layout && ( layout.autoWidth === true || layout.autoHeight === true ) ){ | |
7761 | + if( style && ( style.autoWidth === true || style.autoHeight === true ) ){ | |
7617 | 7762 | size = DOM.getTextSize( this.elmWrap, content ); |
7618 | 7763 | this.contentWidth = size[ 0 ]; |
7619 | 7764 | this.conetntHeight = size[ 1 ]; |
@@ -7626,24 +7771,94 @@ var XDocument = ( function( window, document ){ | ||
7626 | 7771 | delete this.contentWidth; |
7627 | 7772 | delete this.conetntHeight; |
7628 | 7773 | }; |
7629 | - this.currentWidth = this.elmWrap.offsetWidth; | |
7630 | - this.currentHeight = this.elmWrap.offsetHeight; | |
7774 | + this.boxWidth = this.elmWrap.offsetWidth; | |
7775 | + this.boxHeight = this.elmWrap.offsetHeight; | |
7631 | 7776 | } else |
7632 | 7777 | 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; | |
7640 | 7848 | }; |
7641 | - | |
7642 | - // this.__parent.layoutManager.reflow(); | |
7643 | 7849 | }, |
7644 | - addDiv : function( nodeData ){ | |
7850 | + addDisplayElement : function( nodeData ){ | |
7645 | 7851 | |
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 | + } | |
7647 | 7862 | } |
7648 | 7863 | ); |
7649 | 7864 | var Node = Class.create( |
@@ -7654,12 +7869,9 @@ var XDocument = ( function( window, document ){ | ||
7654 | 7869 | Constructor : function( root, parent ){ |
7655 | 7870 | Node.newPrivateData( this, LayoutBox.getPrivateData( root ), parent ? LayoutBox.getPrivateData( parent ) : undefined, this ); |
7656 | 7871 | }, |
7657 | - paint : function( v ){ | |
7872 | + style : function( v ){ | |
7658 | 7873 | return Node.getPrivateData( this ).paint( v ); |
7659 | 7874 | }, |
7660 | - typo : function( v ){ | |
7661 | - return Node.getPrivateData( this ).typo( v ); | |
7662 | - }, | |
7663 | 7875 | remove : function(){ |
7664 | 7876 | Node.getPrivateData( this ).remove(); |
7665 | 7877 | }, |
@@ -7701,7 +7913,7 @@ var XDocument = ( function( window, document ){ | ||
7701 | 7913 | |
7702 | 7914 | var LayoutBoxPrivate = NodePrivate.inherits( |
7703 | 7915 | 'LayoutBoxPrivate', |
7704 | - Class.POOL_OBJECT, | |
7916 | + Class.POOL_OBJECT | Class.SUPER_ACCESS, | |
7705 | 7917 | { |
7706 | 7918 | Constructor : function( layoutManager, root, parent ){ |
7707 | 7919 | this.layoutManager = layoutManager; |
@@ -7709,10 +7921,7 @@ var XDocument = ( function( window, document ){ | ||
7709 | 7921 | if( _parent ) this._parent = _parent; |
7710 | 7922 | }, |
7711 | 7923 | reflow : function(){ |
7712 | - this.manager.reflow( this ); | |
7713 | - }, | |
7714 | - repaint : function(){ | |
7715 | - this.manager.repaint( this ); | |
7924 | + this.layoutManager.reflow( this ); | |
7716 | 7925 | } |
7717 | 7926 | } |
7718 | 7927 | ); |