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 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2643 else | 2643 else |
2644 *node_name = NULL; | 2644 *node_name = NULL; |
2645 | 2645 |
2646 *name_space_id = 0; | 2646 *name_space_id = 0; |
2647 *node_value = SysAllocString(value().c_str()); | 2647 *node_value = SysAllocString(value().c_str()); |
2648 *num_children = PlatformChildCount(); | 2648 *num_children = PlatformChildCount(); |
2649 *unique_id = unique_id_win_; | 2649 *unique_id = unique_id_win_; |
2650 | 2650 |
2651 if (ia_role() == ROLE_SYSTEM_DOCUMENT) { | 2651 if (ia_role() == ROLE_SYSTEM_DOCUMENT) { |
2652 *node_type = NODETYPE_DOCUMENT; | 2652 *node_type = NODETYPE_DOCUMENT; |
2653 } else if (ia_role() == ROLE_SYSTEM_TEXT && | 2653 } else if (ia_role() == ROLE_SYSTEM_TEXT && IsEditableText()) { |
dmazzoni
2015/09/10 18:44:24
I think you got this backwards. The previous logic
| |
2654 ((ia2_state() & IA2_STATE_EDITABLE) == 0)) { | 2654 *node_type = NODETYPE_ELEMENT; |
2655 } else { | |
2655 *node_type = NODETYPE_TEXT; | 2656 *node_type = NODETYPE_TEXT; |
2656 } else { | |
2657 *node_type = NODETYPE_ELEMENT; | |
2658 } | 2657 } |
2659 | 2658 |
2660 return S_OK; | 2659 return S_OK; |
2661 } | 2660 } |
2662 | 2661 |
2663 STDMETHODIMP BrowserAccessibilityWin::get_attributes( | 2662 STDMETHODIMP BrowserAccessibilityWin::get_attributes( |
2664 unsigned short max_attribs, | 2663 unsigned short max_attribs, |
2665 BSTR* attrib_names, | 2664 BSTR* attrib_names, |
2666 short* name_space_id, | 2665 short* name_space_id, |
2667 BSTR* attrib_values, | 2666 BSTR* attrib_values, |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3746 if (focus_object->IsDescendantOf(this)) | 3745 if (focus_object->IsDescendantOf(this)) |
3747 return GetHypertextOffsetFromDescendant(*focus_object); | 3746 return GetHypertextOffsetFromDescendant(*focus_object); |
3748 | 3747 |
3749 return -1; | 3748 return -1; |
3750 } | 3749 } |
3751 | 3750 |
3752 void BrowserAccessibilityWin::GetSelectionOffsets( | 3751 void BrowserAccessibilityWin::GetSelectionOffsets( |
3753 int* selection_start, int* selection_end) const { | 3752 int* selection_start, int* selection_end) const { |
3754 DCHECK(selection_start && selection_end); | 3753 DCHECK(selection_start && selection_end); |
3755 | 3754 |
3756 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && | 3755 if (IsEditableText() && !HasState(ui::AX_STATE_RICHLY_EDITABLE) && |
3756 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && | |
3757 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, selection_end)) { | 3757 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, selection_end)) { |
3758 return; | 3758 return; |
3759 } | 3759 } |
3760 | 3760 |
3761 *selection_start = GetSelectionAnchor(); | 3761 *selection_start = GetSelectionAnchor(); |
3762 *selection_end = GetSelectionFocus(); | 3762 *selection_end = GetSelectionFocus(); |
3763 if (*selection_start < 0 || *selection_end < 0) | 3763 if (*selection_start < 0 || *selection_end < 0) |
3764 return; | 3764 return; |
3765 | 3765 |
3766 if (*selection_end < *selection_start) | 3766 if (*selection_end < *selection_start) |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4005 // Expose whether or not the mouse is over an element, but suppress | 4005 // Expose whether or not the mouse is over an element, but suppress |
4006 // this for tests because it can make the test results flaky depending | 4006 // this for tests because it can make the test results flaky depending |
4007 // on the position of the mouse. | 4007 // on the position of the mouse. |
4008 BrowserAccessibilityStateImpl* accessibility_state = | 4008 BrowserAccessibilityStateImpl* accessibility_state = |
4009 BrowserAccessibilityStateImpl::GetInstance(); | 4009 BrowserAccessibilityStateImpl::GetInstance(); |
4010 if (!accessibility_state->disable_hot_tracking_for_testing()) { | 4010 if (!accessibility_state->disable_hot_tracking_for_testing()) { |
4011 if (HasState(ui::AX_STATE_HOVERED)) | 4011 if (HasState(ui::AX_STATE_HOVERED)) |
4012 ia_state |= STATE_SYSTEM_HOTTRACKED; | 4012 ia_state |= STATE_SYSTEM_HOTTRACKED; |
4013 } | 4013 } |
4014 | 4014 |
4015 // WebKit marks everything as readonly unless it's editable text, so if it's | 4015 if (IsEditableText()) |
4016 // not readonly, mark it as editable now. The final computation of the | |
4017 // READONLY state for MSAA is below, after the switch. | |
4018 if (!HasState(ui::AX_STATE_READ_ONLY)) | |
4019 ia2_state |= IA2_STATE_EDITABLE; | 4016 ia2_state |= IA2_STATE_EDITABLE; |
4020 | 4017 |
4021 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) | 4018 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) |
4022 ia_state |= STATE_SYSTEM_MIXED; | 4019 ia_state |= STATE_SYSTEM_MIXED; |
4023 | 4020 |
4024 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) | 4021 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
4025 ia2_state |= IA2_STATE_EDITABLE; | 4022 ia2_state |= IA2_STATE_EDITABLE; |
4026 | 4023 |
4027 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) | 4024 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) |
4028 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; | 4025 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4420 ia_role = ROLE_SYSTEM_PUSHBUTTON; | 4417 ia_role = ROLE_SYSTEM_PUSHBUTTON; |
4421 ia2_role = IA2_ROLE_TOGGLE_BUTTON; | 4418 ia2_role = IA2_ROLE_TOGGLE_BUTTON; |
4422 break; | 4419 break; |
4423 case ui::AX_ROLE_TEXT_FIELD: | 4420 case ui::AX_ROLE_TEXT_FIELD: |
4424 case ui::AX_ROLE_SEARCH_BOX: | 4421 case ui::AX_ROLE_SEARCH_BOX: |
4425 ia_role = ROLE_SYSTEM_TEXT; | 4422 ia_role = ROLE_SYSTEM_TEXT; |
4426 if (HasState(ui::AX_STATE_MULTILINE)) | 4423 if (HasState(ui::AX_STATE_MULTILINE)) |
4427 ia2_state |= IA2_STATE_MULTI_LINE; | 4424 ia2_state |= IA2_STATE_MULTI_LINE; |
4428 else | 4425 else |
4429 ia2_state |= IA2_STATE_SINGLE_LINE; | 4426 ia2_state |= IA2_STATE_SINGLE_LINE; |
4430 ia2_state |= IA2_STATE_EDITABLE; | |
4431 ia2_state |= IA2_STATE_SELECTABLE_TEXT; | 4427 ia2_state |= IA2_STATE_SELECTABLE_TEXT; |
4432 break; | 4428 break; |
4433 case ui::AX_ROLE_TIME: | 4429 case ui::AX_ROLE_TIME: |
4434 role_name = html_tag; | 4430 role_name = html_tag; |
4435 ia_role = ROLE_SYSTEM_TEXT; | 4431 ia_role = ROLE_SYSTEM_TEXT; |
4436 ia2_role = IA2_ROLE_TEXT_FRAME; | 4432 ia2_role = IA2_ROLE_TEXT_FRAME; |
4437 break; | 4433 break; |
4438 case ui::AX_ROLE_TIMER: | 4434 case ui::AX_ROLE_TIMER: |
4439 ia_role = ROLE_SYSTEM_CLOCK; | 4435 ia_role = ROLE_SYSTEM_CLOCK; |
4440 ia_state |= STATE_SYSTEM_READONLY; | 4436 ia_state |= STATE_SYSTEM_READONLY; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4499 ia2_role = ia_role; | 4495 ia2_role = ia_role; |
4500 | 4496 |
4501 win_attributes_->ia_role = ia_role; | 4497 win_attributes_->ia_role = ia_role; |
4502 win_attributes_->ia_state = ia_state; | 4498 win_attributes_->ia_state = ia_state; |
4503 win_attributes_->role_name = role_name; | 4499 win_attributes_->role_name = role_name; |
4504 win_attributes_->ia2_role = ia2_role; | 4500 win_attributes_->ia2_role = ia2_role; |
4505 win_attributes_->ia2_state = ia2_state; | 4501 win_attributes_->ia2_state = ia2_state; |
4506 } | 4502 } |
4507 | 4503 |
4508 } // namespace content | 4504 } // namespace content |
OLD | NEW |