| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
| 8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
| 9 | 9 |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 return S_OK; | 783 return S_OK; |
| 784 } | 784 } |
| 785 | 785 |
| 786 STDMETHODIMP BrowserAccessibilityWin::scrollToPoint( | 786 STDMETHODIMP BrowserAccessibilityWin::scrollToPoint( |
| 787 enum IA2CoordinateType coordinate_type, | 787 enum IA2CoordinateType coordinate_type, |
| 788 LONG x, | 788 LONG x, |
| 789 LONG y) { | 789 LONG y) { |
| 790 if (!instance_active_) | 790 if (!instance_active_) |
| 791 return E_FAIL; | 791 return E_FAIL; |
| 792 | 792 |
| 793 gfx::Point scroll_to(x, y); |
| 794 |
| 793 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { | 795 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { |
| 794 gfx::Point top_left = manager_->GetViewBounds().origin(); | 796 scroll_to -= manager_->GetViewBounds().OffsetFromOrigin(); |
| 795 x -= top_left.x(); | |
| 796 y -= top_left.y(); | |
| 797 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { | 797 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { |
| 798 if (parent_) { | 798 if (parent_) |
| 799 gfx::Rect parent_bounds = parent_->location(); | 799 scroll_to += parent_->location().OffsetFromOrigin(); |
| 800 x += parent_bounds.x(); | |
| 801 y += parent_bounds.y(); | |
| 802 } | |
| 803 } else { | 800 } else { |
| 804 return E_INVALIDARG; | 801 return E_INVALIDARG; |
| 805 } | 802 } |
| 806 | 803 |
| 807 gfx::Rect r = location_; | 804 manager_->ScrollToPoint(*this, scroll_to); |
| 808 manager_->ScrollToPoint(*this, gfx::Point(x, y)); | |
| 809 | 805 |
| 810 static_cast<BrowserAccessibilityManagerWin*>(manager_) | 806 static_cast<BrowserAccessibilityManagerWin*>(manager_) |
| 811 ->TrackScrollingObject(this); | 807 ->TrackScrollingObject(this); |
| 812 | 808 |
| 813 return S_OK; | 809 return S_OK; |
| 814 } | 810 } |
| 815 | 811 |
| 816 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( | 812 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( |
| 817 LONG* group_level, | 813 LONG* group_level, |
| 818 LONG* similar_items_in_group, | 814 LONG* similar_items_in_group, |
| (...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3515 // The role should always be set. | 3511 // The role should always be set. |
| 3516 DCHECK(!role_name_.empty() || ia_role_); | 3512 DCHECK(!role_name_.empty() || ia_role_); |
| 3517 | 3513 |
| 3518 // If we didn't explicitly set the IAccessible2 role, make it the same | 3514 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 3519 // as the MSAA role. | 3515 // as the MSAA role. |
| 3520 if (!ia2_role_) | 3516 if (!ia2_role_) |
| 3521 ia2_role_ = ia_role_; | 3517 ia2_role_ = ia_role_; |
| 3522 } | 3518 } |
| 3523 | 3519 |
| 3524 } // namespace content | 3520 } // namespace content |
| OLD | NEW |