Index: content/browser/accessibility/browser_accessibility_win.cc |
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc |
index de90bfd689e7ed145e79e48a010bb7b54d7b284b..59c33362adb10b24cadae303131737d4f235908a 100644 |
--- a/content/browser/accessibility/browser_accessibility_win.cc |
+++ b/content/browser/accessibility/browser_accessibility_win.cc |
@@ -175,6 +175,17 @@ STDMETHODIMP BrowserAccessibilityRelation::get_targets(long max_targets, |
} |
// |
+// BrowserAccessibilityWin::WinAttributes |
+// |
+ |
+BrowserAccessibilityWin::WinAttributes::WinAttributes() |
+ : ia_role(0), |
+ ia_state(0), |
+ ia2_role(0), |
+ ia2_state(0) { |
+} |
+ |
+// |
// BrowserAccessibilityWin |
// |
@@ -192,12 +203,7 @@ BrowserAccessibilityWin* BrowserAccessibility::ToBrowserAccessibilityWin() { |
} |
BrowserAccessibilityWin::BrowserAccessibilityWin() |
- : ia_role_(0), |
- ia_state_(0), |
- ia2_role_(0), |
- ia2_state_(0), |
- first_time_(true), |
- old_ia_state_(0), |
+ : win_attributes_(new WinAttributes()), |
previous_scroll_x_(0), |
previous_scroll_y_(0) { |
// Start unique IDs at -1 and decrement each time, because get_accChild |
@@ -397,8 +403,14 @@ STDMETHODIMP BrowserAccessibilityWin::get_accDescription(VARIANT var_id, |
if (!target) |
return E_INVALIDARG; |
- return target->GetStringAttributeAsBstr( |
- ui::AX_ATTR_DESCRIPTION, desc); |
+ base::string16 description_str = target->description(); |
+ if (description_str.empty()) |
+ return S_FALSE; |
+ |
+ *desc = SysAllocString(description_str.c_str()); |
+ |
+ DCHECK(*desc); |
+ return S_OK; |
} |
STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { |
@@ -434,8 +446,14 @@ STDMETHODIMP BrowserAccessibilityWin::get_accHelp(VARIANT var_id, BSTR* help) { |
if (!target) |
return E_INVALIDARG; |
- return target->GetStringAttributeAsBstr( |
- ui::AX_ATTR_HELP, help); |
+ base::string16 help_str = target->help(); |
+ if (help_str.empty()) |
+ return S_FALSE; |
+ |
+ *help = SysAllocString(help_str.c_str()); |
+ |
+ DCHECK(*help); |
+ return S_OK; |
} |
STDMETHODIMP BrowserAccessibilityWin::get_accKeyboardShortcut(VARIANT var_id, |
@@ -465,24 +483,24 @@ STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { |
if (!target) |
return E_INVALIDARG; |
- std::string name_str = target->name(); |
+ base::string16 name_str = target->name(); |
// If the name is empty, see if it's labeled by another element. |
if (name_str.empty()) { |
int title_elem_id; |
if (target->GetIntAttribute(ui::AX_ATTR_TITLE_UI_ELEMENT, |
&title_elem_id)) { |
- BrowserAccessibility* title_elem = |
- manager()->GetFromID(title_elem_id); |
+ BrowserAccessibilityWin* title_elem = |
+ manager()->GetFromID(title_elem_id)->ToBrowserAccessibilityWin(); |
if (title_elem) |
- name_str = title_elem->GetTextRecursive(); |
+ name_str = title_elem->GetNameRecursive(); |
} |
} |
if (name_str.empty()) |
return S_FALSE; |
- *name = SysAllocString(base::UTF8ToUTF16(name_str).c_str()); |
+ *name = SysAllocString(name_str.c_str()); |
DCHECK(*name); |
return S_OK; |
@@ -530,12 +548,12 @@ STDMETHODIMP BrowserAccessibilityWin::get_accRole(VARIANT var_id, |
if (!target) |
return E_INVALIDARG; |
- if (!target->role_name_.empty()) { |
+ if (!target->role_name().empty()) { |
role->vt = VT_BSTR; |
- role->bstrVal = SysAllocString(target->role_name_.c_str()); |
+ role->bstrVal = SysAllocString(target->role_name().c_str()); |
} else { |
role->vt = VT_I4; |
- role->lVal = target->ia_role_; |
+ role->lVal = target->ia_role(); |
} |
return S_OK; |
} |
@@ -553,7 +571,7 @@ STDMETHODIMP BrowserAccessibilityWin::get_accState(VARIANT var_id, |
return E_INVALIDARG; |
state->vt = VT_I4; |
- state->lVal = target->ia_state_; |
+ state->lVal = target->ia_state(); |
if (manager()->GetFocus(NULL) == this) |
state->lVal |= STATE_SYSTEM_FOCUSED; |
@@ -598,7 +616,7 @@ STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, |
return S_OK; |
} |
- *value = SysAllocString(base::UTF8ToUTF16(target->value()).c_str()); |
+ *value = SysAllocString(target->value().c_str()); |
DCHECK(*value); |
return S_OK; |
} |
@@ -681,7 +699,7 @@ STDMETHODIMP BrowserAccessibilityWin::role(LONG* role) { |
if (!role) |
return E_INVALIDARG; |
- *role = ia2_role_; |
+ *role = ia2_role(); |
return S_OK; |
} |
@@ -716,7 +734,7 @@ STDMETHODIMP BrowserAccessibilityWin::get_states(AccessibleStates* states) { |
if (!states) |
return E_INVALIDARG; |
- *states = ia2_state_; |
+ *states = ia2_state(); |
return S_OK; |
} |
@@ -980,8 +998,13 @@ STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { |
if (!desc) |
return E_INVALIDARG; |
- return GetStringAttributeAsBstr( |
- ui::AX_ATTR_DESCRIPTION, desc); |
+ if (description().empty()) |
+ return S_FALSE; |
+ |
+ *desc = SysAllocString(description().c_str()); |
+ |
+ DCHECK(*desc); |
+ return S_OK; |
} |
STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( |
@@ -1157,8 +1180,10 @@ STDMETHODIMP BrowserAccessibilityWin::get_columnDescription(long column, |
return S_OK; |
} |
- return cell->GetStringAttributeAsBstr( |
- ui::AX_ATTR_DESCRIPTION, description); |
+ if (cell->description().size() > 0) { |
+ *description = SysAllocString(cell->description().c_str()); |
+ return S_OK; |
+ } |
} |
} |
@@ -1344,8 +1369,10 @@ STDMETHODIMP BrowserAccessibilityWin::get_rowDescription(long row, |
return S_OK; |
} |
- return cell->GetStringAttributeAsBstr( |
- ui::AX_ATTR_DESCRIPTION, description); |
+ if (cell->description().size() > 0) { |
+ *description = SysAllocString(cell->description().c_str()); |
+ return S_OK; |
+ } |
} |
} |
@@ -2147,11 +2174,18 @@ STDMETHODIMP BrowserAccessibilityWin::get_newText(IA2TextSegment* new_text) { |
if (!new_text) |
return E_INVALIDARG; |
- base::string16 text = TextForIAccessibleText(); |
+ //if (!old_win_attributes_) |
aboxhall
2015/01/22 21:22:09
Lingering commented-out code
dmazzoni
2015/01/23 23:26:13
Done.
|
+ // return E_FAIL; |
- new_text->text = SysAllocString(text.c_str()); |
- new_text->start = 0; |
- new_text->end = static_cast<long>(text.size()); |
+ int start, old_len, new_len; |
+ ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); |
+ if (new_len == 0) |
+ return E_FAIL; |
+ |
+ base::string16 substr = hypertext_.substr(start, new_len); |
+ new_text->text = SysAllocString(substr.c_str()); |
+ new_text->start = static_cast<long>(start); |
+ new_text->end = static_cast<long>(start + new_len); |
return S_OK; |
} |
@@ -2162,9 +2196,18 @@ STDMETHODIMP BrowserAccessibilityWin::get_oldText(IA2TextSegment* old_text) { |
if (!old_text) |
return E_INVALIDARG; |
- old_text->text = SysAllocString(old_text_.c_str()); |
- old_text->start = 0; |
- old_text->end = static_cast<long>(old_text_.size()); |
+ //if (!old_win_attributes_) |
+ // return E_FAIL; |
+ |
+ int start, old_len, new_len; |
+ ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); |
+ if (old_len == 0) |
+ return E_FAIL; |
+ |
+ base::string16 substr = old_hypertext_.substr(start, old_len); |
+ old_text->text = SysAllocString(substr.c_str()); |
+ old_text->start = static_cast<long>(start); |
+ old_text->end = static_cast<long>(start + old_len); |
return S_OK; |
} |
@@ -2298,8 +2341,10 @@ STDMETHODIMP BrowserAccessibilityWin::get_hyperlinkIndex( |
*hyperlink_index = -1; |
- if (char_index < 0 || char_index >= static_cast<long>(hypertext_.size())) |
+ if (char_index < 0 || |
+ char_index >= static_cast<long>(hypertext_.size())) { |
return E_INVALIDARG; |
+ } |
std::map<int32, int32>::iterator it = |
hyperlink_offset_to_index_.find(char_index); |
@@ -2448,14 +2493,14 @@ STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( |
*node_name = NULL; |
*name_space_id = 0; |
- *node_value = SysAllocString(base::UTF8ToUTF16(value()).c_str()); |
+ *node_value = SysAllocString(value().c_str()); |
*num_children = PlatformChildCount(); |
*unique_id = unique_id_win_; |
- if (ia_role_ == ROLE_SYSTEM_DOCUMENT) { |
+ if (ia_role() == ROLE_SYSTEM_DOCUMENT) { |
*node_type = NODETYPE_DOCUMENT; |
- } else if (ia_role_ == ROLE_SYSTEM_TEXT && |
- ((ia2_state_ & IA2_STATE_EDITABLE) == 0)) { |
+ } else if (ia_role() == ROLE_SYSTEM_TEXT && |
+ ((ia2_state() & IA2_STATE_EDITABLE) == 0)) { |
*node_type = NODETYPE_TEXT; |
} else { |
*node_type = NODETYPE_ELEMENT; |
@@ -2866,7 +2911,7 @@ HRESULT WINAPI BrowserAccessibilityWin::InternalQueryInterface( |
void** object) { |
BrowserAccessibilityWin* accessibility = |
reinterpret_cast<BrowserAccessibilityWin*>(this_ptr); |
- int32 ia_role = accessibility->ia_role_; |
+ int32 ia_role = accessibility->ia_role(); |
if (iid == IID_IAccessibleImage) { |
if (ia_role != ROLE_SYSTEM_GRAPHIC) { |
*object = NULL; |
@@ -2904,12 +2949,28 @@ HRESULT WINAPI BrowserAccessibilityWin::InternalQueryInterface( |
// Private methods. |
// |
-// Called every time this node's data changes. |
+// Called every time this node's data changes, while the tree update is |
+// still in progress. |
void BrowserAccessibilityWin::OnDataChanged() { |
BrowserAccessibility::OnDataChanged(); |
+} |
+ |
+// Called every time this node's data changes, after an atomic tree update. |
+void BrowserAccessibilityWin::OnUpdateFinished() { |
+ BrowserAccessibility::OnUpdateFinished(); |
+ |
+ if (PlatformIsChildOfLeaf()) |
+ return; |
+ |
+ bool is_new_object = ia_role() == 0 && role_name().empty(); |
+ |
+ old_win_attributes_.swap(win_attributes_); |
+ win_attributes_.reset(new WinAttributes()); |
InitRoleAndState(); |
+ win_attributes_->ia2_attributes.clear(); |
+ |
// Expose autocomplete attribute for combobox and textbox. |
StringAttributeToIA2(ui::AX_ATTR_AUTO_COMPLETE, "autocomplete"); |
@@ -2926,18 +2987,18 @@ void BrowserAccessibilityWin::OnDataChanged() { |
if (GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && |
GetParent() && |
GetParent()->GetRole() == ui::AX_ROLE_LIST_BOX) { |
- ia2_attributes_.push_back( |
+ win_attributes_->ia2_attributes.push_back( |
L"setsize:" + base::IntToString16(GetParent()->PlatformChildCount())); |
- ia2_attributes_.push_back( |
+ win_attributes_->ia2_attributes.push_back( |
L"setsize:" + base::IntToString16(GetIndexInParent() + 1)); |
} |
- if (ia_role_ == ROLE_SYSTEM_CHECKBUTTON || |
- ia_role_ == ROLE_SYSTEM_RADIOBUTTON || |
- ia2_role_ == IA2_ROLE_CHECK_MENU_ITEM || |
- ia2_role_ == IA2_ROLE_RADIO_MENU_ITEM || |
- ia2_role_ == IA2_ROLE_TOGGLE_BUTTON) { |
- ia2_attributes_.push_back(L"checkable:true"); |
+ if (ia_role() == ROLE_SYSTEM_CHECKBUTTON || |
+ ia_role() == ROLE_SYSTEM_RADIOBUTTON || |
+ ia2_role() == IA2_ROLE_CHECK_MENU_ITEM || |
+ ia2_role() == IA2_ROLE_RADIO_MENU_ITEM || |
+ ia2_role() == IA2_ROLE_TOGGLE_BUTTON) { |
+ win_attributes_->ia2_attributes.push_back(L"checkable:true"); |
} |
// Expose live region attributes. |
@@ -2956,13 +3017,6 @@ void BrowserAccessibilityWin::OnDataChanged() { |
BoolAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_BUSY, |
"container-busy"); |
- // Expose slider value. |
- if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || |
- ia_role_ == ROLE_SYSTEM_SCROLLBAR || |
- ia_role_ == ROLE_SYSTEM_SLIDER) { |
- ia2_attributes_.push_back(L"valuetext:" + GetValueText()); |
- } |
- |
// Expose table cell index. |
if (IsCellOrTableHeaderRole()) { |
BrowserAccessibility* table = GetParent(); |
@@ -2973,7 +3027,7 @@ void BrowserAccessibilityWin::OnDataChanged() { |
ui::AX_ATTR_UNIQUE_CELL_IDS); |
for (size_t i = 0; i < unique_cell_ids.size(); ++i) { |
if (unique_cell_ids[i] == GetId()) { |
- ia2_attributes_.push_back( |
+ win_attributes_->ia2_attributes.push_back( |
base::string16(L"table-cell-index:") + base::IntToString16(i)); |
} |
} |
@@ -2989,26 +3043,27 @@ void BrowserAccessibilityWin::OnDataChanged() { |
case ui::AX_INVALID_STATE_NONE: |
break; |
case ui::AX_INVALID_STATE_FALSE: |
- ia2_attributes_.push_back(L"invalid:false"); |
+ win_attributes_->ia2_attributes.push_back(L"invalid:false"); |
break; |
case ui::AX_INVALID_STATE_TRUE: |
- ia2_attributes_.push_back(L"invalid:true"); |
+ win_attributes_->ia2_attributes.push_back(L"invalid:true"); |
break; |
case ui::AX_INVALID_STATE_SPELLING: |
- ia2_attributes_.push_back(L"invalid:spelling"); |
+ win_attributes_->ia2_attributes.push_back(L"invalid:spelling"); |
break; |
case ui::AX_INVALID_STATE_GRAMMAR: |
- ia2_attributes_.push_back(L"invalid:grammar"); |
+ win_attributes_->ia2_attributes.push_back(L"invalid:grammar"); |
break; |
case ui::AX_INVALID_STATE_OTHER: |
{ |
base::string16 aria_invalid_value; |
if (GetString16Attribute(ui::AX_ATTR_ARIA_INVALID_VALUE, |
&aria_invalid_value)) { |
- ia2_attributes_.push_back(L"invalid:" + aria_invalid_value); |
+ win_attributes_->ia2_attributes.push_back( |
+ L"invalid:" + aria_invalid_value); |
} else { |
// Set the attribute to L"true", since we cannot be more specific. |
- ia2_attributes_.push_back(L"invalid:true"); |
+ win_attributes_->ia2_attributes.push_back(L"invalid:true"); |
} |
} |
break; |
@@ -3038,16 +3093,16 @@ void BrowserAccessibilityWin::OnDataChanged() { |
// always returns the primary name in "name" and the secondary name, |
// if any, in "description". |
- int title_elem_id = GetIntAttribute( |
- ui::AX_ATTR_TITLE_UI_ELEMENT); |
- std::string help = GetStringAttribute(ui::AX_ATTR_HELP); |
- std::string description = GetStringAttribute( |
- ui::AX_ATTR_DESCRIPTION); |
+ int title_elem_id = GetIntAttribute(ui::AX_ATTR_TITLE_UI_ELEMENT); |
+ base::string16 name = GetString16Attribute(ui::AX_ATTR_NAME); |
+ base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); |
+ base::string16 help = GetString16Attribute(ui::AX_ATTR_HELP); |
+ base::string16 value = GetString16Attribute(ui::AX_ATTR_VALUE); |
// WebKit annoyingly puts the title in the description if there's no other |
// description, which just confuses the rest of the logic. Put it back. |
// Now "help" is always the value of the "title" attribute, if present. |
- std::string title_attr; |
+ base::string16 title_attr; |
if (GetHtmlAttribute("title", &title_attr) && |
description == title_attr && |
help.empty()) { |
@@ -3059,55 +3114,57 @@ void BrowserAccessibilityWin::OnDataChanged() { |
// it's nonempty, and the help should become the description if |
// there's no description - or the name if there's no name or description. |
if (!description.empty()) { |
- set_name(description); |
+ name = description; |
description.clear(); |
} |
if (!help.empty() && description.empty()) { |
description = help; |
help.clear(); |
} |
- if (!description.empty() && name().empty() && !title_elem_id) { |
- set_name(description); |
+ if (!description.empty() && name.empty() && !title_elem_id) { |
+ name = description; |
description.clear(); |
} |
// If it's a text field, also consider the placeholder. |
- std::string placeholder; |
+ base::string16 placeholder; |
if (GetRole() == ui::AX_ROLE_TEXT_FIELD && |
HasState(ui::AX_STATE_FOCUSABLE) && |
GetHtmlAttribute("placeholder", &placeholder)) { |
- if (name().empty() && !title_elem_id) { |
- set_name(placeholder); |
+ if (name.empty() && !title_elem_id) { |
+ name = placeholder; |
} else if (description.empty()) { |
description = placeholder; |
} |
} |
- SetStringAttribute(ui::AX_ATTR_DESCRIPTION, description); |
- SetStringAttribute(ui::AX_ATTR_HELP, help); |
- |
// On Windows, the value of a document should be its url. |
if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || |
GetRole() == ui::AX_ROLE_WEB_AREA) { |
- set_value(GetStringAttribute(ui::AX_ATTR_DOC_URL)); |
+ value = GetString16Attribute(ui::AX_ATTR_DOC_URL); |
} |
// For certain roles (listbox option, static text, and list marker) |
// WebKit stores the main accessible text in the "value" - swap it so |
// that it's the "name". |
- if (name().empty() && |
+ if (name.empty() && |
(GetRole() == ui::AX_ROLE_LIST_BOX_OPTION || |
GetRole() == ui::AX_ROLE_STATIC_TEXT || |
GetRole() == ui::AX_ROLE_LIST_MARKER)) { |
- std::string tmp = value(); |
- set_value(name()); |
- set_name(tmp); |
+ base::string16 tmp = value; |
+ value = name; |
+ name = tmp; |
} |
// If this doesn't have a value and is linked then set its value to the url |
// attribute. This allows screen readers to read an empty link's destination. |
- if (value().empty() && (ia_state_ & STATE_SYSTEM_LINKED)) |
- set_value(GetStringAttribute(ui::AX_ATTR_URL)); |
+ if (value.empty() && (ia_state() & STATE_SYSTEM_LINKED)) |
+ value = GetString16Attribute(ui::AX_ATTR_URL); |
+ |
+ win_attributes_->name = name; |
+ win_attributes_->description = description; |
+ win_attributes_->help = help; |
+ win_attributes_->value = value; |
// Clear any old relationships between this node and other nodes. |
for (size_t i = 0; i < relations_.size(); ++i) |
@@ -3127,95 +3184,145 @@ void BrowserAccessibilityWin::OnDataChanged() { |
relations_.push_back(relation); |
} |
+ // Expose slider value. |
aboxhall
2015/01/22 21:22:09
The one feature I wish Rietveld had: move detectio
dmazzoni
2015/01/23 23:26:13
Acknowledged.
|
+ if (ia_role() == ROLE_SYSTEM_PROGRESSBAR || |
+ ia_role() == ROLE_SYSTEM_SCROLLBAR || |
+ ia_role() == ROLE_SYSTEM_SLIDER) { |
+ win_attributes_->ia2_attributes.push_back(L"valuetext:" + GetValueText()); |
+ } |
+ |
// If this is a web area for a presentational iframe, give it a role of |
// something other than DOCUMENT so that the fact that it's a separate doc |
// is not exposed to AT. |
if (IsWebAreaForPresentationalIframe()) { |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = ROLE_SYSTEM_GROUPING; |
+ win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; |
+ win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; |
+ } |
+ |
+ BrowserAccessibilityManagerWin* manager = |
+ this->manager()->ToBrowserAccessibilityManagerWin(); |
+ |
+ // Fire an event when an alert first appears. |
+ if (ia_role() == ROLE_SYSTEM_ALERT && |
+ old_win_attributes_->ia_role != ROLE_SYSTEM_ALERT) { |
+ manager->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this); |
+ } |
+ |
+ LOG(ERROR) << "id=" << GetId() |
aboxhall
2015/01/22 21:22:09
logspam?
dmazzoni
2015/01/23 23:26:13
Done.
|
+ << " old_role=" << old_win_attributes_->ia_role |
+ << " role=" << ia_role() |
+ << " old_description=" << old_win_attributes_->description |
+ << " description=" << description; |
+ |
+ // Fire an event if the name, description, help, or value changes. |
+ if (!is_new_object) { |
+ if (name != old_win_attributes_->name) |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, this); |
+ if (description != old_win_attributes_->description) |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_DESCRIPTIONCHANGE, this); |
+ if (help != old_win_attributes_->help) |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_HELPCHANGE, this); |
+ if (value != old_win_attributes_->value) |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_VALUECHANGE, this); |
+ if (ia_state() != old_win_attributes_->ia_state) |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_STATECHANGE, this); |
+ |
+ // Normally focus events are handled elsewhere, however |
+ // focus for managed descendants is platform-specific. |
+ // Fire a focus event if the focused descendant in a multi-select |
+ // list box changes. |
+ if (GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && |
+ (ia_state() & STATE_SYSTEM_FOCUSABLE) && |
+ (ia_state() & STATE_SYSTEM_SELECTABLE) && |
+ (ia_state() & STATE_SYSTEM_FOCUSED) && |
+ !(old_win_attributes_->ia_state & STATE_SYSTEM_FOCUSED)) { |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, this); |
+ } |
+ |
+ // Handle selection being added or removed. |
+ if ((ia_state() & STATE_SYSTEM_SELECTED) && |
aboxhall
2015/01/22 21:22:10
Suggestion: pull out (ia_state() & STATE_SYSTEM_SE
dmazzoni
2015/01/23 23:26:13
Good idea, done.
|
+ !(old_win_attributes_->ia_state & STATE_SYSTEM_SELECTED)) { |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONADD, this); |
+ } else if (!(ia_state() & STATE_SYSTEM_SELECTED) && |
+ (old_win_attributes_->ia_state & STATE_SYSTEM_SELECTED)) { |
+ manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE, this); |
+ } |
+ |
+ // Fire an event if this container object has scrolled. |
+ int sx = 0; |
+ int sy = 0; |
+ if (GetIntAttribute(ui::AX_ATTR_SCROLL_X, &sx) && |
+ GetIntAttribute(ui::AX_ATTR_SCROLL_Y, &sy)) { |
+ if (sx != previous_scroll_x_ || sy != previous_scroll_y_) |
+ manager->MaybeCallNotifyWinEvent(EVENT_SYSTEM_SCROLLINGEND, this); |
+ previous_scroll_x_ = sx; |
+ previous_scroll_y_ = sy; |
+ } |
+ |
+ // Changing a static text node can affect the IAccessibleText hypertext |
+ // of the parent node, so force it to be recomputed here. |
+ if (GetParent() && |
+ GetRole() == ui::AX_ROLE_STATIC_TEXT && |
+ name != old_win_attributes_->name) { |
+ GetParent()->ToBrowserAccessibilityWin()->UpdateIAccessibleText(); |
+ } |
} |
+ |
+ old_win_attributes_.reset(nullptr); |
} |
-void BrowserAccessibilityWin::OnUpdateFinished() { |
+void BrowserAccessibilityWin::UpdateIAccessibleText() { |
+ old_hypertext_ = hypertext_; |
+ hypertext_.clear(); |
+ |
// Construct the hypertext for this node. |
hyperlink_offset_to_index_.clear(); |
hyperlinks_.clear(); |
- hypertext_.clear(); |
for (unsigned int i = 0; i < PlatformChildCount(); ++i) { |
- BrowserAccessibility* child = PlatformGetChild(i); |
+ BrowserAccessibilityWin* child = |
+ PlatformGetChild(i)->ToBrowserAccessibilityWin(); |
if (child->GetRole() == ui::AX_ROLE_STATIC_TEXT) { |
- hypertext_ += base::UTF8ToUTF16(child->name()); |
+ hypertext_ += child->name(); |
} else { |
- hyperlink_offset_to_index_[hypertext_.size()] = hyperlinks_.size(); |
+ hyperlink_offset_to_index_[hypertext_.size()] = |
+ hyperlinks_.size(); |
hypertext_ += kEmbeddedCharacter; |
hyperlinks_.push_back(i); |
} |
} |
DCHECK_EQ(hyperlink_offset_to_index_.size(), hyperlinks_.size()); |
- // Fire an event when an alert first appears. |
- if (GetRole() == ui::AX_ROLE_ALERT && first_time_) |
- manager()->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this); |
- |
- // Fire events if text has changed. |
- base::string16 text = TextForIAccessibleText(); |
- if (previous_text_ != text) { |
- if (!previous_text_.empty() && !text.empty()) { |
- manager()->NotifyAccessibilityEvent( |
- ui::AX_EVENT_SHOW, this); |
+ if (hypertext_ != old_hypertext_) { |
aboxhall
2015/01/22 21:22:09
Maybe early-out instead?
dmazzoni
2015/01/23 23:26:13
Only reason I don't want to is because we need to
aboxhall
2015/01/23 23:39:13
Yeah, you could either write that line twice, or j
|
+ LOG(ERROR) << "Old hypertext: '" << old_hypertext_ |
+ << "' new hypertext: '" << hypertext_ << "'"; |
+ BrowserAccessibilityManagerWin* manager = |
+ this->manager()->ToBrowserAccessibilityManagerWin(); |
+ |
+ int start, old_len, new_len; |
+ ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); |
+ if (old_len) { |
+ // In-process screen readers may call IAccessibleText::get_oldText |
+ // to retrieve the text that was removed. |
+ manager->MaybeCallNotifyWinEvent(IA2_EVENT_TEXT_REMOVED, this); |
} |
- |
- // TODO(dmazzoni): Look into HIDE events, too. |
- |
- old_text_ = previous_text_; |
- previous_text_ = text; |
- } |
- |
- BrowserAccessibilityManagerWin* manager = |
- this->manager()->ToBrowserAccessibilityManagerWin(); |
- |
- // Fire events if the state has changed. |
- if (!first_time_ && ia_state_ != old_ia_state_) { |
- // Normally focus events are handled elsewhere, however |
- // focus for managed descendants is platform-specific. |
- // Fire a focus event if the focused descendant in a multi-select |
- // list box changes. |
- if (GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && |
- (ia_state_ & STATE_SYSTEM_FOCUSABLE) && |
- (ia_state_ & STATE_SYSTEM_SELECTABLE) && |
- (ia_state_ & STATE_SYSTEM_FOCUSED) && |
- !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) { |
- manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, unique_id_win()); |
- } |
- |
- if ((ia_state_ & STATE_SYSTEM_SELECTED) && |
- !(old_ia_state_ & STATE_SYSTEM_SELECTED)) { |
- manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONADD, |
- unique_id_win()); |
- } else if (!(ia_state_ & STATE_SYSTEM_SELECTED) && |
- (old_ia_state_ & STATE_SYSTEM_SELECTED)) { |
- manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE, |
- unique_id_win()); |
+ if (new_len) { |
+ // In-process screen readers may call IAccessibleText::get_newText |
+ // to retrieve the text that was inserted. |
+ manager->MaybeCallNotifyWinEvent(IA2_EVENT_TEXT_INSERTED, this); |
} |
- |
- old_ia_state_ = ia_state_; |
} |
- // Fire an event if this container object has scrolled. |
- int sx = 0; |
- int sy = 0; |
- if (GetIntAttribute(ui::AX_ATTR_SCROLL_X, &sx) && |
- GetIntAttribute(ui::AX_ATTR_SCROLL_Y, &sy)) { |
- if (!first_time_ && |
- (sx != previous_scroll_x_ || sy != previous_scroll_y_)) { |
- manager->MaybeCallNotifyWinEvent(EVENT_SYSTEM_SCROLLINGEND, |
- unique_id_win()); |
- } |
- previous_scroll_x_ = sx; |
- previous_scroll_y_ = sy; |
- } |
+ old_hypertext_.clear(); |
+} |
+ |
+void BrowserAccessibilityWin::OnSubtreeWillBeDeleted() { |
+ manager()->ToBrowserAccessibilityManagerWin()->MaybeCallNotifyWinEvent( |
+ EVENT_OBJECT_HIDE, this); |
+} |
- first_time_ = false; |
+void BrowserAccessibilityWin::OnSubtreeCreationFinished() { |
+ manager()->ToBrowserAccessibilityManagerWin()->MaybeCallNotifyWinEvent( |
+ EVENT_OBJECT_SHOW, this); |
} |
void BrowserAccessibilityWin::NativeAddReference() { |
@@ -3232,7 +3339,7 @@ bool BrowserAccessibilityWin::IsNative() const { |
void BrowserAccessibilityWin::OnLocationChanged() { |
manager()->ToBrowserAccessibilityManagerWin()->MaybeCallNotifyWinEvent( |
- EVENT_OBJECT_LOCATIONCHANGE, unique_id_win()); |
+ EVENT_OBJECT_LOCATIONCHANGE, this); |
} |
BrowserAccessibilityWin* BrowserAccessibilityWin::NewReference() { |
@@ -3277,8 +3384,10 @@ void BrowserAccessibilityWin::StringAttributeToIA2( |
ui::AXStringAttribute attribute, |
const char* ia2_attr) { |
base::string16 value; |
- if (GetString16Attribute(attribute, &value)) |
- ia2_attributes_.push_back(base::ASCIIToUTF16(ia2_attr) + L":" + value); |
+ if (GetString16Attribute(attribute, &value)) { |
+ win_attributes_->ia2_attributes.push_back( |
+ base::ASCIIToUTF16(ia2_attr) + L":" + value); |
+ } |
} |
void BrowserAccessibilityWin::BoolAttributeToIA2( |
@@ -3286,8 +3395,9 @@ void BrowserAccessibilityWin::BoolAttributeToIA2( |
const char* ia2_attr) { |
bool value; |
if (GetBoolAttribute(attribute, &value)) { |
- ia2_attributes_.push_back((base::ASCIIToUTF16(ia2_attr) + L":") + |
- (value ? L"true" : L"false")); |
+ win_attributes_->ia2_attributes.push_back( |
+ (base::ASCIIToUTF16(ia2_attr) + L":") + |
+ (value ? L"true" : L"false")); |
} |
} |
@@ -3296,14 +3406,28 @@ void BrowserAccessibilityWin::IntAttributeToIA2( |
const char* ia2_attr) { |
int value; |
if (GetIntAttribute(attribute, &value)) { |
- ia2_attributes_.push_back(base::ASCIIToUTF16(ia2_attr) + L":" + |
- base::IntToString16(value)); |
+ win_attributes_->ia2_attributes.push_back( |
+ base::ASCIIToUTF16(ia2_attr) + L":" + |
+ base::IntToString16(value)); |
} |
} |
+base::string16 BrowserAccessibilityWin::GetNameRecursive() const { |
+ if (!name().empty()) { |
+ return name(); |
+ } |
+ |
+ base::string16 result; |
+ for (uint32 i = 0; i < PlatformChildCount(); ++i) { |
+ result += PlatformGetChild(i)->ToBrowserAccessibilityWin()-> |
+ GetNameRecursive(); |
+ } |
+ return result; |
+} |
+ |
base::string16 BrowserAccessibilityWin::GetValueText() { |
float fval; |
- base::string16 value = base::UTF8ToUTF16(this->value()); |
+ base::string16 value = this->value(); |
if (value.empty() && |
GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, &fval)) { |
@@ -3314,9 +3438,37 @@ base::string16 BrowserAccessibilityWin::GetValueText() { |
base::string16 BrowserAccessibilityWin::TextForIAccessibleText() { |
if (IsEditableText()) |
- return base::UTF8ToUTF16(value()); |
- return (GetRole() == ui::AX_ROLE_STATIC_TEXT) ? |
- base::UTF8ToUTF16(name()) : hypertext_; |
+ return value(); |
+ return (GetRole() == ui::AX_ROLE_STATIC_TEXT) ? name() : hypertext_; |
+} |
+ |
+void BrowserAccessibilityWin::ComputeHypertextRemovedAndInserted( |
+ int* start, int* old_len, int* new_len) { |
+ *start = 0; |
+ *old_len = 0; |
+ *new_len = 0; |
+ |
+ const base::string16& old_text = old_hypertext_; |
+ const base::string16& new_text = hypertext_; |
+ |
+ size_t common_prefix = 0; |
+ while (common_prefix < old_text.size() && |
+ common_prefix < new_text.size() && |
+ old_text[common_prefix] == new_text[common_prefix]) { |
+ ++common_prefix; |
+ } |
+ |
+ size_t common_suffix = 0; |
+ while (common_prefix + common_suffix < old_text.size() && |
+ common_prefix + common_suffix < new_text.size() && |
+ old_text[old_text.size() - common_suffix - 1] == |
+ new_text[new_text.size() - common_suffix - 1]) { |
+ ++common_suffix; |
+ } |
+ |
+ *start = common_prefix; |
+ *old_len = old_text.size() - common_prefix - common_suffix; |
+ *new_len = new_text.size() - common_prefix - common_suffix; |
} |
void BrowserAccessibilityWin::HandleSpecialTextOffset( |
@@ -3367,500 +3519,500 @@ BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromID(int32 id) { |
} |
void BrowserAccessibilityWin::InitRoleAndState() { |
- ia_state_ = 0; |
- ia2_state_ = IA2_STATE_OPAQUE; |
- ia2_attributes_.clear(); |
+ int32 ia_role = 0; |
+ int32 ia_state = 0; |
+ base::string16 role_name; |
+ int32 ia2_role = 0; |
+ int32 ia2_state = IA2_STATE_OPAQUE; |
if (HasState(ui::AX_STATE_BUSY)) |
- ia_state_ |= STATE_SYSTEM_BUSY; |
+ ia_state |= STATE_SYSTEM_BUSY; |
if (HasState(ui::AX_STATE_CHECKED)) |
- ia_state_ |= STATE_SYSTEM_CHECKED; |
+ ia_state |= STATE_SYSTEM_CHECKED; |
if (HasState(ui::AX_STATE_COLLAPSED)) |
- ia_state_ |= STATE_SYSTEM_COLLAPSED; |
+ ia_state |= STATE_SYSTEM_COLLAPSED; |
if (HasState(ui::AX_STATE_EXPANDED)) |
- ia_state_ |= STATE_SYSTEM_EXPANDED; |
+ ia_state |= STATE_SYSTEM_EXPANDED; |
if (HasState(ui::AX_STATE_FOCUSABLE)) |
- ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
+ ia_state |= STATE_SYSTEM_FOCUSABLE; |
if (HasState(ui::AX_STATE_HASPOPUP)) |
- ia_state_ |= STATE_SYSTEM_HASPOPUP; |
+ ia_state |= STATE_SYSTEM_HASPOPUP; |
if (HasState(ui::AX_STATE_HOVERED)) |
- ia_state_ |= STATE_SYSTEM_HOTTRACKED; |
+ ia_state |= STATE_SYSTEM_HOTTRACKED; |
if (HasState(ui::AX_STATE_INDETERMINATE)) |
- ia_state_ |= STATE_SYSTEM_INDETERMINATE; |
+ ia_state |= STATE_SYSTEM_INDETERMINATE; |
if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && |
GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) |
- ia2_state_ |= IA2_STATE_INVALID_ENTRY; |
+ ia2_state |= IA2_STATE_INVALID_ENTRY; |
if (HasState(ui::AX_STATE_INVISIBLE)) |
- ia_state_ |= STATE_SYSTEM_INVISIBLE; |
+ ia_state |= STATE_SYSTEM_INVISIBLE; |
if (HasState(ui::AX_STATE_LINKED)) |
- ia_state_ |= STATE_SYSTEM_LINKED; |
+ ia_state |= STATE_SYSTEM_LINKED; |
if (HasState(ui::AX_STATE_MULTISELECTABLE)) { |
- ia_state_ |= STATE_SYSTEM_EXTSELECTABLE; |
- ia_state_ |= STATE_SYSTEM_MULTISELECTABLE; |
+ ia_state |= STATE_SYSTEM_EXTSELECTABLE; |
+ ia_state |= STATE_SYSTEM_MULTISELECTABLE; |
} |
// TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. |
if (HasState(ui::AX_STATE_OFFSCREEN)) |
- ia_state_ |= STATE_SYSTEM_OFFSCREEN; |
+ ia_state |= STATE_SYSTEM_OFFSCREEN; |
if (HasState(ui::AX_STATE_PRESSED)) |
- ia_state_ |= STATE_SYSTEM_PRESSED; |
+ ia_state |= STATE_SYSTEM_PRESSED; |
if (HasState(ui::AX_STATE_PROTECTED)) |
- ia_state_ |= STATE_SYSTEM_PROTECTED; |
+ ia_state |= STATE_SYSTEM_PROTECTED; |
if (HasState(ui::AX_STATE_REQUIRED)) |
- ia2_state_ |= IA2_STATE_REQUIRED; |
+ ia2_state |= IA2_STATE_REQUIRED; |
if (HasState(ui::AX_STATE_SELECTABLE)) |
- ia_state_ |= STATE_SYSTEM_SELECTABLE; |
+ ia_state |= STATE_SYSTEM_SELECTABLE; |
if (HasState(ui::AX_STATE_SELECTED)) |
- ia_state_ |= STATE_SYSTEM_SELECTED; |
+ ia_state |= STATE_SYSTEM_SELECTED; |
if (HasState(ui::AX_STATE_VISITED)) |
- ia_state_ |= STATE_SYSTEM_TRAVERSED; |
+ ia_state |= STATE_SYSTEM_TRAVERSED; |
if (!HasState(ui::AX_STATE_ENABLED)) |
- ia_state_ |= STATE_SYSTEM_UNAVAILABLE; |
+ ia_state |= STATE_SYSTEM_UNAVAILABLE; |
if (HasState(ui::AX_STATE_VERTICAL)) |
- ia2_state_ |= IA2_STATE_VERTICAL; |
+ ia2_state |= IA2_STATE_VERTICAL; |
if (HasState(ui::AX_STATE_HORIZONTAL)) |
- ia2_state_ |= IA2_STATE_HORIZONTAL; |
+ ia2_state |= IA2_STATE_HORIZONTAL; |
if (HasState(ui::AX_STATE_VISITED)) |
- ia_state_ |= STATE_SYSTEM_TRAVERSED; |
+ ia_state |= STATE_SYSTEM_TRAVERSED; |
// WebKit marks everything as readonly unless it's editable text, so if it's |
// not readonly, mark it as editable now. The final computation of the |
// READONLY state for MSAA is below, after the switch. |
if (!HasState(ui::AX_STATE_READ_ONLY)) |
- ia2_state_ |= IA2_STATE_EDITABLE; |
+ ia2_state |= IA2_STATE_EDITABLE; |
if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) |
- ia_state_ |= STATE_SYSTEM_MIXED; |
+ ia_state |= STATE_SYSTEM_MIXED; |
if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
- ia2_state_ |= IA2_STATE_EDITABLE; |
+ ia2_state |= IA2_STATE_EDITABLE; |
if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) |
- ia2_state_ |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; |
+ ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; |
base::string16 html_tag = GetString16Attribute( |
ui::AX_ATTR_HTML_TAG); |
- ia_role_ = 0; |
- ia2_role_ = 0; |
switch (GetRole()) { |
case ui::AX_ROLE_ALERT: |
- ia_role_ = ROLE_SYSTEM_ALERT; |
+ ia_role = ROLE_SYSTEM_ALERT; |
break; |
case ui::AX_ROLE_ALERT_DIALOG: |
- ia_role_ = ROLE_SYSTEM_DIALOG; |
+ ia_role = ROLE_SYSTEM_DIALOG; |
break; |
case ui::AX_ROLE_APPLICATION: |
- ia_role_ = ROLE_SYSTEM_APPLICATION; |
+ ia_role = ROLE_SYSTEM_APPLICATION; |
break; |
case ui::AX_ROLE_ARTICLE: |
- ia_role_ = ROLE_SYSTEM_DOCUMENT; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_DOCUMENT; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_BANNER: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_HEADER; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_HEADER; |
break; |
case ui::AX_ROLE_BLOCKQUOTE: |
- role_name_ = html_tag; |
- ia2_role_ = IA2_ROLE_SECTION; |
+ role_name = html_tag; |
+ ia2_role = IA2_ROLE_SECTION; |
break; |
case ui::AX_ROLE_BUSY_INDICATOR: |
- ia_role_ = ROLE_SYSTEM_ANIMATION; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_ANIMATION; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_BUTTON: |
- ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
+ ia_role = ROLE_SYSTEM_PUSHBUTTON; |
break; |
case ui::AX_ROLE_CANVAS: |
if (GetBoolAttribute(ui::AX_ATTR_CANVAS_HAS_FALLBACK)) { |
- role_name_ = L"canvas"; |
- ia2_role_ = IA2_ROLE_CANVAS; |
+ role_name = L"canvas"; |
+ ia2_role = IA2_ROLE_CANVAS; |
} else { |
- ia_role_ = ROLE_SYSTEM_GRAPHIC; |
+ ia_role = ROLE_SYSTEM_GRAPHIC; |
} |
break; |
case ui::AX_ROLE_CAPTION: |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_role_ = IA2_ROLE_CAPTION; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_role = IA2_ROLE_CAPTION; |
break; |
case ui::AX_ROLE_CELL: |
- ia_role_ = ROLE_SYSTEM_CELL; |
+ ia_role = ROLE_SYSTEM_CELL; |
break; |
case ui::AX_ROLE_CHECK_BOX: |
- ia_role_ = ROLE_SYSTEM_CHECKBUTTON; |
- ia2_state_ |= IA2_STATE_CHECKABLE; |
+ ia_role = ROLE_SYSTEM_CHECKBUTTON; |
+ ia2_state |= IA2_STATE_CHECKABLE; |
break; |
case ui::AX_ROLE_COLOR_WELL: |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_role_ = IA2_ROLE_COLOR_CHOOSER; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_role = IA2_ROLE_COLOR_CHOOSER; |
break; |
case ui::AX_ROLE_COLUMN: |
- ia_role_ = ROLE_SYSTEM_COLUMN; |
+ ia_role = ROLE_SYSTEM_COLUMN; |
break; |
case ui::AX_ROLE_COLUMN_HEADER: |
- ia_role_ = ROLE_SYSTEM_COLUMNHEADER; |
+ ia_role = ROLE_SYSTEM_COLUMNHEADER; |
break; |
case ui::AX_ROLE_COMBO_BOX: |
- ia_role_ = ROLE_SYSTEM_COMBOBOX; |
+ ia_role = ROLE_SYSTEM_COMBOBOX; |
break; |
case ui::AX_ROLE_COMPLEMENTARY: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_NOTE; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_NOTE; |
break; |
case ui::AX_ROLE_CONTENT_INFO: |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_role_ = IA2_ROLE_PARAGRAPH; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_role = IA2_ROLE_PARAGRAPH; |
break; |
case ui::AX_ROLE_DATE: |
case ui::AX_ROLE_DATE_TIME: |
- ia_role_ = ROLE_SYSTEM_DROPLIST; |
- ia2_role_ = IA2_ROLE_DATE_EDITOR; |
+ ia_role = ROLE_SYSTEM_DROPLIST; |
+ ia2_role = IA2_ROLE_DATE_EDITOR; |
break; |
case ui::AX_ROLE_DIV: |
- role_name_ = L"div"; |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_SECTION; |
+ role_name = L"div"; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_SECTION; |
break; |
case ui::AX_ROLE_DEFINITION: |
- role_name_ = html_tag; |
- ia2_role_ = IA2_ROLE_PARAGRAPH; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ role_name = html_tag; |
+ ia2_role = IA2_ROLE_PARAGRAPH; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_DESCRIPTION_LIST_DETAIL: |
- role_name_ = html_tag; |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_role_ = IA2_ROLE_PARAGRAPH; |
+ role_name = html_tag; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_role = IA2_ROLE_PARAGRAPH; |
break; |
case ui::AX_ROLE_DESCRIPTION_LIST: |
- role_name_ = html_tag; |
- ia_role_ = ROLE_SYSTEM_LIST; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ role_name = html_tag; |
+ ia_role = ROLE_SYSTEM_LIST; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_DESCRIPTION_LIST_TERM: |
- ia_role_ = ROLE_SYSTEM_LISTITEM; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_LISTITEM; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_DETAILS: |
- role_name_ = html_tag; |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
+ role_name = html_tag; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
break; |
case ui::AX_ROLE_DIALOG: |
- ia_role_ = ROLE_SYSTEM_DIALOG; |
+ ia_role = ROLE_SYSTEM_DIALOG; |
break; |
case ui::AX_ROLE_DISCLOSURE_TRIANGLE: |
- ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
+ ia_role = ROLE_SYSTEM_PUSHBUTTON; |
break; |
case ui::AX_ROLE_DOCUMENT: |
case ui::AX_ROLE_ROOT_WEB_AREA: |
case ui::AX_ROLE_WEB_AREA: |
- ia_role_ = ROLE_SYSTEM_DOCUMENT; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
- ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
+ ia_role = ROLE_SYSTEM_DOCUMENT; |
+ ia_state |= STATE_SYSTEM_READONLY; |
+ ia_state |= STATE_SYSTEM_FOCUSABLE; |
break; |
case ui::AX_ROLE_EMBEDDED_OBJECT: |
- ia_role_ = ROLE_SYSTEM_CLIENT; |
- ia2_role_ = IA2_ROLE_EMBEDDED_OBJECT; |
+ ia_role = ROLE_SYSTEM_CLIENT; |
+ ia2_role = IA2_ROLE_EMBEDDED_OBJECT; |
break; |
case ui::AX_ROLE_FIGCAPTION: |
- role_name_ = html_tag; |
- ia2_role_ = IA2_ROLE_CAPTION; |
+ role_name = html_tag; |
+ ia2_role = IA2_ROLE_CAPTION; |
break; |
case ui::AX_ROLE_FIGURE: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
break; |
case ui::AX_ROLE_FORM: |
- role_name_ = L"form"; |
- ia2_role_ = IA2_ROLE_FORM; |
+ role_name = L"form"; |
+ ia2_role = IA2_ROLE_FORM; |
break; |
case ui::AX_ROLE_FOOTER: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_FOOTER; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_FOOTER; |
break; |
case ui::AX_ROLE_GRID: |
- ia_role_ = ROLE_SYSTEM_TABLE; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_TABLE; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_GROUP: { |
base::string16 aria_role = GetString16Attribute( |
ui::AX_ATTR_ROLE); |
if (aria_role == L"group" || html_tag == L"fieldset") { |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
} else if (html_tag == L"li") { |
- ia_role_ = ROLE_SYSTEM_LISTITEM; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_LISTITEM; |
+ ia_state |= STATE_SYSTEM_READONLY; |
} else { |
if (html_tag.empty()) |
- role_name_ = L"div"; |
+ role_name = L"div"; |
else |
- role_name_ = html_tag; |
- ia2_role_ = IA2_ROLE_SECTION; |
+ role_name = html_tag; |
+ ia2_role = IA2_ROLE_SECTION; |
} |
break; |
} |
case ui::AX_ROLE_HEADING: |
- role_name_ = html_tag; |
- ia2_role_ = IA2_ROLE_HEADING; |
+ role_name = html_tag; |
+ ia2_role = IA2_ROLE_HEADING; |
break; |
case ui::AX_ROLE_IFRAME: |
- ia_role_ = ROLE_SYSTEM_DOCUMENT; |
- ia2_role_ = IA2_ROLE_INTERNAL_FRAME; |
- ia_state_ = STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_DOCUMENT; |
+ ia2_role = IA2_ROLE_INTERNAL_FRAME; |
+ ia_state = STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_IFRAME_PRESENTATIONAL: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
break; |
case ui::AX_ROLE_IMAGE: |
- ia_role_ = ROLE_SYSTEM_GRAPHIC; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_GRAPHIC; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_IMAGE_MAP: |
- role_name_ = html_tag; |
- ia2_role_ = IA2_ROLE_IMAGE_MAP; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ role_name = html_tag; |
+ ia2_role = IA2_ROLE_IMAGE_MAP; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_IMAGE_MAP_LINK: |
- ia_role_ = ROLE_SYSTEM_LINK; |
- ia_state_ |= STATE_SYSTEM_LINKED; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_LINK; |
+ ia_state |= STATE_SYSTEM_LINKED; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_LABEL_TEXT: |
case ui::AX_ROLE_LEGEND: |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_role_ = IA2_ROLE_LABEL; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_role = IA2_ROLE_LABEL; |
break; |
case ui::AX_ROLE_SEARCH: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_SECTION; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_SECTION; |
break; |
case ui::AX_ROLE_LINK: |
- ia_role_ = ROLE_SYSTEM_LINK; |
- ia_state_ |= STATE_SYSTEM_LINKED; |
+ ia_role = ROLE_SYSTEM_LINK; |
+ ia_state |= STATE_SYSTEM_LINKED; |
break; |
case ui::AX_ROLE_LIST: |
- ia_role_ = ROLE_SYSTEM_LIST; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_LIST; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_LIST_BOX: |
- ia_role_ = ROLE_SYSTEM_LIST; |
+ ia_role = ROLE_SYSTEM_LIST; |
break; |
case ui::AX_ROLE_LIST_BOX_OPTION: |
- ia_role_ = ROLE_SYSTEM_LISTITEM; |
- if (ia_state_ & STATE_SYSTEM_SELECTABLE) { |
- ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
+ ia_role = ROLE_SYSTEM_LISTITEM; |
+ if (ia_state & STATE_SYSTEM_SELECTABLE) { |
+ ia_state |= STATE_SYSTEM_FOCUSABLE; |
if (HasState(ui::AX_STATE_FOCUSED)) |
- ia_state_ |= STATE_SYSTEM_FOCUSED; |
+ ia_state |= STATE_SYSTEM_FOCUSED; |
} |
break; |
case ui::AX_ROLE_LIST_ITEM: |
- ia_role_ = ROLE_SYSTEM_LISTITEM; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_LISTITEM; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_MAIN: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_PARAGRAPH; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_PARAGRAPH; |
break; |
case ui::AX_ROLE_MARQUEE: |
- ia_role_ = ROLE_SYSTEM_ANIMATION; |
+ ia_role = ROLE_SYSTEM_ANIMATION; |
break; |
case ui::AX_ROLE_MATH: |
- ia_role_ = ROLE_SYSTEM_EQUATION; |
+ ia_role = ROLE_SYSTEM_EQUATION; |
break; |
case ui::AX_ROLE_MENU: |
case ui::AX_ROLE_MENU_BUTTON: |
- ia_role_ = ROLE_SYSTEM_MENUPOPUP; |
+ ia_role = ROLE_SYSTEM_MENUPOPUP; |
break; |
case ui::AX_ROLE_MENU_BAR: |
- ia_role_ = ROLE_SYSTEM_MENUBAR; |
+ ia_role = ROLE_SYSTEM_MENUBAR; |
break; |
case ui::AX_ROLE_MENU_ITEM: |
- ia_role_ = ROLE_SYSTEM_MENUITEM; |
+ ia_role = ROLE_SYSTEM_MENUITEM; |
break; |
case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: |
- ia_role_ = ROLE_SYSTEM_MENUITEM; |
- ia2_role_ = IA2_ROLE_CHECK_MENU_ITEM; |
- ia2_state_ |= IA2_STATE_CHECKABLE; |
+ ia_role = ROLE_SYSTEM_MENUITEM; |
+ ia2_role = IA2_ROLE_CHECK_MENU_ITEM; |
+ ia2_state |= IA2_STATE_CHECKABLE; |
break; |
case ui::AX_ROLE_MENU_ITEM_RADIO: |
- ia_role_ = ROLE_SYSTEM_MENUITEM; |
- ia2_role_ = IA2_ROLE_RADIO_MENU_ITEM; |
+ ia_role = ROLE_SYSTEM_MENUITEM; |
+ ia2_role = IA2_ROLE_RADIO_MENU_ITEM; |
break; |
case ui::AX_ROLE_MENU_LIST_POPUP: |
- ia_role_ = ROLE_SYSTEM_CLIENT; |
+ ia_role = ROLE_SYSTEM_CLIENT; |
break; |
case ui::AX_ROLE_MENU_LIST_OPTION: |
- ia_role_ = ROLE_SYSTEM_LISTITEM; |
- if (ia_state_ & STATE_SYSTEM_SELECTABLE) { |
- ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
+ ia_role = ROLE_SYSTEM_LISTITEM; |
+ if (ia_state & STATE_SYSTEM_SELECTABLE) { |
+ ia_state |= STATE_SYSTEM_FOCUSABLE; |
if (HasState(ui::AX_STATE_FOCUSED)) |
- ia_state_ |= STATE_SYSTEM_FOCUSED; |
+ ia_state |= STATE_SYSTEM_FOCUSED; |
} |
break; |
case ui::AX_ROLE_METER: |
- role_name_ = html_tag; |
- ia_role_ = ROLE_SYSTEM_PROGRESSBAR; |
+ role_name = html_tag; |
+ ia_role = ROLE_SYSTEM_PROGRESSBAR; |
break; |
case ui::AX_ROLE_NAVIGATION: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_SECTION; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_SECTION; |
break; |
case ui::AX_ROLE_NOTE: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_NOTE; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_NOTE; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_OUTLINE: |
- ia_role_ = ROLE_SYSTEM_OUTLINE; |
+ ia_role = ROLE_SYSTEM_OUTLINE; |
break; |
case ui::AX_ROLE_PARAGRAPH: |
- role_name_ = L"P"; |
- ia2_role_ = IA2_ROLE_PARAGRAPH; |
+ role_name = L"P"; |
+ ia2_role = IA2_ROLE_PARAGRAPH; |
break; |
case ui::AX_ROLE_POP_UP_BUTTON: |
if (html_tag == L"select") { |
- ia_role_ = ROLE_SYSTEM_COMBOBOX; |
+ ia_role = ROLE_SYSTEM_COMBOBOX; |
} else { |
- ia_role_ = ROLE_SYSTEM_BUTTONMENU; |
+ ia_role = ROLE_SYSTEM_BUTTONMENU; |
} |
break; |
case ui::AX_ROLE_PRE: |
- role_name_ = html_tag; |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_role_ = IA2_ROLE_PARAGRAPH; |
+ role_name = html_tag; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_role = IA2_ROLE_PARAGRAPH; |
break; |
case ui::AX_ROLE_PROGRESS_INDICATOR: |
- ia_role_ = ROLE_SYSTEM_PROGRESSBAR; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_PROGRESSBAR; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_RADIO_BUTTON: |
- ia_role_ = ROLE_SYSTEM_RADIOBUTTON; |
- ia2_state_ = IA2_STATE_CHECKABLE; |
+ ia_role = ROLE_SYSTEM_RADIOBUTTON; |
+ ia2_state = IA2_STATE_CHECKABLE; |
break; |
case ui::AX_ROLE_RADIO_GROUP: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
break; |
case ui::AX_ROLE_REGION: |
if (html_tag == L"section") { |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_SECTION; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_SECTION; |
} else { |
- ia_role_ = ROLE_SYSTEM_PANE; |
+ ia_role = ROLE_SYSTEM_PANE; |
} |
break; |
case ui::AX_ROLE_ROW: |
- ia_role_ = ROLE_SYSTEM_ROW; |
+ ia_role = ROLE_SYSTEM_ROW; |
break; |
case ui::AX_ROLE_ROW_HEADER: |
- ia_role_ = ROLE_SYSTEM_ROWHEADER; |
+ ia_role = ROLE_SYSTEM_ROWHEADER; |
break; |
case ui::AX_ROLE_RUBY: |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_role_ = IA2_ROLE_TEXT_FRAME; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_role = IA2_ROLE_TEXT_FRAME; |
break; |
case ui::AX_ROLE_RULER: |
- ia_role_ = ROLE_SYSTEM_CLIENT; |
- ia2_role_ = IA2_ROLE_RULER; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_CLIENT; |
+ ia2_role = IA2_ROLE_RULER; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_SCROLL_AREA: |
- ia_role_ = ROLE_SYSTEM_CLIENT; |
- ia2_role_ = IA2_ROLE_SCROLL_PANE; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
- ia2_state_ &= ~(IA2_STATE_EDITABLE); |
+ ia_role = ROLE_SYSTEM_CLIENT; |
+ ia2_role = IA2_ROLE_SCROLL_PANE; |
+ ia_state |= STATE_SYSTEM_READONLY; |
+ ia2_state &= ~(IA2_STATE_EDITABLE); |
break; |
case ui::AX_ROLE_SCROLL_BAR: |
- ia_role_ = ROLE_SYSTEM_SCROLLBAR; |
+ ia_role = ROLE_SYSTEM_SCROLLBAR; |
break; |
case ui::AX_ROLE_SLIDER: |
- ia_role_ = ROLE_SYSTEM_SLIDER; |
+ ia_role = ROLE_SYSTEM_SLIDER; |
break; |
case ui::AX_ROLE_SPIN_BUTTON: |
- ia_role_ = ROLE_SYSTEM_SPINBUTTON; |
+ ia_role = ROLE_SYSTEM_SPINBUTTON; |
break; |
case ui::AX_ROLE_SPIN_BUTTON_PART: |
- ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
+ ia_role = ROLE_SYSTEM_PUSHBUTTON; |
break; |
case ui::AX_ROLE_ANNOTATION: |
case ui::AX_ROLE_LIST_MARKER: |
case ui::AX_ROLE_STATIC_TEXT: |
- ia_role_ = ROLE_SYSTEM_STATICTEXT; |
+ ia_role = ROLE_SYSTEM_STATICTEXT; |
break; |
case ui::AX_ROLE_STATUS: |
- ia_role_ = ROLE_SYSTEM_STATUSBAR; |
+ ia_role = ROLE_SYSTEM_STATUSBAR; |
break; |
case ui::AX_ROLE_SPLITTER: |
- ia_role_ = ROLE_SYSTEM_SEPARATOR; |
+ ia_role = ROLE_SYSTEM_SEPARATOR; |
break; |
case ui::AX_ROLE_SVG_ROOT: |
- ia_role_ = ROLE_SYSTEM_GRAPHIC; |
+ ia_role = ROLE_SYSTEM_GRAPHIC; |
break; |
case ui::AX_ROLE_TAB: |
- ia_role_ = ROLE_SYSTEM_PAGETAB; |
+ ia_role = ROLE_SYSTEM_PAGETAB; |
break; |
case ui::AX_ROLE_TABLE: { |
base::string16 aria_role = GetString16Attribute( |
ui::AX_ATTR_ROLE); |
if (aria_role == L"treegrid") { |
- ia_role_ = ROLE_SYSTEM_OUTLINE; |
+ ia_role = ROLE_SYSTEM_OUTLINE; |
} else { |
- ia_role_ = ROLE_SYSTEM_TABLE; |
+ ia_role = ROLE_SYSTEM_TABLE; |
} |
break; |
} |
case ui::AX_ROLE_TABLE_HEADER_CONTAINER: |
- ia_role_ = ROLE_SYSTEM_GROUPING; |
- ia2_role_ = IA2_ROLE_SECTION; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_GROUPING; |
+ ia2_role = IA2_ROLE_SECTION; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_TAB_LIST: |
- ia_role_ = ROLE_SYSTEM_PAGETABLIST; |
+ ia_role = ROLE_SYSTEM_PAGETABLIST; |
break; |
case ui::AX_ROLE_TAB_PANEL: |
- ia_role_ = ROLE_SYSTEM_PROPERTYPAGE; |
+ ia_role = ROLE_SYSTEM_PROPERTYPAGE; |
break; |
case ui::AX_ROLE_TOGGLE_BUTTON: |
- ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
- ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; |
+ ia_role = ROLE_SYSTEM_PUSHBUTTON; |
+ ia2_role = IA2_ROLE_TOGGLE_BUTTON; |
break; |
case ui::AX_ROLE_TEXT_AREA: |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_state_ |= IA2_STATE_MULTI_LINE; |
- ia2_state_ |= IA2_STATE_EDITABLE; |
- ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_state |= IA2_STATE_MULTI_LINE; |
+ ia2_state |= IA2_STATE_EDITABLE; |
+ ia2_state |= IA2_STATE_SELECTABLE_TEXT; |
break; |
case ui::AX_ROLE_TEXT_FIELD: |
- ia_role_ = ROLE_SYSTEM_TEXT; |
- ia2_state_ |= IA2_STATE_SINGLE_LINE; |
- ia2_state_ |= IA2_STATE_EDITABLE; |
- ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; |
+ ia_role = ROLE_SYSTEM_TEXT; |
+ ia2_state |= IA2_STATE_SINGLE_LINE; |
+ ia2_state |= IA2_STATE_EDITABLE; |
+ ia2_state |= IA2_STATE_SELECTABLE_TEXT; |
break; |
case ui::AX_ROLE_TIME: |
- ia_role_ = ROLE_SYSTEM_SPINBUTTON; |
+ ia_role = ROLE_SYSTEM_SPINBUTTON; |
break; |
case ui::AX_ROLE_TIMER: |
- ia_role_ = ROLE_SYSTEM_CLOCK; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_CLOCK; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_TOOLBAR: |
- ia_role_ = ROLE_SYSTEM_TOOLBAR; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_TOOLBAR; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_TOOLTIP: |
- ia_role_ = ROLE_SYSTEM_TOOLTIP; |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_role = ROLE_SYSTEM_TOOLTIP; |
+ ia_state |= STATE_SYSTEM_READONLY; |
break; |
case ui::AX_ROLE_TREE: |
- ia_role_ = ROLE_SYSTEM_OUTLINE; |
+ ia_role = ROLE_SYSTEM_OUTLINE; |
break; |
case ui::AX_ROLE_TREE_GRID: |
- ia_role_ = ROLE_SYSTEM_OUTLINE; |
+ ia_role = ROLE_SYSTEM_OUTLINE; |
break; |
case ui::AX_ROLE_TREE_ITEM: |
- ia_role_ = ROLE_SYSTEM_OUTLINEITEM; |
+ ia_role = ROLE_SYSTEM_OUTLINEITEM; |
break; |
case ui::AX_ROLE_LINE_BREAK: |
- ia_role_ = ROLE_SYSTEM_WHITESPACE; |
+ ia_role = ROLE_SYSTEM_WHITESPACE; |
break; |
case ui::AX_ROLE_WINDOW: |
- ia_role_ = ROLE_SYSTEM_WINDOW; |
+ ia_role = ROLE_SYSTEM_WINDOW; |
break; |
// TODO(dmazzoni): figure out the proper MSAA role for all of these. |
@@ -3871,7 +4023,7 @@ void BrowserAccessibilityWin::InitRoleAndState() { |
case ui::AX_ROLE_PRESENTATIONAL: |
case ui::AX_ROLE_SLIDER_THUMB: |
default: |
- ia_role_ = ROLE_SYSTEM_CLIENT; |
+ ia_role = ROLE_SYSTEM_CLIENT; |
break; |
} |
@@ -3882,21 +4034,27 @@ void BrowserAccessibilityWin::InitRoleAndState() { |
// We clear the READONLY state on focusable controls and on a document. |
// Everything else, the majority of objects, do not have this state set. |
if (HasState(ui::AX_STATE_FOCUSABLE) && |
- ia_role_ != ROLE_SYSTEM_DOCUMENT) { |
- ia_state_ &= ~(STATE_SYSTEM_READONLY); |
+ ia_role != ROLE_SYSTEM_DOCUMENT) { |
+ ia_state &= ~(STATE_SYSTEM_READONLY); |
} |
if (!HasState(ui::AX_STATE_READ_ONLY)) |
- ia_state_ &= ~(STATE_SYSTEM_READONLY); |
+ ia_state &= ~(STATE_SYSTEM_READONLY); |
if (GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) |
- ia_state_ |= STATE_SYSTEM_READONLY; |
+ ia_state |= STATE_SYSTEM_READONLY; |
// The role should always be set. |
- DCHECK(!role_name_.empty() || ia_role_); |
+ DCHECK(!role_name.empty() || ia_role); |
// If we didn't explicitly set the IAccessible2 role, make it the same |
// as the MSAA role. |
- if (!ia2_role_) |
- ia2_role_ = ia_role_; |
+ if (!ia2_role) |
+ ia2_role = ia_role; |
+ |
+ win_attributes_->ia_role = ia_role; |
+ win_attributes_->ia_state = ia_state; |
+ win_attributes_->role_name = role_name; |
+ win_attributes_->ia2_role = ia2_role; |
+ win_attributes_->ia2_state = ia2_state; |
} |
} // namespace content |