Diff
Modified: trunk/LayoutTests/ChangeLog (229499 => 229500)
--- trunk/LayoutTests/ChangeLog 2018-03-10 03:37:13 UTC (rev 229499)
+++ trunk/LayoutTests/ChangeLog 2018-03-10 03:53:41 UTC (rev 229500)
@@ -1,3 +1,17 @@
+2018-03-09 Chris Fleizach <cfleiz...@apple.com>
+
+ AX: WebKit seems to be running spell checker even on non-editable content text
+ https://bugs.webkit.org/show_bug.cgi?id=183456
+ <rdar://problem/38076042>
+
+ Reviewed by Joanmarie Diggs.
+
+ * accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable-expected.txt: Added.
+ * accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html: Added.
+ * accessibility/mac/attributed-string/attributed-string-for-range-with-options.html:
+ * accessibility/mac/attributed-string/attributed-string-for-range.html:
+ Update tests to reflect that only editable content returns misspelled attributes.
+
2018-03-09 Nan Wang <n_w...@apple.com>
AX: AOM: More accessibility events support
Added: trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable-expected.txt (0 => 229500)
--- trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable-expected.txt 2018-03-10 03:53:41 UTC (rev 229500)
@@ -0,0 +1,17 @@
+
+
+test mispelled
+test mispelled
+This tests that spell checking is not run on non-editable elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS attrString.indexOf('AXMisspelled = 1') != -1 is true
+PASS attrString.indexOf('AXMisspelled = 1') != -1 is true
+PASS attrString.indexOf('AXMisspelled = 1') != -1 is true
+PASS staticText.attributedStringForTextMarkerRangeContainsAttribute('AXMisspelled', markerRange) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html (0 => 229500)
--- trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html (rev 0)
+++ trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html 2018-03-10 03:53:41 UTC (rev 229500)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<input type="text" id="textfield" value="test mispelled"><br>
+<textarea id="textarea">test mispelled</textarea>
+<div id="contenteditable" contenteditable="true"><b>test mispelled</b></div>
+
+<div role="group" id="div">test mispelled</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that spell checking is not run on non-editable elements.");
+
+ if (window.accessibilityController) {
+
+ var contentLength = document.getElementById("textfield").value.length;
+
+ // textfield
+ var attrString = accessibilityController.accessibleElementById("textfield").attributedStringForRange(0, contentLength);
+ shouldBeTrue("attrString.indexOf('AXMisspelled = 1') != -1");
+
+ // textarea
+ attrString = accessibilityController.accessibleElementById("textarea").attributedStringForRange(0, contentLength);
+ shouldBeTrue("attrString.indexOf('AXMisspelled = 1') != -1");
+
+ // contenteditable
+ attrString = accessibilityController.accessibleElementById("contenteditable").attributedStringForRange(0, contentLength);
+ shouldBeTrue("attrString.indexOf('AXMisspelled = 1') != -1");
+
+ // non-editable (the attributedStringForRange only works on text controls, so use attributedStringForTextMarkerRangeContainsAttribute).
+ var staticText = accessibilityController.accessibleElementById("div");
+ var markerRange = staticText.textMarkerRangeForElement(staticText);
+ shouldBeFalse("staticText.attributedStringForTextMarkerRangeContainsAttribute('AXMisspelled', markerRange)");
+ }
+
+</script>
+
+<script src=""
+
+</body>
+</html>
+
Modified: trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-for-range-with-options.html (229499 => 229500)
--- trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-for-range-with-options.html 2018-03-10 03:37:13 UTC (rev 229499)
+++ trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-for-range-with-options.html 2018-03-10 03:53:41 UTC (rev 229500)
@@ -8,7 +8,7 @@
</head>
<body id="body">
- <div id="content">
+ <div id="content" contenteditable>
word mispelled word
</div>
Modified: trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-for-range.html (229499 => 229500)
--- trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-for-range.html 2018-03-10 03:37:13 UTC (rev 229499)
+++ trunk/LayoutTests/accessibility/mac/attributed-string/attributed-string-for-range.html 2018-03-10 03:53:41 UTC (rev 229500)
@@ -8,7 +8,7 @@
</head>
<body id="body">
- <div id="content">
+ <div id="content" contenteditable>
word mispelled word
</div>
Modified: trunk/Source/WebCore/ChangeLog (229499 => 229500)
--- trunk/Source/WebCore/ChangeLog 2018-03-10 03:37:13 UTC (rev 229499)
+++ trunk/Source/WebCore/ChangeLog 2018-03-10 03:53:41 UTC (rev 229500)
@@ -1,3 +1,18 @@
+2018-03-09 Chris Fleizach <cfleiz...@apple.com>
+
+ AX: WebKit seems to be running spell checker even on non-editable content text
+ https://bugs.webkit.org/show_bug.cgi?id=183456
+ <rdar://problem/38076042>
+
+ Reviewed by Joanmarie Diggs.
+
+ Test: accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html
+
+ Only apply misspelled attributes if it's for editable text. It's not useful or performant to do this for static text.
+
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (AXAttributeStringSetSpelling):
+
2018-03-09 Nan Wang <n_w...@apple.com>
AX: AOM: More accessibility events support
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (229499 => 229500)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2018-03-10 03:37:13 UTC (rev 229499)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2018-03-10 03:53:41 UTC (rev 229500)
@@ -922,6 +922,12 @@
static void AXAttributeStringSetSpelling(NSMutableAttributedString* attrString, Node* node, StringView text, NSRange range)
{
+ ASSERT(node);
+
+ // If this node is not inside editable content, do not run the spell checker on the text.
+ if (!node->document().axObjectCache()->rootAXEditableElement(node))
+ return;
+
if (unifiedTextCheckerEnabled(node->document().frame())) {
// Check the spelling directly since document->markersForNode() does not store the misspelled marking when the cursor is in a word.
TextCheckerClient* checker = node->document().frame()->editor().textChecker();