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

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

Issue 1379803002: Adds class, id and src attributes to object attributes of IA2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Test Results Created 5 years, 2 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 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after
3393 CComObject<BrowserAccessibilityRelation>* relation; 3393 CComObject<BrowserAccessibilityRelation>* relation;
3394 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( 3394 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance(
3395 &relation); 3395 &relation);
3396 DCHECK(SUCCEEDED(hr)); 3396 DCHECK(SUCCEEDED(hr));
3397 relation->AddRef(); 3397 relation->AddRef();
3398 relation->Initialize(this, IA2_RELATION_LABELLED_BY); 3398 relation->Initialize(this, IA2_RELATION_LABELLED_BY);
3399 relation->AddTarget(title_elem_id); 3399 relation->AddTarget(title_elem_id);
3400 relations_.push_back(relation); 3400 relations_.push_back(relation);
3401 } 3401 }
3402 3402
3403 // Expose slider value. 3403 UpdateRequiredAttributes();
3404 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR ||
3405 ia_role() == ROLE_SYSTEM_SCROLLBAR ||
3406 ia_role() == ROLE_SYSTEM_SLIDER) {
3407 win_attributes_->ia2_attributes.push_back(L"valuetext:" + GetValueText());
3408 }
3409
3410 // Expose dropeffect attribute.
3411 base::string16 dropEffect;
3412 if (GetHtmlAttribute("aria-dropeffect", &dropEffect))
3413 win_attributes_->ia2_attributes.push_back(L"dropeffect:" + dropEffect);
3414
3415 // Expose grabbed attribute.
3416 base::string16 grabbed;
3417 if (GetHtmlAttribute("aria-grabbed", &grabbed))
3418 win_attributes_->ia2_attributes.push_back(L"grabbed:" + grabbed);
3419
3420 // Expose datetime attribute.
3421 base::string16 datetime;
3422 if (GetRole() == ui::AX_ROLE_TIME &&
3423 GetHtmlAttribute("datetime", &datetime))
3424 win_attributes_->ia2_attributes.push_back(L"datetime:" + datetime);
3425
3426 // Expose input-text type attribute.
3427 base::string16 type;
3428 if (GetRole() == ui::AX_ROLE_TEXT_FIELD &&
3429 GetHtmlAttribute("type", &type))
3430 win_attributes_->ia2_attributes.push_back(L"text-input-type:" + type);
3431
3432 // If this is a web area for a presentational iframe, give it a role of 3404 // If this is a web area for a presentational iframe, give it a role of
3433 // something other than DOCUMENT so that the fact that it's a separate doc 3405 // something other than DOCUMENT so that the fact that it's a separate doc
3434 // is not exposed to AT. 3406 // is not exposed to AT.
3435 if (IsWebAreaForPresentationalIframe()) { 3407 if (IsWebAreaForPresentationalIframe()) {
3436 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; 3408 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING;
3437 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; 3409 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING;
3438 } 3410 }
3439 } 3411 }
3440 3412
3441 void BrowserAccessibilityWin::UpdateStep2ComputeHypertext() { 3413 void BrowserAccessibilityWin::UpdateStep2ComputeHypertext() {
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
4055 } 4027 }
4056 4028
4057 if (role == ui::AX_ROLE_MENU_LIST_OPTION && 4029 if (role == ui::AX_ROLE_MENU_LIST_OPTION &&
4058 parent_role == ui::AX_ROLE_MENU_LIST_POPUP) { 4030 parent_role == ui::AX_ROLE_MENU_LIST_POPUP) {
4059 return true; 4031 return true;
4060 } 4032 }
4061 4033
4062 return false; 4034 return false;
4063 } 4035 }
4064 4036
4037 void BrowserAccessibilityWin::UpdateRequiredAttributes() {
4038 // Expose slider value.
4039 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR ||
4040 ia_role() == ROLE_SYSTEM_SCROLLBAR ||
4041 ia_role() == ROLE_SYSTEM_SLIDER)
4042 win_attributes_->ia2_attributes.push_back(L"valuetext:" + GetValueText());
4043
4044 // Expose dropeffect attribute.
4045 base::string16 dropEffect;
4046 if (GetHtmlAttribute("aria-dropeffect", &dropEffect))
4047 win_attributes_->ia2_attributes.push_back(L"dropeffect:" + dropEffect);
4048
4049 // Expose grabbed attribute.
4050 base::string16 grabbed;
4051 if (GetHtmlAttribute("aria-grabbed", &grabbed))
4052 win_attributes_->ia2_attributes.push_back(L"grabbed:" + grabbed);
4053
4054 // Expose class attribute.
4055 base::string16 class_attr;
4056 if (GetHtmlAttribute("class", &class_attr))
4057 win_attributes_->ia2_attributes.push_back(L"class:" + class_attr);
4058
4059 // Expose datetime attribute.
4060 base::string16 datetime;
4061 if (GetRole() == ui::AX_ROLE_TIME &&
4062 GetHtmlAttribute("datetime", &datetime))
4063 win_attributes_->ia2_attributes.push_back(L"datetime:" + datetime);
4064
4065 // Expose id attribute.
4066 base::string16 id;
4067 if (GetHtmlAttribute("id", &id))
4068 win_attributes_->ia2_attributes.push_back(L"id:" + id);
4069
4070 // Expose src attribute.
4071 base::string16 src;
4072 if (GetRole() == ui::AX_ROLE_IMAGE &&
4073 GetHtmlAttribute("src", &src))
4074 win_attributes_->ia2_attributes.push_back(L"src:" + src);
4075
4076 // Expose input-text type attribute.
4077 base::string16 type;
4078 if (GetRole() == ui::AX_ROLE_TEXT_FIELD &&
dmazzoni 2015/10/12 22:31:39 Perhaps we should check if the HTML tag is "input"
je_julie(Not used) 2015/10/13 16:54:09 Done.
4079 GetHtmlAttribute("type", &type))
4080 win_attributes_->ia2_attributes.push_back(L"text-input-type:" + type);
4081 }
4082
4065 void BrowserAccessibilityWin::InitRoleAndState() { 4083 void BrowserAccessibilityWin::InitRoleAndState() {
4066 int32 ia_role = 0; 4084 int32 ia_role = 0;
4067 int32 ia_state = 0; 4085 int32 ia_state = 0;
4068 base::string16 role_name; 4086 base::string16 role_name;
4069 int32 ia2_role = 0; 4087 int32 ia2_role = 0;
4070 int32 ia2_state = IA2_STATE_OPAQUE; 4088 int32 ia2_state = IA2_STATE_OPAQUE;
4071 4089
4072 if (HasState(ui::AX_STATE_BUSY)) 4090 if (HasState(ui::AX_STATE_BUSY))
4073 ia_state |= STATE_SYSTEM_BUSY; 4091 ia_state |= STATE_SYSTEM_BUSY;
4074 if (HasState(ui::AX_STATE_CHECKED)) 4092 if (HasState(ui::AX_STATE_CHECKED))
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
4611 ia2_role = ia_role; 4629 ia2_role = ia_role;
4612 4630
4613 win_attributes_->ia_role = ia_role; 4631 win_attributes_->ia_role = ia_role;
4614 win_attributes_->ia_state = ia_state; 4632 win_attributes_->ia_state = ia_state;
4615 win_attributes_->role_name = role_name; 4633 win_attributes_->role_name = role_name;
4616 win_attributes_->ia2_role = ia2_role; 4634 win_attributes_->ia2_role = ia2_role;
4617 win_attributes_->ia2_state = ia2_state; 4635 win_attributes_->ia2_state = ia2_state;
4618 } 4636 }
4619 4637
4620 } // namespace content 4638 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698