Title: [172027] trunk
Revision
172027
Author
[email protected]
Date
2014-08-04 22:09:05 -0700 (Mon, 04 Aug 2014)

Log Message

AX: Select activity behavior does not work when an existing range is already selected
https://bugs.webkit.org/show_bug.cgi?id=135579

Reviewed by Mario Sanchez Prada.

Source/WebCore:
If you have an existing range selected, and try to apply a select and replace operation, like capitalize,
searching for that range will fail because it skips the currently selected range.

For these cases, it seems the best way is to start the search from the start position, rather than relying on the
entire range.

Updated existing test: platform/mac/accessibility/select-text.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::selectText):

LayoutTests:
* platform/mac/accessibility/select-text-expected.txt:
* platform/mac/accessibility/select-text.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (172026 => 172027)


--- trunk/LayoutTests/ChangeLog	2014-08-05 03:58:28 UTC (rev 172026)
+++ trunk/LayoutTests/ChangeLog	2014-08-05 05:09:05 UTC (rev 172027)
@@ -1,3 +1,13 @@
+2014-08-04  Chris Fleizach  <[email protected]>
+
+        AX: Select activity behavior does not work when an existing range is already selected
+        https://bugs.webkit.org/show_bug.cgi?id=135579
+
+        Reviewed by Mario Sanchez Prada.
+
+        * platform/mac/accessibility/select-text-expected.txt:
+        * platform/mac/accessibility/select-text.html:
+
 2014-08-04  Benjamin Poulain  <[email protected]>
 
         Simplify the StyleInvalidation mode of rule collection

Modified: trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt (172026 => 172027)


--- trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt	2014-08-05 03:58:28 UTC (rev 172026)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt	2014-08-05 05:09:05 UTC (rev 172027)
@@ -1,6 +1,6 @@
 The slow BROWN cat jumps over the lazy dog.
 
-TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+TEXT2: THE quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
 
 This tests the ability to select and replace text with respect to selection.
 
@@ -35,6 +35,11 @@
 PASS result is 'quick'
 PASS windowSelection.getRangeAt(0).startOffset is 56
 PASS windowSelection.getRangeAt(0).endOffset is 61
+PASS windowSelection.getRangeAt(0).toString() is 'The'
+PASS result is 'The'
+PASS windowSelection.getRangeAt(0).toString() is 'THE'
+PASS windowSelection.getRangeAt(0).startOffset is 7
+PASS windowSelection.getRangeAt(0).endOffset is 10
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/platform/mac/accessibility/select-text.html (172026 => 172027)


--- trunk/LayoutTests/platform/mac/accessibility/select-text.html	2014-08-05 03:58:28 UTC (rev 172026)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text.html	2014-08-05 05:09:05 UTC (rev 172027)
@@ -143,6 +143,23 @@
         shouldBe("windowSelection.getRangeAt(0).startOffset", "56");
         shouldBe("windowSelection.getRangeAt(0).endOffset", "61");
 
+        // [https://bugs.webkit.org/show_bug.cgi?id=135575]
+        // When an existing range is already selected, we should not ignore that when searching for future activities.
+        // First find the range before the current selection.
+        var range = document.createRange();
+        range.setStart(document.getElementById("text2").firstChild, 7);
+        range.setEnd(document.getElementById("text2").firstChild, 10);
+        windowSelection.removeAllRanges();
+        windowSelection.addRange(range);
+        shouldBe("windowSelection.getRangeAt(0).toString()", "'The'");
+      
+        var text2 = accessibilityController.accessibleElementById("text2");
+        result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "the", null, "AXSelectTextActivityFindAndUppercase");
+        shouldBe("result", "'The'");
+        shouldBe("windowSelection.getRangeAt(0).toString()", "'THE'");
+        shouldBe("windowSelection.getRangeAt(0).startOffset", "7");
+        shouldBe("windowSelection.getRangeAt(0).endOffset", "10");
+
     }
 </script>
 

Modified: trunk/Source/WebCore/ChangeLog (172026 => 172027)


--- trunk/Source/WebCore/ChangeLog	2014-08-05 03:58:28 UTC (rev 172026)
+++ trunk/Source/WebCore/ChangeLog	2014-08-05 05:09:05 UTC (rev 172027)
@@ -1,3 +1,21 @@
+2014-08-04  Chris Fleizach  <[email protected]>
+
+        AX: Select activity behavior does not work when an existing range is already selected
+        https://bugs.webkit.org/show_bug.cgi?id=135579
+
+        Reviewed by Mario Sanchez Prada.
+
+        If you have an existing range selected, and try to apply a select and replace operation, like capitalize,
+        searching for that range will fail because it skips the currently selected range.
+
+        For these cases, it seems the best way is to start the search from the start position, rather than relying on the
+        entire range.
+
+        Updated existing test: platform/mac/accessibility/select-text.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::selectText):
+
 2014-08-04  Jer Noble  <[email protected]>
 
         [MSE][Mac] Seeking past buffered range will not resume playback when seek completes.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (172026 => 172027)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-08-05 03:58:28 UTC (rev 172026)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-08-05 05:09:05 UTC (rev 172027)
@@ -626,6 +626,8 @@
     Vector<String>& searchStrings = criteria->searchStrings;
     
     RefPtr<Range> selectedStringRange = selectionRange();
+    // When starting our search again, make this a zero length range so that search forwards will find this selected range if its appropriate.
+    selectedStringRange->setEnd(selectedStringRange->startContainer(), selectedStringRange->startOffset());
     
     RefPtr<Range> closestAfterStringRange = nullptr;
     RefPtr<Range> closestBeforeStringRange = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to