Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 2587343004: Finish implementation and tests of 5 ARIA 1.1 attributes. (Closed)
Patch Set: Rebase on previous change Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 UMA_API_UNSELECT_ROW = 157, 196 UMA_API_UNSELECT_ROW = 157,
197 197
198 // This must always be the last enum. It's okay for its value to 198 // This must always be the last enum. It's okay for its value to
199 // increase, but none of the other enum values may change. 199 // increase, but none of the other enum values may change.
200 UMA_API_MAX 200 UMA_API_MAX
201 }; 201 };
202 202
203 #define WIN_ACCESSIBILITY_API_HISTOGRAM(enum_value) \ 203 #define WIN_ACCESSIBILITY_API_HISTOGRAM(enum_value) \
204 UMA_HISTOGRAM_ENUMERATION("Accessibility.WinAPIs", enum_value, UMA_API_MAX) 204 UMA_HISTOGRAM_ENUMERATION("Accessibility.WinAPIs", enum_value, UMA_API_MAX)
205 205
206 const WCHAR *const IA2_DETAILS = L"details";
207 const WCHAR *const IA2_DETAILS_FOR = L"detailsFor";
208 const WCHAR *const IA2_ERROR_MESSAGE = L"errorMessage";
209
206 } // namespace 210 } // namespace
207 211
208 namespace content { 212 namespace content {
209 213
210 // These nonstandard GUIDs are taken directly from the Mozilla sources 214 // These nonstandard GUIDs are taken directly from the Mozilla sources
211 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: 215 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here:
212 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/ MSAA 216 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/ MSAA
213 const GUID GUID_ISimpleDOM = {0x0c539790, 217 const GUID GUID_ISimpleDOM = {0x0c539790,
214 0x12e4, 218 0x12e4,
215 0x11cf, 219 0x11cf,
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 if (!instance_active()) 647 if (!instance_active())
644 return E_FAIL; 648 return E_FAIL;
645 649
646 if (!acc_key) 650 if (!acc_key)
647 return E_INVALIDARG; 651 return E_INVALIDARG;
648 652
649 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); 653 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id);
650 if (!target) 654 if (!target)
651 return E_INVALIDARG; 655 return E_INVALIDARG;
652 656
657 if (target->HasStringAttribute(ui::AX_ATTR_KEY_SHORTCUTS)) {
658 return target->GetStringAttributeAsBstr(
659 ui::AX_ATTR_KEY_SHORTCUTS, acc_key);
660 }
661
653 return target->GetStringAttributeAsBstr( 662 return target->GetStringAttributeAsBstr(
654 ui::AX_ATTR_SHORTCUT, acc_key); 663 ui::AX_ATTR_SHORTCUT, acc_key);
655 } 664 }
656 665
657 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { 666 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) {
658 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_NAME); 667 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_NAME);
659 if (!instance_active()) 668 if (!instance_active())
660 return E_FAIL; 669 return E_FAIL;
661 670
662 if (!name) 671 if (!name)
(...skipping 3228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3891 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, 3900 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR,
3892 IA2_RELATION_CONTROLLED_BY, 3901 IA2_RELATION_CONTROLLED_BY,
3893 ui::AX_ATTR_CONTROLS_IDS); 3902 ui::AX_ATTR_CONTROLS_IDS);
3894 AddBidirectionalRelations(IA2_RELATION_DESCRIBED_BY, 3903 AddBidirectionalRelations(IA2_RELATION_DESCRIBED_BY,
3895 IA2_RELATION_DESCRIPTION_FOR, 3904 IA2_RELATION_DESCRIPTION_FOR,
3896 ui::AX_ATTR_DESCRIBEDBY_IDS); 3905 ui::AX_ATTR_DESCRIBEDBY_IDS);
3897 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM, 3906 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM,
3898 ui::AX_ATTR_FLOWTO_IDS); 3907 ui::AX_ATTR_FLOWTO_IDS);
3899 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR, 3908 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR,
3900 ui::AX_ATTR_LABELLEDBY_IDS); 3909 ui::AX_ATTR_LABELLEDBY_IDS);
3910 AddBidirectionalRelations(IA2_RELATION_DETAILS, IA2_RELATION_DETAILS_FOR,
3911 ui::AX_ATTR_DETAILS_IDS);
3901 3912
3902 int member_of_id; 3913 int member_of_id;
3903 if (GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id)) 3914 if (GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id))
3904 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id); 3915 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id);
3905 3916
3917 int error_message_id;
3918 if (GetIntAttribute(ui::AX_ATTR_ERROR_MESSAGE, &error_message_id))
3919 AddRelation(IA2_RELATION_ERROR_MESSAGE, &error_message_id);
3920
3906 UpdateRequiredAttributes(); 3921 UpdateRequiredAttributes();
3907 // If this is a web area for a presentational iframe, give it a role of 3922 // If this is a web area for a presentational iframe, give it a role of
3908 // something other than DOCUMENT so that the fact that it's a separate doc 3923 // something other than DOCUMENT so that the fact that it's a separate doc
3909 // is not exposed to AT. 3924 // is not exposed to AT.
3910 if (IsWebAreaForPresentationalIframe()) { 3925 if (IsWebAreaForPresentationalIframe()) {
3911 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; 3926 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING;
3912 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; 3927 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING;
3913 } 3928 }
3914 } 3929 }
3915 3930
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
5056 5071
5057 if (GetBoolAttribute(ui::AX_ATTR_STATE_MIXED)) 5072 if (GetBoolAttribute(ui::AX_ATTR_STATE_MIXED))
5058 ia_state |= STATE_SYSTEM_MIXED; 5073 ia_state |= STATE_SYSTEM_MIXED;
5059 5074
5060 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) 5075 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE))
5061 ia2_state |= IA2_STATE_EDITABLE; 5076 ia2_state |= IA2_STATE_EDITABLE;
5062 5077
5063 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) 5078 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty())
5064 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; 5079 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION;
5065 5080
5081 if (HasIntAttribute(ui::AX_ATTR_MODAL))
5082 ia2_state |= IA2_STATE_MODAL;
5083
5066 base::string16 html_tag = GetString16Attribute( 5084 base::string16 html_tag = GetString16Attribute(
5067 ui::AX_ATTR_HTML_TAG); 5085 ui::AX_ATTR_HTML_TAG);
5068 switch (GetRole()) { 5086 switch (GetRole()) {
5069 case ui::AX_ROLE_ALERT: 5087 case ui::AX_ROLE_ALERT:
5070 ia_role = ROLE_SYSTEM_ALERT; 5088 ia_role = ROLE_SYSTEM_ALERT;
5071 break; 5089 break;
5072 case ui::AX_ROLE_ALERT_DIALOG: 5090 case ui::AX_ROLE_ALERT_DIALOG:
5073 ia_role = ROLE_SYSTEM_DIALOG; 5091 ia_role = ROLE_SYSTEM_DIALOG;
5074 break; 5092 break;
5075 case ui::AX_ROLE_APPLICATION: 5093 case ui::AX_ROLE_APPLICATION:
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
5558 return static_cast<BrowserAccessibilityWin*>(obj); 5576 return static_cast<BrowserAccessibilityWin*>(obj);
5559 } 5577 }
5560 5578
5561 const BrowserAccessibilityWin* 5579 const BrowserAccessibilityWin*
5562 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { 5580 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) {
5563 DCHECK(!obj || obj->IsNative()); 5581 DCHECK(!obj || obj->IsNative());
5564 return static_cast<const BrowserAccessibilityWin*>(obj); 5582 return static_cast<const BrowserAccessibilityWin*>(obj);
5565 } 5583 }
5566 5584
5567 } // namespace content 5585 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698