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

Unified Diff: ui/accessibility/platform/test_ax_node_wrapper.cc

Issue 2948513002: Forward BrowserAccessibility::accHitTest to AXPlatformNode. (Closed)
Patch Set: spelling Created 3 years, 6 months 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 | « ui/accessibility/platform/test_ax_node_wrapper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/platform/test_ax_node_wrapper.cc
diff --git a/ui/accessibility/platform/test_ax_node_wrapper.cc b/ui/accessibility/platform/test_ax_node_wrapper.cc
index 22766403d3de3e1ece8557904a0fd7f89937c9cc..c8574d76775758f12c1348d29b150977c55eea50 100644
--- a/ui/accessibility/platform/test_ax_node_wrapper.cc
+++ b/ui/accessibility/platform/test_ax_node_wrapper.cc
@@ -111,8 +111,30 @@ gfx::Rect TestAXNodeWrapper::GetScreenBoundsRect() const {
return gfx::ToEnclosingRect(bounds);
}
+TestAXNodeWrapper* TestAXNodeWrapper::HitTestSyncInternal(int x, int y) {
+ // Here we find the deepest child whose bounding box contains the given point.
+ // The assuptions are that there are no overlapping bounding rects and that
+ // all children have smaller bounding rects than their parents.
+ if (!GetScreenBoundsRect().Contains(gfx::Rect(x, y)))
+ return nullptr;
+
+ for (int i = 0; i < GetChildCount(); i++) {
+ TestAXNodeWrapper* child = GetOrCreate(tree_, node_->children()[i]);
+ if (!child)
+ return nullptr;
+
+ TestAXNodeWrapper* result = child->HitTestSyncInternal(x, y);
+ if (result) {
+ return result;
+ }
+ }
+ return this;
+}
+
gfx::NativeViewAccessible TestAXNodeWrapper::HitTestSync(int x, int y) {
- return nullptr;
+ TestAXNodeWrapper* wrapper = HitTestSyncInternal(x, y);
+ return wrapper ? wrapper->ax_platform_node()->GetNativeViewAccessible()
+ : nullptr;
}
gfx::NativeViewAccessible TestAXNodeWrapper::GetFocus() {
« no previous file with comments | « ui/accessibility/platform/test_ax_node_wrapper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698