changeset 7867:4be6763a301a

RT-38445: [Accessibility, Windows] Fix text traversal action Need to make sure the range is set everytime get_DocumentRange() is called, fixes CP+Y, CP+B
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Tue, 26 Aug 2014 16:28:03 -0700
parents e1d0a9e30bec
children e4cfda6bac5a
files modules/graphics/src/main/java/com/sun/glass/ui/win/WinAccessible.java
diffstat 1 files changed, 17 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/glass/ui/win/WinAccessible.java	Tue Aug 26 14:49:59 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/win/WinAccessible.java	Tue Aug 26 16:28:03 2014 -0700
@@ -208,7 +208,6 @@
     /* Text Support */
     WinTextRangeProvider documentRange;
     WinTextRangeProvider selectionRange;
-    boolean documentRangeValid, selectionRangeValid;
 
     /* The lastIndex is used by parents to keep track of the index of the last child
      * returned in Navigate. It is very common for Narrator to traverse the children
@@ -339,7 +338,6 @@
                      * not to focus an empty text control when clicking.
                      */
                     if (newStart || newEnd) {
-                        selectionRangeValid = false;
                         UiaRaiseAutomationEvent(peer, UIA_Text_TextSelectionChangedEventId);
                     }
                 }
@@ -363,8 +361,6 @@
 
                 if (selectionRange != null || documentRange != null) {
                     UiaRaiseAutomationEvent(peer, UIA_Text_TextChangedEventId);
-                    documentRangeValid = false;
-                    selectionRangeValid = false;
                 }
                 break;
             case EXPANDED: {
@@ -1139,25 +1135,22 @@
                 if (selectionRange == null) {
                     selectionRange = new WinTextRangeProvider(this);
                 }
-                if (!selectionRangeValid) {
-                    Integer result = (Integer)getAttribute(SELECTION_START);
-                    int start = result != null ? result : 0;
-                    int end = -1;
-                    int length = -1;
-                    if (start >= 0) {
-                        result = (Integer)getAttribute(SELECTION_END);
-                        end = result != null ? result : 0;
-                        if (end >= start) {
-                            String string = (String)getAttribute(TEXT);
-                            length = string != null ? string.length() : 0;
-                        }
+                Integer result = (Integer)getAttribute(SELECTION_START);
+                int start = result != null ? result : 0;
+                int end = -1;
+                int length = -1;
+                if (start >= 0) {
+                    result = (Integer)getAttribute(SELECTION_END);
+                    end = result != null ? result : 0;
+                    if (end >= start) {
+                        String string = (String)getAttribute(TEXT);
+                        length = string != null ? string.length() : 0;
                     }
-                    if (length != -1 && end <= length) {
-                        selectionRange.setRange(start, end);
-                    } else {
-                        selectionRange.setRange(0, 0);
-                    }
-                    selectionRangeValid = true;
+                }
+                if (length != -1 && end <= length) {
+                    selectionRange.setRange(start, end);
+                } else {
+                    selectionRange.setRange(0, 0);
                 }
                 return new long[] {selectionRange.getNativeProvider()};
             }
@@ -1355,11 +1348,8 @@
         if (documentRange == null) {
             documentRange = new WinTextRangeProvider(this);
         }
-        if (!documentRangeValid) {
-            String text = (String)getAttribute(TEXT);
-            documentRange.setRange(0, text.length());
-            documentRangeValid = true;
-        }
+        String text = (String)getAttribute(TEXT);
+        documentRange.setRange(0, text.length());
         return documentRange.getNativeProvider();
     }