Modified: trunk/LayoutTests/ChangeLog (172027 => 172028)
--- trunk/LayoutTests/ChangeLog 2014-08-05 05:09:05 UTC (rev 172027)
+++ trunk/LayoutTests/ChangeLog 2014-08-05 15:15:58 UTC (rev 172028)
@@ -1,3 +1,13 @@
+2014-08-05 Chris Fleizach <[email protected]>
+
+ AX: Select text activity should return replaced text instead of previously selected text
+ https://bugs.webkit.org/show_bug.cgi?id=135595
+
+ Reviewed by Mario Sanchez Prada.
+
+ * platform/mac/accessibility/select-text-expected.txt:
+ * platform/mac/accessibility/select-text.html:
+
2014-08-04 Chris Fleizach <[email protected]>
AX: Select activity behavior does not work when an existing range is already selected
Modified: trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt (172027 => 172028)
--- trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt 2014-08-05 05:09:05 UTC (rev 172027)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt 2014-08-05 15:15:58 UTC (rev 172028)
@@ -19,15 +19,15 @@
PASS selection is 'dog'
PASS result is 'fox'
PASS selection is 'fox'
-PASS result is 'quick'
+PASS result is 'slow'
PASS selection is 'slow'
-PASS result is 'fox'
+PASS result is 'cat'
PASS selection is 'cat'
+PASS result is 'Brown'
+PASS selection is 'Brown'
PASS result is 'brown'
-PASS selection is 'Brown'
-PASS result is 'Brown'
PASS selection is 'brown'
-PASS result is 'brown'
+PASS result is 'BROWN'
PASS selection is 'BROWN'
PASS result is 'quick'
PASS windowSelection.getRangeAt(0).startOffset is 11
@@ -36,7 +36,7 @@
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 result is 'THE'
PASS windowSelection.getRangeAt(0).toString() is 'THE'
PASS windowSelection.getRangeAt(0).startOffset is 7
PASS windowSelection.getRangeAt(0).endOffset is 10
Modified: trunk/LayoutTests/platform/mac/accessibility/select-text.html (172027 => 172028)
--- trunk/LayoutTests/platform/mac/accessibility/select-text.html 2014-08-05 05:09:05 UTC (rev 172027)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text.html 2014-08-05 15:15:58 UTC (rev 172028)
@@ -80,35 +80,35 @@
// Select and replace text closest to selection (single search string).
selectElementText(target);
result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "quick", "slow");
- shouldBe("result", "'quick'");
+ shouldBe("result", "'slow'");
selection = selectedText();
shouldBe("selection", "'slow'");
// Select and replace text closest to selection (multiple search strings).
selectElementText(target);
result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", ["dog", "fox"], "cat");
- shouldBe("result", "'fox'");
+ shouldBe("result", "'cat'");
selection = selectedText();
shouldBe("selection", "'cat'");
// Select brown and capitalize it.
selectElementText(target);
result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "brown", null, "AXSelectTextActivityFindAndCapitalize");
- shouldBe("result", "'brown'");
+ shouldBe("result", "'Brown'");
selection = selectedText();
shouldBe("selection", "'Brown'");
// Select Brown and lowercase it.
selectElementText(target);
result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "Brown", null, "AXSelectTextActivityFindAndLowercase");
- shouldBe("result", "'Brown'");
+ shouldBe("result", "'brown'");
selection = selectedText();
shouldBe("selection", "'brown'");
// Select brown and uppercase it.
selectElementText(target);
result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "brown", null, "AXSelectTextActivityFindAndUppercase");
- shouldBe("result", "'brown'");
+ shouldBe("result", "'BROWN'");
selection = selectedText();
shouldBe("selection", "'BROWN'");
@@ -155,11 +155,10 @@
var text2 = accessibilityController.accessibleElementById("text2");
result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "the", null, "AXSelectTextActivityFindAndUppercase");
- shouldBe("result", "'The'");
+ 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 (172027 => 172028)
--- trunk/Source/WebCore/ChangeLog 2014-08-05 05:09:05 UTC (rev 172027)
+++ trunk/Source/WebCore/ChangeLog 2014-08-05 15:15:58 UTC (rev 172028)
@@ -1,3 +1,17 @@
+2014-08-05 Chris Fleizach <[email protected]>
+
+ AX: Select text activity should return replaced text instead of previously selected text
+ https://bugs.webkit.org/show_bug.cgi?id=135595
+
+ Reviewed by Mario Sanchez Prada.
+
+ When the select activity API is used to replace text, the replacement string should be returned instead of the old selected text.
+
+ Updated existing test: platform/mac/accessibility/select-text.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::selectText):
+
2014-08-04 Chris Fleizach <[email protected]>
AX: Select activity behavior does not work when an existing range is already selected
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (172027 => 172028)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2014-08-05 05:09:05 UTC (rev 172027)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2014-08-05 15:15:58 UTC (rev 172028)
@@ -676,8 +676,13 @@
break;
}
- if (replaceSelection)
+ // A bit obvious, but worth noting the API contract for this method is that we should
+ // return the replacement string when replacing, but the selected string if not.
+ if (replaceSelection) {
frame->editor().replaceSelectionWithText(replacementString, true, true);
+ return replacementString;
+ }
+
return closestString;
}
}