@@ -40,9 +40,9 @@ $.widget("ui.dialog", {
4040 . wrap ( '<div/>' )
4141 . wrap ( '<div/>' ) ,
4242
43- uiDialogContainer = uiDialogContent . parent ( )
43+ uiDialogContainer = ( this . uiDialogContainer = uiDialogContent . parent ( )
4444 . addClass ( 'ui-dialog-container' )
45- . css ( { position : 'relative' } ) ,
45+ . css ( { position : 'relative' , width : '100%' , height : '100%' } ) ) ,
4646
4747 title = options . title || uiDialogContent . attr ( 'title' ) || '' ,
4848 uiDialogTitlebar = ( this . uiDialogTitlebar =
@@ -139,10 +139,12 @@ $.widget("ui.dialog", {
139139 ( options . resizeStart && options . resizeStart . apply ( self . element [ 0 ] , arguments ) ) ;
140140 } ,
141141 resize : function ( e , ui ) {
142+ ( options . autoResize && self . size . apply ( self ) ) ;
142143 ( options . resize && options . resize . apply ( self . element [ 0 ] , arguments ) ) ;
143144 } ,
144145 handles : resizeHandles ,
145146 stop : function ( e , ui ) {
147+ ( options . autoResize && self . size . apply ( self ) ) ;
146148 ( options . resizeStop && options . resizeStop . apply ( self . element [ 0 ] , arguments ) ) ;
147149 $ . ui . dialog . overlay . resize ( ) ;
148150 }
@@ -231,12 +233,23 @@ $.widget("ui.dialog", {
231233 pTop = Math . max ( pTop , minTop ) ;
232234 this . uiDialog . css ( { top : pTop , left : pLeft } ) ;
233235 } ,
236+
237+ size : function ( ) {
238+ var container = this . uiDialogContainer ,
239+ titlebar = this . uiDialogTitlebar ,
240+ content = this . element ,
241+ tbMargin = parseInt ( content . css ( 'margin-top' ) ) + parseInt ( content . css ( 'margin-bottom' ) ) ,
242+ lrMargin = parseInt ( content . css ( 'margin-left' ) ) + parseInt ( content . css ( 'margin-right' ) ) ;
243+ content . height ( container . height ( ) - titlebar . outerHeight ( ) - tbMargin ) ;
244+ content . width ( container . width ( ) - lrMargin ) ;
245+ } ,
234246
235247 open : function ( ) {
236248 this . overlay = this . options . modal ? new $ . ui . dialog . overlay ( this ) : null ;
237249 this . uiDialog . appendTo ( 'body' ) ;
238250 this . position ( this . options . position ) ;
239251 this . uiDialog . show ( this . options . show ) ;
252+ this . options . autoResize && this . size ( ) ;
240253 this . moveToTop ( true ) ;
241254
242255 // CALLBACK: open
@@ -289,6 +302,7 @@ $.widget("ui.dialog", {
289302$ . extend ( $ . ui . dialog , {
290303 defaults : {
291304 autoOpen : true ,
305+ autoResize : true ,
292306 bgiframe : false ,
293307 buttons : { } ,
294308 closeOnEscape : true ,
0 commit comments