OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 "content/browser/accessibility/browser_accessibility_com_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_com_win.h" |
6 | 6 |
7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 } | 434 } |
435 | 435 |
436 STDMETHODIMP BrowserAccessibilityComWin::accHitTest(LONG x_left, | 436 STDMETHODIMP BrowserAccessibilityComWin::accHitTest(LONG x_left, |
437 LONG y_top, | 437 LONG y_top, |
438 VARIANT* child) { | 438 VARIANT* child) { |
439 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_HIT_TEST); | 439 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_HIT_TEST); |
440 | 440 |
441 if (!owner()) | 441 if (!owner()) |
442 return E_FAIL; | 442 return E_FAIL; |
443 | 443 |
444 auto* manager = Manager(); | 444 return AXPlatformNodeWin::accHitTest(x_left, y_top, child); |
445 if (!manager) | |
446 return E_FAIL; | |
447 | |
448 if (!child) | |
449 return E_INVALIDARG; | |
450 | |
451 gfx::Point point(x_left, y_top); | |
452 if (!owner()->GetScreenBoundsRect().Contains(point)) { | |
453 // Return S_FALSE and VT_EMPTY when outside the object's boundaries. | |
454 child->vt = VT_EMPTY; | |
455 return S_FALSE; | |
456 } | |
457 | |
458 BrowserAccessibility* result = manager->CachingAsyncHitTest(point); | |
459 if (result == owner()) { | |
460 // Point is within this object. | |
461 child->vt = VT_I4; | |
462 child->lVal = CHILDID_SELF; | |
463 } else { | |
464 child->vt = VT_DISPATCH; | |
465 child->pdispVal = ToBrowserAccessibilityComWin(result)->NewReference(); | |
466 } | |
467 return S_OK; | |
468 } | 445 } |
469 | 446 |
470 STDMETHODIMP BrowserAccessibilityComWin::accLocation(LONG* x_left, | 447 STDMETHODIMP BrowserAccessibilityComWin::accLocation(LONG* x_left, |
471 LONG* y_top, | 448 LONG* y_top, |
472 LONG* width, | 449 LONG* width, |
473 LONG* height, | 450 LONG* height, |
474 VARIANT var_id) { | 451 VARIANT var_id) { |
475 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_LOCATION); | 452 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_LOCATION); |
476 if (!owner()) | 453 if (!owner()) |
477 return E_FAIL; | 454 return E_FAIL; |
(...skipping 5105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5583 | 5560 |
5584 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( | 5561 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( |
5585 BrowserAccessibility* obj) { | 5562 BrowserAccessibility* obj) { |
5586 if (!obj || !obj->IsNative()) | 5563 if (!obj || !obj->IsNative()) |
5587 return nullptr; | 5564 return nullptr; |
5588 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); | 5565 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); |
5589 return result; | 5566 return result; |
5590 } | 5567 } |
5591 | 5568 |
5592 } // namespace content | 5569 } // namespace content |
OLD | NEW |