changeset 9218:883c22142aa9

7030623: closed/javax/accessibility/4864610/bug4864610.java test fails just against jdk7 b134 Reviewed-by: peterz
author rupashka
date Mon, 11 Apr 2011 19:55:15 +0400
parents f795ef267353
children 607f3926b219
files jdk/src/share/classes/javax/swing/text/Utilities.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/javax/swing/text/Utilities.java	Fri Apr 08 00:26:35 2011 +0400
+++ b/jdk/src/share/classes/javax/swing/text/Utilities.java	Mon Apr 11 19:55:15 2011 +0400
@@ -395,10 +395,10 @@
                 // the length of the string measured as a whole may differ from
                 // the sum of individual character lengths, for example if
                 // fractional metrics are enabled; and we must guard from this.
-                while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) {
+                while (offset > 0 && metrics.charsWidth(txt, txtOffset, offset) > (x - x0)) {
                     offset--;
                 }
-                return (offset < 0 ? 0 : offset);
+                return offset;
             }
             currX = nextX;
         }