textrendering/textformatting/tbox/LAYEMU.CPP
branchRCL_3
changeset 11 6971d1c87c9a
parent 5 e96e8a131979
child 13 7ff7c6e94fea
--- a/textrendering/textformatting/tbox/LAYEMU.CPP	Sat Feb 20 00:37:46 2010 +0200
+++ b/textrendering/textformatting/tbox/LAYEMU.CPP	Fri Mar 12 15:51:09 2010 +0200
@@ -4012,7 +4012,9 @@
 	if (aDy > 0)		// text moves down; iBandTop decreases
 		{
 		if (aTopNoLimitBorder)
-	        iBandTop = desired_bandtop;
+		    {
+	        iBandTop = Max(0 - iText->LayoutHeight(),desired_bandtop);
+		    }
 		else
 		    iBandTop = Max(0,desired_bandtop);//Disallow text scrolled beyond top border
 		
@@ -4056,6 +4058,19 @@
 			if (!AddFormattingAtEndL(param, height_increase,paragraphs_increase))
 				break;
 			}
+		
+		// Shift the whole band upwards if we're at the very end of the text
+		// and there's no more text to format. This prevents a situation were
+		// iText->LayoutHeight() < BandHeightInPixels.
+		if ( aBottomNoLimitBorder && iText->LayoutHeight() - iBandTop < visible_height )
+		    {
+		    if ( iText->EndChar() > iText->Source()->DocumentLength() )
+		        {
+		        iBandTop = desired_bandtop;
+		        return pixels_scrolled;
+		        }
+		    }
+
 		}
 
 	// Scroll blank space off the display if desired.