| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/accessibility/view_accessibility.h" | 5 #include "chrome/views/accessibility/view_accessibility.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/view_ids.h" | 8 #include "chrome/browser/view_ids.h" |
| 9 #include "chrome/browser/views/location_bar_view.h" | 9 #include "chrome/browser/views/location_bar_view.h" |
| 10 #include "chrome/views/accessibility/accessible_wrapper.h" | 10 #include "chrome/views/accessibility/accessible_wrapper.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // Retrieve child bounds. | 467 // Retrieve child bounds. |
| 468 view_bounds = view_->GetChildViewAt(var_id.lVal - 1)->bounds(); | 468 view_bounds = view_->GetChildViewAt(var_id.lVal - 1)->bounds(); |
| 469 // Parent View is current View. | 469 // Parent View is current View. |
| 470 parent = view_; | 470 parent = view_; |
| 471 } | 471 } |
| 472 | 472 |
| 473 if (!view_bounds.IsEmpty()) { | 473 if (!view_bounds.IsEmpty()) { |
| 474 *width = view_bounds.width(); | 474 *width = view_bounds.width(); |
| 475 *height = view_bounds.height(); | 475 *height = view_bounds.height(); |
| 476 | 476 |
| 477 CPoint topleft = view_bounds.origin().ToPOINT(); | 477 gfx::Point topleft(view_bounds.origin()); |
| 478 ChromeViews::View::ConvertPointToScreen(parent, &topleft); | 478 ChromeViews::View::ConvertPointToScreen(parent, &topleft); |
| 479 *x_left = topleft.x; | 479 *x_left = topleft.x(); |
| 480 *y_top = topleft.y; | 480 *y_top = topleft.y(); |
| 481 } else { | 481 } else { |
| 482 return E_FAIL; | 482 return E_FAIL; |
| 483 } | 483 } |
| 484 return S_OK; | 484 return S_OK; |
| 485 } | 485 } |
| 486 | 486 |
| 487 | 487 |
| 488 // TODO(klink): Handle case where child View is not contained by parent. | 488 // TODO(klink): Handle case where child View is not contained by parent. |
| 489 STDMETHODIMP ViewAccessibility::accHitTest(LONG x_left, LONG y_top, | 489 STDMETHODIMP ViewAccessibility::accHitTest(LONG x_left, LONG y_top, |
| 490 VARIANT* child) { | 490 VARIANT* child) { |
| 491 if (!child) { | 491 if (!child) { |
| 492 return E_INVALIDARG; | 492 return E_INVALIDARG; |
| 493 } | 493 } |
| 494 | 494 |
| 495 CPoint pt(x_left, y_top); | 495 gfx::Point pt(x_left, y_top); |
| 496 ChromeViews::View::ConvertPointToView(NULL, view_, &pt); | 496 ChromeViews::View::ConvertPointToView(NULL, view_, &pt); |
| 497 | 497 |
| 498 if (!view_->HitTest(pt)) { | 498 if (!view_->HitTest(pt.ToPOINT())) { |
| 499 // If containing parent is not hit, return with failure. | 499 // If containing parent is not hit, return with failure. |
| 500 child->vt = VT_EMPTY; | 500 child->vt = VT_EMPTY; |
| 501 return S_FALSE; | 501 return S_FALSE; |
| 502 } | 502 } |
| 503 | 503 |
| 504 int child_count = view_->GetChildViewCount(); | 504 int child_count = view_->GetChildViewCount(); |
| 505 bool child_hit = false; | 505 bool child_hit = false; |
| 506 ChromeViews::View* child_view = NULL; | 506 ChromeViews::View* child_view = NULL; |
| 507 for (int child_id = 0; child_id < child_count; ++child_id) { | 507 for (int child_id = 0; child_id < child_count; ++child_id) { |
| 508 // Search for hit within any of the children. | 508 // Search for hit within any of the children. |
| 509 child_view = view_->GetChildViewAt(child_id); | 509 child_view = view_->GetChildViewAt(child_id); |
| 510 ChromeViews::View::ConvertPointToView(view_, child_view, &pt); | 510 ChromeViews::View::ConvertPointToView(view_, child_view, &pt); |
| 511 if (child_view->HitTest(pt)) { | 511 if (child_view->HitTest(pt.ToPOINT())) { |
| 512 // Store child_id (adjusted with +1 to convert to MSAA indexing). | 512 // Store child_id (adjusted with +1 to convert to MSAA indexing). |
| 513 child->lVal = child_id + 1; | 513 child->lVal = child_id + 1; |
| 514 child_hit = true; | 514 child_hit = true; |
| 515 break; | 515 break; |
| 516 } | 516 } |
| 517 // Convert point back to parent view to test next child. | 517 // Convert point back to parent view to test next child. |
| 518 ChromeViews::View::ConvertPointToView(child_view, view_, &pt); | 518 ChromeViews::View::ConvertPointToView(child_view, view_, &pt); |
| 519 } | 519 } |
| 520 | 520 |
| 521 child->vt = VT_I4; | 521 child->vt = VT_I4; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 // Deprecated. | 679 // Deprecated. |
| 680 return DISP_E_MEMBERNOTFOUND; | 680 return DISP_E_MEMBERNOTFOUND; |
| 681 } | 681 } |
| 682 | 682 |
| 683 STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) { | 683 STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) { |
| 684 // Deprecated. | 684 // Deprecated. |
| 685 return DISP_E_MEMBERNOTFOUND; | 685 return DISP_E_MEMBERNOTFOUND; |
| 686 } | 686 } |
| 687 | 687 |
| 688 | 688 |
| OLD | NEW |