8098835: [PIT] Endless loop in JEditorPane
authorssadetsky
Fri, 10 Jul 2015 21:19:41 +0300
changeset 31884 15ece91df8e9
parent 31883 be405ebc8355
child 31885 6a51d0e0c491
8098835: [PIT] Endless loop in JEditorPane Reviewed-by: alexsch, serb
jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Fri Jul 10 15:38:40 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Fri Jul 10 21:19:41 2015 +0300
@@ -971,7 +971,7 @@
             ((AbstractDocument)doc).readLock();
         }
         try {
-            d.width = (int) rootView.getMinimumSpan(View.X_AXIS) + i.left + i.right;
+            d.width = (int) rootView.getMinimumSpan(View.X_AXIS) + i.left + i.right + caretMargin;
             d.height = (int)  rootView.getMinimumSpan(View.Y_AXIS) + i.top + i.bottom;
         } finally {
             if (doc instanceof AbstractDocument) {
@@ -996,7 +996,7 @@
         }
         try {
             d.width = (int) Math.min((long) rootView.getMaximumSpan(View.X_AXIS) +
-                                     (long) i.left + (long) i.right, Integer.MAX_VALUE);
+                                     (long) i.left + (long) i.right + caretMargin, Integer.MAX_VALUE);
             d.height = (int) Math.min((long) rootView.getMaximumSpan(View.Y_AXIS) +
                                       (long) i.top + (long) i.bottom, Integer.MAX_VALUE);
         } finally {
@@ -1027,7 +1027,7 @@
             Insets insets = editor.getInsets();
             alloc.x += insets.left;
             alloc.y += insets.top;
-            alloc.width -= insets.left + insets.right;
+            alloc.width -= insets.left + insets.right + caretMargin;
             alloc.height -= insets.top + insets.bottom;
             return alloc;
         }