Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1369)

Unified Diff: Source/web/TextFinder.cpp

Issue 696533003: Expose accessibility information about find in page results to the client. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/TextFinder.h ('k') | public/web/WebFrameClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/TextFinder.cpp
diff --git a/Source/web/TextFinder.cpp b/Source/web/TextFinder.cpp
index d5b56a6fdf9d4385a04db1181fdaeea8fcbc01c0..4a12362886c3429f00a1dbc966cad2c34f457a0c 100644
--- a/Source/web/TextFinder.cpp
+++ b/Source/web/TextFinder.cpp
@@ -32,6 +32,8 @@
#include "config.h"
#include "web/TextFinder.h"
+#include "core/accessibility/AXObject.h"
+#include "core/accessibility/AXObjectCache.h"
#include "core/dom/DocumentMarker.h"
#include "core/dom/DocumentMarkerController.h"
#include "core/dom/Range.h"
@@ -44,6 +46,7 @@
#include "core/rendering/RenderObject.h"
#include "platform/Timer.h"
#include "public/platform/WebVector.h"
+#include "public/web/WebAXObject.h"
#include "public/web/WebFindOptions.h"
#include "public/web/WebFrameClient.h"
#include "public/web/WebViewClient.h"
@@ -188,6 +191,7 @@ bool TextFinder::find(int identifier, const WebString& searchText, const WebFind
if (selectionRect) {
*selectionRect = ownerFrame().frameView()->contentsToWindow(m_activeMatch->boundingBox());
reportFindInPageSelection(*selectionRect, m_activeMatchIndexInCurrentFrame + 1, identifier);
+ reportFindInPageResultToAccessibility(identifier);
}
}
@@ -207,6 +211,26 @@ void TextFinder::stopFindingAndClearSelection()
ownerFrame().invalidateAll();
}
+void TextFinder::reportFindInPageResultToAccessibility(int identifier)
+{
+ AXObjectCache* axObjectCache = ownerFrame().frame()->document()->existingAXObjectCache();
+ if (!axObjectCache)
+ return;
+
+ AXObject* startObject = axObjectCache->get(m_activeMatch->startContainer());
+ AXObject* endObject = axObjectCache->get(m_activeMatch->endContainer());
+ if (!startObject || !endObject)
+ return;
+
+ WebLocalFrameImpl* mainFrameImpl = ownerFrame().viewImpl()->mainFrameImpl();
+ if (mainFrameImpl && mainFrameImpl->client()) {
+ mainFrameImpl->client()->handleAccessibilityFindInPageResult(
+ identifier, m_activeMatchIndexInCurrentFrame + 1,
+ WebAXObject(startObject), m_activeMatch->startOffset(),
+ WebAXObject(endObject), m_activeMatch->endOffset());
+ }
+}
+
void TextFinder::scopeStringMatches(int identifier, const WebString& searchText, const WebFindOptions& options, bool reset)
{
if (reset) {
« no previous file with comments | « Source/web/TextFinder.h ('k') | public/web/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698