Title: [171994] trunk
- Revision
- 171994
- Author
- [email protected]
- Date
- 2014-08-04 10:23:49 -0700 (Mon, 04 Aug 2014)
Log Message
AX: The Dictation command "Replace <phrase> with <phrase>" always capitalizes the replacement string
https://bugs.webkit.org/show_bug.cgi?id=135557
Reviewed by Mario Sanchez Prada.
Source/WebCore:
When replacing text, we should match the capitalization of the word being replaced
(unless the replacement looks like an abbreviation).
Test: platform/mac/accessibility/find-and-replace-match-capitalization.html
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::selectText):
LayoutTests:
* platform/mac/accessibility/find-and-replace-match-capitalization-expected.txt: Added.
* platform/mac/accessibility/find-and-replace-match-capitalization.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (171993 => 171994)
--- trunk/LayoutTests/ChangeLog 2014-08-04 17:19:12 UTC (rev 171993)
+++ trunk/LayoutTests/ChangeLog 2014-08-04 17:23:49 UTC (rev 171994)
@@ -1,3 +1,13 @@
+2014-08-04 Chris Fleizach <[email protected]>
+
+ AX: The Dictation command "Replace <phrase> with <phrase>" always capitalizes the replacement string
+ https://bugs.webkit.org/show_bug.cgi?id=135557
+
+ Reviewed by Mario Sanchez Prada.
+
+ * platform/mac/accessibility/find-and-replace-match-capitalization-expected.txt: Added.
+ * platform/mac/accessibility/find-and-replace-match-capitalization.html: Added.
+
2014-08-04 Michał Pakuła vel Rutka <[email protected]>
Unreviewed EFL gardening
Added: trunk/LayoutTests/platform/mac/accessibility/find-and-replace-match-capitalization-expected.txt (0 => 171994)
--- trunk/LayoutTests/platform/mac/accessibility/find-and-replace-match-capitalization-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/find-and-replace-match-capitalization-expected.txt 2014-08-04 17:23:49 UTC (rev 171994)
@@ -0,0 +1,14 @@
+The Test test TEST.
+
+This tests that find and replace will match the capitalization of the replaced word.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('text').innerHTML is 'The Test jumped high.'
+PASS document.getElementById('text').innerHTML is 'The Test test high.'
+PASS document.getElementById('text').innerHTML is 'The Test test TEST.'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/find-and-replace-match-capitalization.html (0 => 171994)
--- trunk/LayoutTests/platform/mac/accessibility/find-and-replace-match-capitalization.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/find-and-replace-match-capitalization.html 2014-08-04 17:23:49 UTC (rev 171994)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The Man jumped high.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests that find and replace will match the capitalization of the replaced word.");
+
+ if (window.accessibilityController) {
+ var text = accessibilityController.accessibleElementById("text");
+ document.getElementById("text").focus();
+
+ // 'Man' is capitalized, so the replaced text should end up capitalized.
+ var result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "man", "test");
+ shouldBe("document.getElementById('text').innerHTML", "'The Test jumped high.'");
+
+ // 'jumped' is not capitalized so the text should not be capitalized.
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "jumped", "Test");
+ shouldBe("document.getElementById('text').innerHTML", "'The Test test high.'");
+
+ // The replacement text was all caps, so don't change based on the existing text.
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "high", "TEST");
+ shouldBe("document.getElementById('text').innerHTML", "'The Test test TEST.'");
+
+ }
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (171993 => 171994)
--- trunk/Source/WebCore/ChangeLog 2014-08-04 17:19:12 UTC (rev 171993)
+++ trunk/Source/WebCore/ChangeLog 2014-08-04 17:23:49 UTC (rev 171994)
@@ -1,3 +1,18 @@
+2014-08-04 Chris Fleizach <[email protected]>
+
+ AX: The Dictation command "Replace <phrase> with <phrase>" always capitalizes the replacement string
+ https://bugs.webkit.org/show_bug.cgi?id=135557
+
+ Reviewed by Mario Sanchez Prada.
+
+ When replacing text, we should match the capitalization of the word being replaced
+ (unless the replacement looks like an abbreviation).
+
+ Test: platform/mac/accessibility/find-and-replace-match-capitalization.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::selectText):
+
2014-08-04 Pratik Solanki <[email protected]>
QuickLook resources are cache-replaced with their original binary data causing ASSERT(m_data->size() == newBuffer->size()) in CachedResource.cpp
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (171993 => 171994)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2014-08-04 17:19:12 UTC (rev 171993)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2014-08-04 17:23:49 UTC (rev 171994)
@@ -647,9 +647,20 @@
replacementString = closestString.lower();
replaceSelection = true;
break;
- case FindAndReplaceActivity:
+ case FindAndReplaceActivity: {
replaceSelection = true;
+
+ // When applying find and replace activities, we want to match the capitalization of the replaced text,
+ // (unless we're replacing with an abbreviation.)
+ String uppercaseReplacementString = replacementString.upper();
+ if (closestString.length() > 0 && replacementString.length() > 2 && replacementString != uppercaseReplacementString) {
+ if (closestString[0] == closestString.upper()[0])
+ makeCapitalized(&replacementString, 0);
+ else
+ replacementString = replacementString.lower();
+ }
break;
+ }
case FindAndSelectActivity:
break;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes