OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 STDMETHODIMP BrowserAccessibilityWin::accHitTest(LONG x_left, | 200 STDMETHODIMP BrowserAccessibilityWin::accHitTest(LONG x_left, |
201 LONG y_top, | 201 LONG y_top, |
202 VARIANT* child) { | 202 VARIANT* child) { |
203 if (!instance_active_) | 203 if (!instance_active_) |
204 return E_FAIL; | 204 return E_FAIL; |
205 | 205 |
206 if (!child) | 206 if (!child) |
207 return E_INVALIDARG; | 207 return E_INVALIDARG; |
208 | 208 |
209 gfx::Point point(x_left, y_top); | 209 gfx::Point point(x_left, y_top); |
210 if (!GetBoundsRect().Contains(point)) { | 210 if (!GetGlobalBoundsRect().Contains(point)) { |
211 // Return S_FALSE and VT_EMPTY when the outside the object's boundaries. | 211 // Return S_FALSE and VT_EMPTY when the outside the object's boundaries. |
212 child->vt = VT_EMPTY; | 212 child->vt = VT_EMPTY; |
213 return S_FALSE; | 213 return S_FALSE; |
214 } | 214 } |
215 | 215 |
216 BrowserAccessibility* result = BrowserAccessibilityForPoint(point); | 216 BrowserAccessibility* result = BrowserAccessibilityForPoint(point); |
217 if (result == this) { | 217 if (result == this) { |
218 // Point is within this object. | 218 // Point is within this object. |
219 child->vt = VT_I4; | 219 child->vt = VT_I4; |
220 child->lVal = CHILDID_SELF; | 220 child->lVal = CHILDID_SELF; |
(...skipping 10 matching lines...) Expand all Loading... |
231 if (!instance_active_) | 231 if (!instance_active_) |
232 return E_FAIL; | 232 return E_FAIL; |
233 | 233 |
234 if (!x_left || !y_top || !width || !height) | 234 if (!x_left || !y_top || !width || !height) |
235 return E_INVALIDARG; | 235 return E_INVALIDARG; |
236 | 236 |
237 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 237 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
238 if (!target) | 238 if (!target) |
239 return E_INVALIDARG; | 239 return E_INVALIDARG; |
240 | 240 |
241 gfx::Rect bounds = target->GetBoundsRect(); | 241 gfx::Rect bounds = target->GetGlobalBoundsRect(); |
242 *x_left = bounds.x(); | 242 *x_left = bounds.x(); |
243 *y_top = bounds.y(); | 243 *y_top = bounds.y(); |
244 *width = bounds.width(); | 244 *width = bounds.width(); |
245 *height = bounds.height(); | 245 *height = bounds.height(); |
246 | 246 |
247 return S_OK; | 247 return S_OK; |
248 } | 248 } |
249 | 249 |
250 STDMETHODIMP BrowserAccessibilityWin::accNavigate( | 250 STDMETHODIMP BrowserAccessibilityWin::accNavigate( |
251 LONG nav_dir, VARIANT start, VARIANT* end) { | 251 LONG nav_dir, VARIANT start, VARIANT* end) { |
(...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 } | 2966 } |
2967 | 2967 |
2968 // The role should always be set. | 2968 // The role should always be set. |
2969 DCHECK(!role_name_.empty() || ia_role_); | 2969 DCHECK(!role_name_.empty() || ia_role_); |
2970 | 2970 |
2971 // If we didn't explicitly set the IAccessible2 role, make it the same | 2971 // If we didn't explicitly set the IAccessible2 role, make it the same |
2972 // as the MSAA role. | 2972 // as the MSAA role. |
2973 if (!ia2_role_) | 2973 if (!ia2_role_) |
2974 ia2_role_ = ia_role_; | 2974 ia2_role_ = ia_role_; |
2975 } | 2975 } |
OLD | NEW |