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) { |