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

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

Issue 1063383005: Chromium side Implementation to expose aria properties - setsize & posinset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updating expectations on android Created 5 years, 8 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 "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( 896 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition(
897 LONG* group_level, 897 LONG* group_level,
898 LONG* similar_items_in_group, 898 LONG* similar_items_in_group,
899 LONG* position_in_group) { 899 LONG* position_in_group) {
900 if (!instance_active()) 900 if (!instance_active())
901 return E_FAIL; 901 return E_FAIL;
902 902
903 if (!group_level || !similar_items_in_group || !position_in_group) 903 if (!group_level || !similar_items_in_group || !position_in_group)
904 return E_INVALIDARG; 904 return E_INVALIDARG;
905 905
906 if (GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && 906 *group_level = 0;
907 GetParent() && 907 *similar_items_in_group = GetIntAttribute(ui::AX_ATTR_SET_SIZE);
908 GetParent()->GetRole() == ui::AX_ROLE_LIST_BOX) { 908 *position_in_group = GetIntAttribute(ui::AX_ATTR_POS_IN_SET);
909 *group_level = 0; 909 return S_OK;
910 *similar_items_in_group = GetParent()->PlatformChildCount();
911 *position_in_group = GetIndexInParent() + 1;
912 return S_OK;
913 }
914
915 return E_NOTIMPL;
916 } 910 }
917 911
918 // 912 //
919 // IAccessibleApplication methods. 913 // IAccessibleApplication methods.
920 // 914 //
921 915
922 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { 916 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) {
923 // No need to check |instance_active()| because this interface is 917 // No need to check |instance_active()| because this interface is
924 // global, and doesn't depend on any local state. 918 // global, and doesn't depend on any local state.
925 919
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 // Expose the "display" and "tag" attributes. 2989 // Expose the "display" and "tag" attributes.
2996 StringAttributeToIA2(ui::AX_ATTR_DISPLAY, "display"); 2990 StringAttributeToIA2(ui::AX_ATTR_DISPLAY, "display");
2997 StringAttributeToIA2(ui::AX_ATTR_DROPEFFECT, "dropeffect"); 2991 StringAttributeToIA2(ui::AX_ATTR_DROPEFFECT, "dropeffect");
2998 StringAttributeToIA2(ui::AX_ATTR_TEXT_INPUT_TYPE, "text-input-type"); 2992 StringAttributeToIA2(ui::AX_ATTR_TEXT_INPUT_TYPE, "text-input-type");
2999 StringAttributeToIA2(ui::AX_ATTR_HTML_TAG, "tag"); 2993 StringAttributeToIA2(ui::AX_ATTR_HTML_TAG, "tag");
3000 StringAttributeToIA2(ui::AX_ATTR_ROLE, "xml-roles"); 2994 StringAttributeToIA2(ui::AX_ATTR_ROLE, "xml-roles");
3001 2995
3002 // Expose "level" attribute for headings, trees, etc. 2996 // Expose "level" attribute for headings, trees, etc.
3003 IntAttributeToIA2(ui::AX_ATTR_HIERARCHICAL_LEVEL, "level"); 2997 IntAttributeToIA2(ui::AX_ATTR_HIERARCHICAL_LEVEL, "level");
3004 2998
3005 // Expose the set size and position in set for listbox options. 2999 // Expose the set size and position in set.
3006 if (GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && 3000 IntAttributeToIA2(ui::AX_ATTR_SET_SIZE, "setsize");
3007 GetParent() && 3001 IntAttributeToIA2(ui::AX_ATTR_POS_IN_SET, "posinset");
3008 GetParent()->GetRole() == ui::AX_ROLE_LIST_BOX) {
3009 win_attributes_->ia2_attributes.push_back(
3010 L"setsize:" + base::IntToString16(GetParent()->PlatformChildCount()));
3011 win_attributes_->ia2_attributes.push_back(
3012 L"setsize:" + base::IntToString16(GetIndexInParent() + 1));
3013 }
3014 3002
3015 if (ia_role() == ROLE_SYSTEM_CHECKBUTTON || 3003 if (ia_role() == ROLE_SYSTEM_CHECKBUTTON ||
3016 ia_role() == ROLE_SYSTEM_RADIOBUTTON || 3004 ia_role() == ROLE_SYSTEM_RADIOBUTTON ||
3017 ia2_role() == IA2_ROLE_CHECK_MENU_ITEM || 3005 ia2_role() == IA2_ROLE_CHECK_MENU_ITEM ||
3018 ia2_role() == IA2_ROLE_RADIO_MENU_ITEM || 3006 ia2_role() == IA2_ROLE_RADIO_MENU_ITEM ||
3019 ia2_role() == IA2_ROLE_TOGGLE_BUTTON) { 3007 ia2_role() == IA2_ROLE_TOGGLE_BUTTON) {
3020 win_attributes_->ia2_attributes.push_back(L"checkable:true"); 3008 win_attributes_->ia2_attributes.push_back(L"checkable:true");
3021 } 3009 }
3022 3010
3023 // Expose live region attributes. 3011 // Expose live region attributes.
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
4141 ia2_role = ia_role; 4129 ia2_role = ia_role;
4142 4130
4143 win_attributes_->ia_role = ia_role; 4131 win_attributes_->ia_role = ia_role;
4144 win_attributes_->ia_state = ia_state; 4132 win_attributes_->ia_state = ia_state;
4145 win_attributes_->role_name = role_name; 4133 win_attributes_->role_name = role_name;
4146 win_attributes_->ia2_role = ia2_role; 4134 win_attributes_->ia2_role = ia2_role;
4147 win_attributes_->ia2_state = ia2_state; 4135 win_attributes_->ia2_state = ia2_state;
4148 } 4136 }
4149 4137
4150 } // namespace content 4138 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698