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 "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 3155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3166 | 3166 |
3167 InitRoleAndState(); | 3167 InitRoleAndState(); |
3168 | 3168 |
3169 win_attributes_->ia2_attributes.clear(); | 3169 win_attributes_->ia2_attributes.clear(); |
3170 | 3170 |
3171 // Expose autocomplete attribute for combobox and textbox. | 3171 // Expose autocomplete attribute for combobox and textbox. |
3172 StringAttributeToIA2(ui::AX_ATTR_AUTO_COMPLETE, "autocomplete"); | 3172 StringAttributeToIA2(ui::AX_ATTR_AUTO_COMPLETE, "autocomplete"); |
3173 | 3173 |
3174 // Expose the "display" and "tag" attributes. | 3174 // Expose the "display" and "tag" attributes. |
3175 StringAttributeToIA2(ui::AX_ATTR_DISPLAY, "display"); | 3175 StringAttributeToIA2(ui::AX_ATTR_DISPLAY, "display"); |
3176 StringAttributeToIA2(ui::AX_ATTR_DROPEFFECT, "dropeffect"); | |
3177 StringAttributeToIA2(ui::AX_ATTR_TEXT_INPUT_TYPE, "text-input-type"); | |
3178 StringAttributeToIA2(ui::AX_ATTR_HTML_TAG, "tag"); | 3176 StringAttributeToIA2(ui::AX_ATTR_HTML_TAG, "tag"); |
3179 StringAttributeToIA2(ui::AX_ATTR_ROLE, "xml-roles"); | 3177 StringAttributeToIA2(ui::AX_ATTR_ROLE, "xml-roles"); |
3180 | 3178 |
3181 // Expose "level" attribute for headings, trees, etc. | 3179 // Expose "level" attribute for headings, trees, etc. |
3182 IntAttributeToIA2(ui::AX_ATTR_HIERARCHICAL_LEVEL, "level"); | 3180 IntAttributeToIA2(ui::AX_ATTR_HIERARCHICAL_LEVEL, "level"); |
3183 | 3181 |
3184 // Expose the set size and position in set. | 3182 // Expose the set size and position in set. |
3185 IntAttributeToIA2(ui::AX_ATTR_SET_SIZE, "setsize"); | 3183 IntAttributeToIA2(ui::AX_ATTR_SET_SIZE, "setsize"); |
3186 IntAttributeToIA2(ui::AX_ATTR_POS_IN_SET, "posinset"); | 3184 IntAttributeToIA2(ui::AX_ATTR_POS_IN_SET, "posinset"); |
3187 | 3185 |
3188 if (ia_role() == ROLE_SYSTEM_CHECKBUTTON || | 3186 if (ia_role() == ROLE_SYSTEM_CHECKBUTTON || |
3189 ia_role() == ROLE_SYSTEM_RADIOBUTTON || | 3187 ia_role() == ROLE_SYSTEM_RADIOBUTTON || |
3190 ia2_role() == IA2_ROLE_CHECK_MENU_ITEM || | 3188 ia2_role() == IA2_ROLE_CHECK_MENU_ITEM || |
3191 ia2_role() == IA2_ROLE_RADIO_MENU_ITEM || | 3189 ia2_role() == IA2_ROLE_RADIO_MENU_ITEM || |
3192 ia2_role() == IA2_ROLE_TOGGLE_BUTTON) { | 3190 ia2_role() == IA2_ROLE_TOGGLE_BUTTON) { |
3193 win_attributes_->ia2_attributes.push_back(L"checkable:true"); | 3191 win_attributes_->ia2_attributes.push_back(L"checkable:true"); |
3194 } | 3192 } |
3195 | 3193 |
3196 // Expose live region attributes. | 3194 // Expose live region attributes. |
3197 StringAttributeToIA2(ui::AX_ATTR_LIVE_STATUS, "live"); | 3195 StringAttributeToIA2(ui::AX_ATTR_LIVE_STATUS, "live"); |
3198 StringAttributeToIA2(ui::AX_ATTR_LIVE_RELEVANT, "relevant"); | 3196 StringAttributeToIA2(ui::AX_ATTR_LIVE_RELEVANT, "relevant"); |
3199 BoolAttributeToIA2(ui::AX_ATTR_LIVE_ATOMIC, "atomic"); | 3197 BoolAttributeToIA2(ui::AX_ATTR_LIVE_ATOMIC, "atomic"); |
3200 BoolAttributeToIA2(ui::AX_ATTR_LIVE_BUSY, "busy"); | 3198 BoolAttributeToIA2(ui::AX_ATTR_LIVE_BUSY, "busy"); |
3201 | 3199 |
3202 // Expose aria-grabbed attributes. | |
3203 BoolAttributeToIA2(ui::AX_ATTR_GRABBED, "grabbed"); | |
3204 | |
3205 // Expose container live region attributes. | 3200 // Expose container live region attributes. |
3206 StringAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_STATUS, | 3201 StringAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_STATUS, |
3207 "container-live"); | 3202 "container-live"); |
3208 StringAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_RELEVANT, | 3203 StringAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_RELEVANT, |
3209 "container-relevant"); | 3204 "container-relevant"); |
3210 BoolAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_ATOMIC, | 3205 BoolAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_ATOMIC, |
3211 "container-atomic"); | 3206 "container-atomic"); |
3212 BoolAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_BUSY, | 3207 BoolAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_BUSY, |
3213 "container-busy"); | 3208 "container-busy"); |
3214 | 3209 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3400 relations_.push_back(relation); | 3395 relations_.push_back(relation); |
3401 } | 3396 } |
3402 | 3397 |
3403 // Expose slider value. | 3398 // Expose slider value. |
3404 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR || | 3399 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR || |
3405 ia_role() == ROLE_SYSTEM_SCROLLBAR || | 3400 ia_role() == ROLE_SYSTEM_SCROLLBAR || |
3406 ia_role() == ROLE_SYSTEM_SLIDER) { | 3401 ia_role() == ROLE_SYSTEM_SLIDER) { |
3407 win_attributes_->ia2_attributes.push_back(L"valuetext:" + GetValueText()); | 3402 win_attributes_->ia2_attributes.push_back(L"valuetext:" + GetValueText()); |
3408 } | 3403 } |
3409 | 3404 |
3405 // Expose dropeffect attribute. | |
dmazzoni
2015/06/09 16:23:32
What do you think of just iterating over all HTML
je_julie(Not used)
2015/06/10 02:16:31
When I looking into the inspection result from Acc
| |
3406 base::string16 dropEffect; | |
3407 if (GetHtmlAttribute("aria-dropeffect", &dropEffect)) | |
3408 win_attributes_->ia2_attributes.push_back(L"dropeffect:" + dropEffect); | |
3409 | |
3410 // Expose grabbed attribute. | |
3411 base::string16 grabbed; | |
3412 if (GetHtmlAttribute("aria-grabbed", &grabbed)) | |
3413 win_attributes_->ia2_attributes.push_back(L"grabbed:" + grabbed); | |
3414 | |
3415 // Expose datetime attribute. | |
3416 base::string16 datetime; | |
3417 if (GetRole() == ui::AX_ROLE_TIME && | |
3418 GetHtmlAttribute("datetime", &datetime)) | |
3419 win_attributes_->ia2_attributes.push_back(L"datetime:" + datetime); | |
3420 | |
3421 // Expose input-text type attribute. | |
3422 base::string16 type; | |
3423 if (GetRole() == ui::AX_ROLE_TEXT_FIELD && | |
3424 GetHtmlAttribute("type", &type)) | |
3425 win_attributes_->ia2_attributes.push_back(L"text-input-type:" + type); | |
3426 | |
3410 // If this is a web area for a presentational iframe, give it a role of | 3427 // If this is a web area for a presentational iframe, give it a role of |
3411 // something other than DOCUMENT so that the fact that it's a separate doc | 3428 // something other than DOCUMENT so that the fact that it's a separate doc |
3412 // is not exposed to AT. | 3429 // is not exposed to AT. |
3413 if (IsWebAreaForPresentationalIframe()) { | 3430 if (IsWebAreaForPresentationalIframe()) { |
3414 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; | 3431 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; |
3415 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; | 3432 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; |
3416 } | 3433 } |
3417 } | 3434 } |
3418 | 3435 |
3419 void BrowserAccessibilityWin::UpdateStep2ComputeHypertext() { | 3436 void BrowserAccessibilityWin::UpdateStep2ComputeHypertext() { |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4278 case ui::AX_ROLE_SEARCH_BOX: | 4295 case ui::AX_ROLE_SEARCH_BOX: |
4279 ia_role = ROLE_SYSTEM_TEXT; | 4296 ia_role = ROLE_SYSTEM_TEXT; |
4280 if (HasState(ui::AX_STATE_MULTILINE)) | 4297 if (HasState(ui::AX_STATE_MULTILINE)) |
4281 ia2_state |= IA2_STATE_MULTI_LINE; | 4298 ia2_state |= IA2_STATE_MULTI_LINE; |
4282 else | 4299 else |
4283 ia2_state |= IA2_STATE_SINGLE_LINE; | 4300 ia2_state |= IA2_STATE_SINGLE_LINE; |
4284 ia2_state |= IA2_STATE_EDITABLE; | 4301 ia2_state |= IA2_STATE_EDITABLE; |
4285 ia2_state |= IA2_STATE_SELECTABLE_TEXT; | 4302 ia2_state |= IA2_STATE_SELECTABLE_TEXT; |
4286 break; | 4303 break; |
4287 case ui::AX_ROLE_TIME: | 4304 case ui::AX_ROLE_TIME: |
4305 role_name = html_tag; | |
4288 ia_role = ROLE_SYSTEM_TEXT; | 4306 ia_role = ROLE_SYSTEM_TEXT; |
4289 ia2_role = IA2_ROLE_TEXT_FRAME; | 4307 ia2_role = IA2_ROLE_TEXT_FRAME; |
4290 break; | 4308 break; |
4291 case ui::AX_ROLE_TIMER: | 4309 case ui::AX_ROLE_TIMER: |
4292 ia_role = ROLE_SYSTEM_CLOCK; | 4310 ia_role = ROLE_SYSTEM_CLOCK; |
4293 ia_state |= STATE_SYSTEM_READONLY; | 4311 ia_state |= STATE_SYSTEM_READONLY; |
4294 break; | 4312 break; |
4295 case ui::AX_ROLE_TOOLBAR: | 4313 case ui::AX_ROLE_TOOLBAR: |
4296 ia_role = ROLE_SYSTEM_TOOLBAR; | 4314 ia_role = ROLE_SYSTEM_TOOLBAR; |
4297 ia_state |= STATE_SYSTEM_READONLY; | 4315 ia_state |= STATE_SYSTEM_READONLY; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4352 ia2_role = ia_role; | 4370 ia2_role = ia_role; |
4353 | 4371 |
4354 win_attributes_->ia_role = ia_role; | 4372 win_attributes_->ia_role = ia_role; |
4355 win_attributes_->ia_state = ia_state; | 4373 win_attributes_->ia_state = ia_state; |
4356 win_attributes_->role_name = role_name; | 4374 win_attributes_->role_name = role_name; |
4357 win_attributes_->ia2_role = ia2_role; | 4375 win_attributes_->ia2_role = ia2_role; |
4358 win_attributes_->ia2_state = ia2_state; | 4376 win_attributes_->ia2_state = ia2_state; |
4359 } | 4377 } |
4360 | 4378 |
4361 } // namespace content | 4379 } // namespace content |
OLD | NEW |