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 5420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5431 case ui::AX_ROLE_TAB_PANEL: | 5431 case ui::AX_ROLE_TAB_PANEL: |
| 5432 ia_role = ROLE_SYSTEM_PROPERTYPAGE; | 5432 ia_role = ROLE_SYSTEM_PROPERTYPAGE; |
| 5433 break; | 5433 break; |
| 5434 case ui::AX_ROLE_TOGGLE_BUTTON: | 5434 case ui::AX_ROLE_TOGGLE_BUTTON: |
| 5435 ia_role = ROLE_SYSTEM_PUSHBUTTON; | 5435 ia_role = ROLE_SYSTEM_PUSHBUTTON; |
| 5436 ia2_role = IA2_ROLE_TOGGLE_BUTTON; | 5436 ia2_role = IA2_ROLE_TOGGLE_BUTTON; |
| 5437 break; | 5437 break; |
| 5438 case ui::AX_ROLE_TEXT_FIELD: | 5438 case ui::AX_ROLE_TEXT_FIELD: |
| 5439 case ui::AX_ROLE_SEARCH_BOX: | 5439 case ui::AX_ROLE_SEARCH_BOX: |
| 5440 ia_role = ROLE_SYSTEM_TEXT; | 5440 ia_role = ROLE_SYSTEM_TEXT; |
| 5441 if (HasState(ui::AX_STATE_MULTILINE)) | 5441 if (HasState(ui::AX_STATE_MULTILINE)) { |
| 5442 ia2_state |= IA2_STATE_MULTI_LINE; | 5442 ia2_state |= IA2_STATE_MULTI_LINE; |
| 5443 else | 5443 } else { |
| 5444 ia2_state |= IA2_STATE_SINGLE_LINE; | 5444 ia2_state |= IA2_STATE_SINGLE_LINE; |
| 5445 } | |
| 5446 if (HasState(ui::AX_STATE_READ_ONLY)) | |
| 5447 ia_state |= STATE_SYSTEM_READONLY; | |
| 5445 ia2_state |= IA2_STATE_SELECTABLE_TEXT; | 5448 ia2_state |= IA2_STATE_SELECTABLE_TEXT; |
| 5446 break; | 5449 break; |
| 5447 case ui::AX_ROLE_ABBR: | 5450 case ui::AX_ROLE_ABBR: |
| 5448 case ui::AX_ROLE_TIME: | 5451 case ui::AX_ROLE_TIME: |
| 5449 role_name = html_tag; | 5452 role_name = html_tag; |
| 5450 ia_role = ROLE_SYSTEM_TEXT; | 5453 ia_role = ROLE_SYSTEM_TEXT; |
| 5451 ia2_role = IA2_ROLE_TEXT_FRAME; | 5454 ia2_role = IA2_ROLE_TEXT_FRAME; |
| 5452 break; | 5455 break; |
| 5453 case ui::AX_ROLE_TIMER: | 5456 case ui::AX_ROLE_TIMER: |
| 5454 ia_role = ROLE_SYSTEM_CLOCK; | 5457 ia_role = ROLE_SYSTEM_CLOCK; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5489 case ui::AX_ROLE_PRESENTATIONAL: | 5492 case ui::AX_ROLE_PRESENTATIONAL: |
| 5490 case ui::AX_ROLE_SLIDER_THUMB: | 5493 case ui::AX_ROLE_SLIDER_THUMB: |
| 5491 default: | 5494 default: |
| 5492 ia_role = ROLE_SYSTEM_CLIENT; | 5495 ia_role = ROLE_SYSTEM_CLIENT; |
| 5493 break; | 5496 break; |
| 5494 } | 5497 } |
| 5495 | 5498 |
| 5496 // Compute the final value of READONLY for MSAA. | 5499 // Compute the final value of READONLY for MSAA. |
| 5497 // | 5500 // |
| 5498 // We always set the READONLY state for elements that have the | 5501 // We always set the READONLY state for elements that have the |
| 5499 // aria-readonly attribute and for a few roles (in the switch above). | 5502 // aria-readonly attribute and for a few roles (in the switch above), such as |
| 5503 // read-only text fields. | |
| 5500 // We clear the READONLY state on focusable controls and on a document. | 5504 // We clear the READONLY state on focusable controls and on a document. |
| 5501 // Everything else, the majority of objects, do not have this state set. | 5505 // Everything else, the majority of objects, do not have this state set. |
| 5502 if (HasState(ui::AX_STATE_FOCUSABLE) && | 5506 if (HasState(ui::AX_STATE_FOCUSABLE) && |
| 5503 ia_role != ROLE_SYSTEM_DOCUMENT) { | 5507 ia_role != ROLE_SYSTEM_DOCUMENT) { |
| 5504 ia_state &= ~(STATE_SYSTEM_READONLY); | 5508 ia_state &= ~(STATE_SYSTEM_READONLY); |
|
dmazzoni
2016/10/11 17:45:41
Won't this clear the readonly state for text field
| |
| 5505 } | 5509 } |
| 5506 if (!HasState(ui::AX_STATE_READ_ONLY)) | 5510 if (!HasState(ui::AX_STATE_READ_ONLY)) |
| 5507 ia_state &= ~(STATE_SYSTEM_READONLY); | 5511 ia_state &= ~(STATE_SYSTEM_READONLY); |
| 5508 if (GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) | 5512 if (GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) |
| 5509 ia_state |= STATE_SYSTEM_READONLY; | 5513 ia_state |= STATE_SYSTEM_READONLY; |
| 5510 | 5514 |
| 5511 // The role should always be set. | 5515 // The role should always be set. |
| 5512 DCHECK(!role_name.empty() || ia_role); | 5516 DCHECK(!role_name.empty() || ia_role); |
| 5513 | 5517 |
| 5514 // If we didn't explicitly set the IAccessible2 role, make it the same | 5518 // If we didn't explicitly set the IAccessible2 role, make it the same |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 5528 return static_cast<BrowserAccessibilityWin*>(obj); | 5532 return static_cast<BrowserAccessibilityWin*>(obj); |
| 5529 } | 5533 } |
| 5530 | 5534 |
| 5531 const BrowserAccessibilityWin* | 5535 const BrowserAccessibilityWin* |
| 5532 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5536 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
| 5533 DCHECK(!obj || obj->IsNative()); | 5537 DCHECK(!obj || obj->IsNative()); |
| 5534 return static_cast<const BrowserAccessibilityWin*>(obj); | 5538 return static_cast<const BrowserAccessibilityWin*>(obj); |
| 5535 } | 5539 } |
| 5536 | 5540 |
| 5537 } // namespace content | 5541 } // namespace content |
| OLD | NEW |