Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 7611)
+++ /CKEditor/trunk/CHANGES.html	(revision 7612)
@@ -56,4 +56,5 @@
 		<li><a href="http://dev.ckeditor.com/ticket/9312">#9312</a> : Fixed table with multiple &lt;tbody&gt; output in wrong order.</li>
 		<li><a href="http://dev.ckeditor.com/ticket/8795">#8795</a> : Fixed table resize plugin stops working when document overflows horizontally.</li>
+		<li><a href="http://dev.ckeditor.com/ticket/8888">#8888</a> : Fixed dialog dimension overflows small view port.</li>
 	</ul>
 	<h3>
Index: /CKEditor/trunk/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/dialog/plugin.js	(revision 7611)
+++ /CKEditor/trunk/_source/plugins/dialog/plugin.js	(revision 7612)
@@ -666,4 +666,13 @@
 	}
 
+	// Re-layout the dialog on window resize.
+	function resizeWithWindow( dialog )
+	{
+		var win = CKEDITOR.document.getWindow();
+		function resizeHandler() { dialog.layout(); }
+		win.on( 'resize', resizeHandler );
+		dialog.on( 'hide', function() { win.removeListener( 'resize', resizeHandler ); } );
+	}
+
 	CKEDITOR.dialog.prototype =
 	{
@@ -734,47 +743,42 @@
 		 * dialogObj.move( 10, 40 );
 		 */
-		move : (function()
-		{
-			var isFixed;
-			return function( x, y, save )
-			{
-				// The dialog may be fixed positioned or absolute positioned. Ask the
-				// browser what is the current situation first.
-				var element = this._.element.getFirst(),
-					rtl = this._.editor.lang.dir == 'rtl';
-
-				if ( isFixed === undefined )
-					isFixed = element.getComputedStyle( 'position' ) == 'fixed';
-
-				if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y )
-					return;
-
-				// Save the current position.
-				this._.position = { x : x, y : y };
-
-				// If not fixed positioned, add scroll position to the coordinates.
-				if ( !isFixed )
-				{
-					var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition();
-					x += scrollPosition.x;
-					y += scrollPosition.y;
-				}
-
-				// Translate coordinate for RTL.
-				if ( rtl )
-				{
-					var dialogSize = this.getSize(),
-						viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize();
-					x = viewPaneSize.width - dialogSize.width - x;
-				}
-
-				var styles = { 'top'	: ( y > 0 ? y : 0 ) + 'px' };
-				styles[ rtl ? 'right' : 'left' ] = ( x > 0 ? x : 0 ) + 'px';
-
-				element.setStyles( styles );
-
-				save && ( this._.moved = 1 );
-			};
-		})(),
+		move : function( x, y, save )
+		{
+			// The dialog may be fixed positioned or absolute positioned. Ask the
+			// browser what is the current situation first.
+			var element = this._.element.getFirst(),
+				rtl = this._.editor.lang.dir == 'rtl';
+
+			var isFixed = element.getComputedStyle( 'position' ) == 'fixed';
+
+			if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y )
+				return;
+
+			// Save the current position.
+			this._.position = { x : x, y : y };
+
+			// If not fixed positioned, add scroll position to the coordinates.
+			if ( !isFixed )
+			{
+				var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition();
+				x += scrollPosition.x;
+				y += scrollPosition.y;
+			}
+
+			// Translate coordinate for RTL.
+			if ( rtl )
+			{
+				var dialogSize = this.getSize(),
+					viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize();
+				x = viewPaneSize.width - dialogSize.width - x;
+			}
+
+			var styles = { 'top'	: ( y > 0 ? y : 0 ) + 'px' };
+			styles[ rtl ? 'right' : 'left' ] = ( x > 0 ? x : 0 ) + 'px';
+
+			element.setStyles( styles );
+
+			save && ( this._.moved = 1 );
+		},
 
 		/**
@@ -853,4 +857,6 @@
 				{
 					this.layout();
+					resizeWithWindow( this );
+
 					this.parts.dialog.setStyle( 'visibility', '' );
 
@@ -875,9 +881,24 @@
 		layout : function()
 		{
-			var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(),
-					dialogSize = this.getSize();
-
-			this.move( this._.moved ? this._.position.x : ( viewSize.width - dialogSize.width ) / 2,
-					this._.moved ? this._.position.y : ( viewSize.height - dialogSize.height ) / 2 );
+			var el = this.parts.dialog;
+			var dialogSize = this.getSize();
+			var win = CKEDITOR.document.getWindow(),
+					viewSize = win.getViewPaneSize();
+
+			var posX = ( viewSize.width - dialogSize.width ) / 2,
+				posY = ( viewSize.height - dialogSize.height ) / 2;
+
+			// Switch to absolute position when viewport is smaller than dialog size.
+			if ( !CKEDITOR.env.ie6Compat )
+			{
+				if ( dialogSize.height + ( posY > 0 ? posY : 0 ) > viewSize.height ||
+						 dialogSize.width + ( posX > 0 ? posX : 0 ) > viewSize.width )
+					el.setStyle( 'position', 'absolute' );
+				else
+					el.setStyle( 'position', 'fixed' );
+			}
+
+			this.move( this._.moved ? this._.position.x : posX,
+					this._.moved ? this._.position.y : posY );
 		},
 
