OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <atlbase.h> | 5 #include <atlbase.h> |
6 #include <atlcom.h> | 6 #include <atlcom.h> |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <oleacc.h> | 8 #include <oleacc.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 return -1; | 271 return -1; |
272 } | 272 } |
273 | 273 |
274 // | 274 // |
275 // IAccessible implementation. | 275 // IAccessible implementation. |
276 // | 276 // |
277 | 277 |
278 STDMETHODIMP AXPlatformNodeWin::accHitTest( | 278 STDMETHODIMP AXPlatformNodeWin::accHitTest( |
279 LONG x_left, LONG y_top, VARIANT* child) { | 279 LONG x_left, LONG y_top, VARIANT* child) { |
280 COM_OBJECT_VALIDATE_1_ARG(child); | 280 COM_OBJECT_VALIDATE_1_ARG(child); |
| 281 |
| 282 gfx::Point point(x_left, y_top); |
| 283 if (!delegate_->GetScreenBoundsRect().Contains(point)) { |
| 284 // Return S_FALSE and VT_EMPTY when outside the object's boundaries. |
| 285 child->vt = VT_EMPTY; |
| 286 return S_FALSE; |
| 287 } |
| 288 |
281 gfx::NativeViewAccessible hit_child = delegate_->HitTestSync(x_left, y_top); | 289 gfx::NativeViewAccessible hit_child = delegate_->HitTestSync(x_left, y_top); |
282 if (!hit_child) { | 290 if (!hit_child) { |
283 child->vt = VT_EMPTY; | 291 child->vt = VT_EMPTY; |
284 return S_FALSE; | 292 return S_FALSE; |
285 } | 293 } |
286 | 294 |
287 if (hit_child == this) { | 295 if (hit_child == this) { |
288 // This object is the best match, so return CHILDID_SELF. It's tempting to | 296 // This object is the best match, so return CHILDID_SELF. It's tempting to |
289 // simplify the logic and use VT_DISPATCH everywhere, but the Windows | 297 // simplify the logic and use VT_DISPATCH everywhere, but the Windows |
290 // call AccessibleObjectFromPoint will keep calling accHitTest until some | 298 // call AccessibleObjectFromPoint will keep calling accHitTest until some |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 | 1707 |
1700 AXPlatformNodeBase* base = | 1708 AXPlatformNodeBase* base = |
1701 FromNativeViewAccessible(node->GetNativeViewAccessible()); | 1709 FromNativeViewAccessible(node->GetNativeViewAccessible()); |
1702 if (base && !IsDescendant(base)) | 1710 if (base && !IsDescendant(base)) |
1703 base = nullptr; | 1711 base = nullptr; |
1704 | 1712 |
1705 return static_cast<AXPlatformNodeWin*>(base); | 1713 return static_cast<AXPlatformNodeWin*>(base); |
1706 } | 1714 } |
1707 | 1715 |
1708 } // namespace ui | 1716 } // namespace ui |
OLD | NEW |