Chromium Code Reviews| 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 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3746 if (focus_object->IsDescendantOf(this)) | 3746 if (focus_object->IsDescendantOf(this)) |
| 3747 return GetHypertextOffsetFromDescendant(*focus_object); | 3747 return GetHypertextOffsetFromDescendant(*focus_object); |
| 3748 | 3748 |
| 3749 return -1; | 3749 return -1; |
| 3750 } | 3750 } |
| 3751 | 3751 |
| 3752 void BrowserAccessibilityWin::GetSelectionOffsets( | 3752 void BrowserAccessibilityWin::GetSelectionOffsets( |
| 3753 int* selection_start, int* selection_end) const { | 3753 int* selection_start, int* selection_end) const { |
| 3754 DCHECK(selection_start && selection_end); | 3754 DCHECK(selection_start && selection_end); |
| 3755 | 3755 |
| 3756 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && | 3756 if (HasState(ui::AX_STATE_EDITABLE) && |
|
dmazzoni
2015/09/08 21:18:44
We already have IsEditableText - could you modify
| |
| 3757 !HasState(ui::AX_STATE_RICHLY_EDITABLE) && | |
| 3758 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && | |
| 3757 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, selection_end)) { | 3759 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, selection_end)) { |
| 3758 return; | 3760 return; |
| 3759 } | 3761 } |
| 3760 | 3762 |
| 3761 *selection_start = GetSelectionAnchor(); | 3763 *selection_start = GetSelectionAnchor(); |
| 3762 *selection_end = GetSelectionFocus(); | 3764 *selection_end = GetSelectionFocus(); |
| 3763 if (*selection_start < 0 || *selection_end < 0) | 3765 if (*selection_start < 0 || *selection_end < 0) |
| 3764 return; | 3766 return; |
| 3765 | 3767 |
| 3766 if (*selection_end < *selection_start) | 3768 if (*selection_end < *selection_start) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4009 BrowserAccessibilityStateImpl::GetInstance(); | 4011 BrowserAccessibilityStateImpl::GetInstance(); |
| 4010 if (!accessibility_state->disable_hot_tracking_for_testing()) { | 4012 if (!accessibility_state->disable_hot_tracking_for_testing()) { |
| 4011 if (HasState(ui::AX_STATE_HOVERED)) | 4013 if (HasState(ui::AX_STATE_HOVERED)) |
| 4012 ia_state |= STATE_SYSTEM_HOTTRACKED; | 4014 ia_state |= STATE_SYSTEM_HOTTRACKED; |
| 4013 } | 4015 } |
| 4014 | 4016 |
| 4015 // WebKit marks everything as readonly unless it's editable text, so if it's | 4017 // WebKit marks everything as readonly unless it's editable text, so if it's |
| 4016 // not readonly, mark it as editable now. The final computation of the | 4018 // not readonly, mark it as editable now. The final computation of the |
| 4017 // READONLY state for MSAA is below, after the switch. | 4019 // READONLY state for MSAA is below, after the switch. |
| 4018 if (!HasState(ui::AX_STATE_READ_ONLY)) | 4020 if (!HasState(ui::AX_STATE_READ_ONLY)) |
| 4019 ia2_state |= IA2_STATE_EDITABLE; | 4021 ia2_state |= IA2_STATE_EDITABLE; |
|
dmazzoni
2015/09/08 21:18:44
Can you fix this line too?
| |
| 4020 | 4022 |
| 4021 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) | 4023 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) |
| 4022 ia_state |= STATE_SYSTEM_MIXED; | 4024 ia_state |= STATE_SYSTEM_MIXED; |
| 4023 | 4025 |
| 4024 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) | 4026 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
| 4025 ia2_state |= IA2_STATE_EDITABLE; | 4027 ia2_state |= IA2_STATE_EDITABLE; |
|
dmazzoni
2015/09/08 21:18:44
This line is probably wrong now, hopefully we can
| |
| 4026 | 4028 |
| 4027 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) | 4029 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) |
| 4028 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; | 4030 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; |
| 4029 | 4031 |
| 4030 base::string16 html_tag = GetString16Attribute( | 4032 base::string16 html_tag = GetString16Attribute( |
| 4031 ui::AX_ATTR_HTML_TAG); | 4033 ui::AX_ATTR_HTML_TAG); |
| 4032 switch (GetRole()) { | 4034 switch (GetRole()) { |
| 4033 case ui::AX_ROLE_ALERT: | 4035 case ui::AX_ROLE_ALERT: |
| 4034 ia_role = ROLE_SYSTEM_ALERT; | 4036 ia_role = ROLE_SYSTEM_ALERT; |
| 4035 break; | 4037 break; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4420 ia_role = ROLE_SYSTEM_PUSHBUTTON; | 4422 ia_role = ROLE_SYSTEM_PUSHBUTTON; |
| 4421 ia2_role = IA2_ROLE_TOGGLE_BUTTON; | 4423 ia2_role = IA2_ROLE_TOGGLE_BUTTON; |
| 4422 break; | 4424 break; |
| 4423 case ui::AX_ROLE_TEXT_FIELD: | 4425 case ui::AX_ROLE_TEXT_FIELD: |
| 4424 case ui::AX_ROLE_SEARCH_BOX: | 4426 case ui::AX_ROLE_SEARCH_BOX: |
| 4425 ia_role = ROLE_SYSTEM_TEXT; | 4427 ia_role = ROLE_SYSTEM_TEXT; |
| 4426 if (HasState(ui::AX_STATE_MULTILINE)) | 4428 if (HasState(ui::AX_STATE_MULTILINE)) |
| 4427 ia2_state |= IA2_STATE_MULTI_LINE; | 4429 ia2_state |= IA2_STATE_MULTI_LINE; |
| 4428 else | 4430 else |
| 4429 ia2_state |= IA2_STATE_SINGLE_LINE; | 4431 ia2_state |= IA2_STATE_SINGLE_LINE; |
| 4430 ia2_state |= IA2_STATE_EDITABLE; | 4432 ia2_state |= IA2_STATE_EDITABLE; |
|
dmazzoni
2015/09/08 21:18:44
This should hopefully no longer be needed now - an
| |
| 4431 ia2_state |= IA2_STATE_SELECTABLE_TEXT; | 4433 ia2_state |= IA2_STATE_SELECTABLE_TEXT; |
| 4432 break; | 4434 break; |
| 4433 case ui::AX_ROLE_TIME: | 4435 case ui::AX_ROLE_TIME: |
| 4434 role_name = html_tag; | 4436 role_name = html_tag; |
| 4435 ia_role = ROLE_SYSTEM_TEXT; | 4437 ia_role = ROLE_SYSTEM_TEXT; |
| 4436 ia2_role = IA2_ROLE_TEXT_FRAME; | 4438 ia2_role = IA2_ROLE_TEXT_FRAME; |
| 4437 break; | 4439 break; |
| 4438 case ui::AX_ROLE_TIMER: | 4440 case ui::AX_ROLE_TIMER: |
| 4439 ia_role = ROLE_SYSTEM_CLOCK; | 4441 ia_role = ROLE_SYSTEM_CLOCK; |
| 4440 ia_state |= STATE_SYSTEM_READONLY; | 4442 ia_state |= STATE_SYSTEM_READONLY; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4499 ia2_role = ia_role; | 4501 ia2_role = ia_role; |
| 4500 | 4502 |
| 4501 win_attributes_->ia_role = ia_role; | 4503 win_attributes_->ia_role = ia_role; |
| 4502 win_attributes_->ia_state = ia_state; | 4504 win_attributes_->ia_state = ia_state; |
| 4503 win_attributes_->role_name = role_name; | 4505 win_attributes_->role_name = role_name; |
| 4504 win_attributes_->ia2_role = ia2_role; | 4506 win_attributes_->ia2_role = ia2_role; |
| 4505 win_attributes_->ia2_state = ia2_state; | 4507 win_attributes_->ia2_state = ia2_state; |
| 4506 } | 4508 } |
| 4507 | 4509 |
| 4508 } // namespace content | 4510 } // namespace content |
| OLD | NEW |