Added accessibility notification from Blink when spelling mistakes are detected. (issue 2268183006 by nektar@chromium.org)

0 views
Skip to first unread message

nektar@chromium.org via codereview.chromium.org

unread,
Aug 24, 2016, 9:51:28 PM8/24/16
to dmaz...@chromium.org, nek...@chromium.org, chromium...@chromium.org, blink-...@chromium.org, groby+bl...@chromium.org
Reviewers: dmazzoni
CL: https://codereview.chromium.org/2268183006/

Description:
Added accessibility notification from Blink when spelling mistakes are detected.

I still have to figure out how to test this properly and also ask for a review
from Yosin@, but please have a first look to tell me if it's in the right
direction.
BUG=640479
R=dmaz...@chromium.org

Base URL: https://chromium.googlesource.com/chromium/src.git@master

Affected files (+14, -0 lines):
M third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.h
M third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp


Index: third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
index b37a5d86c095894551447c485c8b0674d710e165..048e6587ff93c5562a9a85a0c4b67ed8a85bec49 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
@@ -25,6 +25,7 @@

#include "core/editing/spellcheck/SpellCheckRequester.h"

+#include "core/dom/AXObjectCache.h"
#include "core/dom/Document.h"
#include "core/dom/Node.h"
#include "core/editing/EditingUtilities.h"
@@ -284,6 +285,7 @@ void SpellCheckRequester::didCheckSucceed(int sequence, const Vector<TextCheckin
}
}
didCheck(sequence, results);
+ reportDocumentMarkersChangeToAccessibility();
}

void SpellCheckRequester::didCheckCancel(int sequence)
@@ -292,6 +294,17 @@ void SpellCheckRequester::didCheckCancel(int sequence)
didCheck(sequence, results);
}

+void SpellCheckRequester::reportDocumentMarkersChangeToAccessibility() const
+{
+ if (!m_processingRequest || !m_processingRequest->isValid())
+ return;
+
+ AXObjectCache* axObjectCache = frame().document()->existingAXObjectCache();
+ if (!axObjectCache)
+ return;
+ axObjectCache->handleEditableTextContentChanged(m_processingRequest->rootEditableElement());
+}
+
DEFINE_TRACE(SpellCheckRequester)
{
visitor->trace(m_frame);
Index: third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.h
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.h b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.h
index 366713cfe36dcd24713abdf0139b978af3e9f2af..b218c7ba74b33d2ed63e135baa9d76be3365b334 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.h
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.h
@@ -114,6 +114,7 @@ private:
void didCheckSucceed(int sequence, const Vector<TextCheckingResult>&);
void didCheckCancel(int sequence);
void didCheck(int sequence, const Vector<TextCheckingResult>&);
+ void reportDocumentMarkersChangeToAccessibility() const;

void clearProcessingRequest();



nek...@chromium.org

unread,
Aug 24, 2016, 9:52:39 PM8/24/16
to dmaz...@chromium.org, dts...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, groby+bl...@chromium.org

dmaz...@chromium.org

unread,
Aug 25, 2016, 11:19:21 AM8/25/16
to nek...@chromium.org, dts...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, groby+bl...@chromium.org

https://codereview.chromium.org/2268183006/diff/1/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
File
third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
(right):

https://codereview.chromium.org/2268183006/diff/1/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp#newcode305
third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp:305:
axObjectCache->handleEditableTextContentChanged(m_processingRequest->rootEditableElement());
Please add a new AXObjectCache function specifically for this, like
handleTextMarkersChanged

In a contenteditable, what node are the text markers attached to? Are
they attached to the root editable element, or to a child like a static
text element?

If it's a child, then we need to fire a notification on that child also.

https://codereview.chromium.org/2268183006/

dmaz...@chromium.org

unread,
Aug 25, 2016, 11:20:38 AM8/25/16
to nek...@chromium.org, dts...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, groby+bl...@chromium.org
As for testing, could you use
LayoutTests/accessibility/contenteditable-notifications.html as a guide and
write something along those lines?


https://codereview.chromium.org/2268183006/
Reply all
Reply to author
Forward
0 new messages