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 <algorithm> | 10 #include <algorithm> |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 428 } |
429 | 429 |
430 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { | 430 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { |
431 if (!instance_active()) | 431 if (!instance_active()) |
432 return E_FAIL; | 432 return E_FAIL; |
433 | 433 |
434 if (!focus_child) | 434 if (!focus_child) |
435 return E_INVALIDARG; | 435 return E_INVALIDARG; |
436 | 436 |
437 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( | 437 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( |
438 manager()->GetFocus(this)); | 438 manager()->GetFocus()); |
439 if (focus == this) { | 439 if (focus == this) { |
440 focus_child->vt = VT_I4; | 440 focus_child->vt = VT_I4; |
441 focus_child->lVal = CHILDID_SELF; | 441 focus_child->lVal = CHILDID_SELF; |
442 } else if (focus == NULL) { | 442 } else if (focus == NULL) { |
443 focus_child->vt = VT_EMPTY; | 443 focus_child->vt = VT_EMPTY; |
444 } else { | 444 } else { |
445 focus_child->vt = VT_DISPATCH; | 445 focus_child->vt = VT_DISPATCH; |
446 focus_child->pdispVal = focus->NewReference(); | 446 focus_child->pdispVal = focus->NewReference(); |
447 } | 447 } |
448 | 448 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 563 |
564 if (!state) | 564 if (!state) |
565 return E_INVALIDARG; | 565 return E_INVALIDARG; |
566 | 566 |
567 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 567 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
568 if (!target) | 568 if (!target) |
569 return E_INVALIDARG; | 569 return E_INVALIDARG; |
570 | 570 |
571 state->vt = VT_I4; | 571 state->vt = VT_I4; |
572 state->lVal = target->ia_state(); | 572 state->lVal = target->ia_state(); |
573 if (manager()->GetFocus(NULL) == this) | 573 if (manager()->GetFocus() == this) |
574 state->lVal |= STATE_SYSTEM_FOCUSED; | 574 state->lVal |= STATE_SYSTEM_FOCUSED; |
575 | 575 |
576 return S_OK; | 576 return S_OK; |
577 } | 577 } |
578 | 578 |
579 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, | 579 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, |
580 BSTR* value) { | 580 BSTR* value) { |
581 if (!instance_active()) | 581 if (!instance_active()) |
582 return E_FAIL; | 582 return E_FAIL; |
583 | 583 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 static_cast<base::win::IUnknownImpl*>(enum_variant)); | 670 static_cast<base::win::IUnknownImpl*>(enum_variant)); |
671 return S_OK; | 671 return S_OK; |
672 } | 672 } |
673 | 673 |
674 STDMETHODIMP BrowserAccessibilityWin::accSelect( | 674 STDMETHODIMP BrowserAccessibilityWin::accSelect( |
675 LONG flags_sel, VARIANT var_id) { | 675 LONG flags_sel, VARIANT var_id) { |
676 if (!instance_active()) | 676 if (!instance_active()) |
677 return E_FAIL; | 677 return E_FAIL; |
678 | 678 |
679 if (flags_sel & SELFLAG_TAKEFOCUS) { | 679 if (flags_sel & SELFLAG_TAKEFOCUS) { |
680 manager()->SetFocus(this, true); | 680 manager()->SetFocus(*this); |
681 return S_OK; | 681 return S_OK; |
682 } | 682 } |
683 | 683 |
684 return S_FALSE; | 684 return S_FALSE; |
685 } | 685 } |
686 | 686 |
687 STDMETHODIMP | 687 STDMETHODIMP |
688 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) { | 688 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) { |
689 return E_NOTIMPL; | 689 return E_NOTIMPL; |
690 } | 690 } |
(...skipping 3737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4428 ia_role = ROLE_SYSTEM_LIST; | 4428 ia_role = ROLE_SYSTEM_LIST; |
4429 ia_state |= STATE_SYSTEM_READONLY; | 4429 ia_state |= STATE_SYSTEM_READONLY; |
4430 break; | 4430 break; |
4431 case ui::AX_ROLE_LIST_BOX: | 4431 case ui::AX_ROLE_LIST_BOX: |
4432 ia_role = ROLE_SYSTEM_LIST; | 4432 ia_role = ROLE_SYSTEM_LIST; |
4433 break; | 4433 break; |
4434 case ui::AX_ROLE_LIST_BOX_OPTION: | 4434 case ui::AX_ROLE_LIST_BOX_OPTION: |
4435 ia_role = ROLE_SYSTEM_LISTITEM; | 4435 ia_role = ROLE_SYSTEM_LISTITEM; |
4436 if (ia_state & STATE_SYSTEM_SELECTABLE) { | 4436 if (ia_state & STATE_SYSTEM_SELECTABLE) { |
4437 ia_state |= STATE_SYSTEM_FOCUSABLE; | 4437 ia_state |= STATE_SYSTEM_FOCUSABLE; |
4438 if (HasState(ui::AX_STATE_FOCUSED)) | |
4439 ia_state |= STATE_SYSTEM_FOCUSED; | |
4440 } | 4438 } |
4441 break; | 4439 break; |
4442 case ui::AX_ROLE_LIST_ITEM: | 4440 case ui::AX_ROLE_LIST_ITEM: |
4443 ia_role = ROLE_SYSTEM_LISTITEM; | 4441 ia_role = ROLE_SYSTEM_LISTITEM; |
4444 ia_state |= STATE_SYSTEM_READONLY; | 4442 ia_state |= STATE_SYSTEM_READONLY; |
4445 break; | 4443 break; |
4446 case ui::AX_ROLE_MAIN: | 4444 case ui::AX_ROLE_MAIN: |
4447 ia_role = ROLE_SYSTEM_GROUPING; | 4445 ia_role = ROLE_SYSTEM_GROUPING; |
4448 ia2_role = IA2_ROLE_PARAGRAPH; | 4446 ia2_role = IA2_ROLE_PARAGRAPH; |
4449 break; | 4447 break; |
(...skipping 28 matching lines...) Expand all Loading... |
4478 break; | 4476 break; |
4479 case ui::AX_ROLE_MENU_LIST_POPUP: | 4477 case ui::AX_ROLE_MENU_LIST_POPUP: |
4480 ia_role = ROLE_SYSTEM_LIST; | 4478 ia_role = ROLE_SYSTEM_LIST; |
4481 ia2_state &= ~(IA2_STATE_EDITABLE); | 4479 ia2_state &= ~(IA2_STATE_EDITABLE); |
4482 break; | 4480 break; |
4483 case ui::AX_ROLE_MENU_LIST_OPTION: | 4481 case ui::AX_ROLE_MENU_LIST_OPTION: |
4484 ia_role = ROLE_SYSTEM_LISTITEM; | 4482 ia_role = ROLE_SYSTEM_LISTITEM; |
4485 ia2_state &= ~(IA2_STATE_EDITABLE); | 4483 ia2_state &= ~(IA2_STATE_EDITABLE); |
4486 if (ia_state & STATE_SYSTEM_SELECTABLE) { | 4484 if (ia_state & STATE_SYSTEM_SELECTABLE) { |
4487 ia_state |= STATE_SYSTEM_FOCUSABLE; | 4485 ia_state |= STATE_SYSTEM_FOCUSABLE; |
4488 if (HasState(ui::AX_STATE_FOCUSED)) | |
4489 ia_state |= STATE_SYSTEM_FOCUSED; | |
4490 } | 4486 } |
4491 break; | 4487 break; |
4492 case ui::AX_ROLE_METER: | 4488 case ui::AX_ROLE_METER: |
4493 role_name = html_tag; | 4489 role_name = html_tag; |
4494 ia_role = ROLE_SYSTEM_PROGRESSBAR; | 4490 ia_role = ROLE_SYSTEM_PROGRESSBAR; |
4495 break; | 4491 break; |
4496 case ui::AX_ROLE_NAVIGATION: | 4492 case ui::AX_ROLE_NAVIGATION: |
4497 ia_role = ROLE_SYSTEM_GROUPING; | 4493 ia_role = ROLE_SYSTEM_GROUPING; |
4498 ia2_role = IA2_ROLE_SECTION; | 4494 ia2_role = IA2_ROLE_SECTION; |
4499 break; | 4495 break; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4701 ia2_role = ia_role; | 4697 ia2_role = ia_role; |
4702 | 4698 |
4703 win_attributes_->ia_role = ia_role; | 4699 win_attributes_->ia_role = ia_role; |
4704 win_attributes_->ia_state = ia_state; | 4700 win_attributes_->ia_state = ia_state; |
4705 win_attributes_->role_name = role_name; | 4701 win_attributes_->role_name = role_name; |
4706 win_attributes_->ia2_role = ia2_role; | 4702 win_attributes_->ia2_role = ia2_role; |
4707 win_attributes_->ia2_state = ia2_state; | 4703 win_attributes_->ia2_state = ia2_state; |
4708 } | 4704 } |
4709 | 4705 |
4710 } // namespace content | 4706 } // namespace content |
OLD | NEW |