OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/accessibility/browser_accessibility_win.h" | 5 #include "chrome/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 "chrome/browser/accessibility/browser_accessibility_manager_win.h" | 10 #include "chrome/browser/accessibility/browser_accessibility_manager_win.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 if (!instance_active_) | 502 if (!instance_active_) |
503 return E_FAIL; | 503 return E_FAIL; |
504 | 504 |
505 if (!x || !y) | 505 if (!x || !y) |
506 return E_INVALIDARG; | 506 return E_INVALIDARG; |
507 | 507 |
508 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { | 508 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { |
509 HWND parent_hwnd = manager_->GetParentView(); | 509 HWND parent_hwnd = manager_->GetParentView(); |
510 POINT top_left = {0, 0}; | 510 POINT top_left = {0, 0}; |
511 ::ClientToScreen(parent_hwnd, &top_left); | 511 ::ClientToScreen(parent_hwnd, &top_left); |
512 *x = location_.x + top_left.x; | 512 *x = location_.x() + top_left.x; |
513 *y = location_.y + top_left.y; | 513 *y = location_.y() + top_left.y; |
514 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { | 514 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { |
515 *x = location_.x; | 515 *x = location_.x(); |
516 *y = location_.y; | 516 *y = location_.y(); |
517 if (parent_) { | 517 if (parent_) { |
518 *x -= parent_->location().x; | 518 *x -= parent_->location().x(); |
519 *y -= parent_->location().y; | 519 *y -= parent_->location().y(); |
520 } | 520 } |
521 } else { | 521 } else { |
522 return E_INVALIDARG; | 522 return E_INVALIDARG; |
523 } | 523 } |
524 | 524 |
525 return S_OK; | 525 return S_OK; |
526 } | 526 } |
527 | 527 |
528 STDMETHODIMP BrowserAccessibilityWin::get_imageSize(LONG* height, LONG* width) { | 528 STDMETHODIMP BrowserAccessibilityWin::get_imageSize(LONG* height, LONG* width) { |
529 if (!instance_active_) | 529 if (!instance_active_) |
530 return E_FAIL; | 530 return E_FAIL; |
531 | 531 |
532 if (!height || !width) | 532 if (!height || !width) |
533 return E_INVALIDARG; | 533 return E_INVALIDARG; |
534 | 534 |
535 *height = location_.height; | 535 *height = location_.height(); |
536 *width = location_.width; | 536 *width = location_.width(); |
537 return S_OK; | 537 return S_OK; |
538 } | 538 } |
539 | 539 |
540 // | 540 // |
541 // IAccessibleText methods. | 541 // IAccessibleText methods. |
542 // | 542 // |
543 | 543 |
544 STDMETHODIMP BrowserAccessibilityWin::get_nCharacters(LONG* n_characters) { | 544 STDMETHODIMP BrowserAccessibilityWin::get_nCharacters(LONG* n_characters) { |
545 if (!instance_active_) | 545 if (!instance_active_) |
546 return E_FAIL; | 546 return E_FAIL; |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 } | 1585 } |
1586 | 1586 |
1587 // The role should always be set. | 1587 // The role should always be set. |
1588 DCHECK(!role_name_.empty() || ia_role_); | 1588 DCHECK(!role_name_.empty() || ia_role_); |
1589 | 1589 |
1590 // If we didn't explicitly set the IAccessible2 role, make it the same | 1590 // If we didn't explicitly set the IAccessible2 role, make it the same |
1591 // as the MSAA role. | 1591 // as the MSAA role. |
1592 if (!ia2_role_) | 1592 if (!ia2_role_) |
1593 ia2_role_ = ia_role_; | 1593 ia2_role_ = ia_role_; |
1594 } | 1594 } |
OLD | NEW |