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

Unified Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 1952863003: Implemented the "aria-current" state on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed switch statements to handle NONE case. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/accessibility/dump_accessibility_tree_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 73f13ecfa8a42f248725a85d6674e9b935658080..974cc1fe3dec54dfe093e9196d2dad191e3902e1 100644
--- a/content/browser/accessibility/browser_accessibility_win.cc
+++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -3381,6 +3381,36 @@ void BrowserAccessibilityWin::UpdateStep1ComputeWinAttributes() {
win_attributes_->ia2_attributes.push_back(L"explicit-name:true");
}
+ // Expose the aria-current attribute.
+ int32_t aria_current_state;
+ if (GetIntAttribute(ui::AX_ATTR_ARIA_CURRENT_STATE, &aria_current_state)) {
+ switch (static_cast<ui::AXAriaCurrentState>(aria_current_state)) {
+ case ui::AX_ARIA_CURRENT_STATE_NONE:
+ break;
+ case ui::AX_ARIA_CURRENT_STATE_FALSE:
+ win_attributes_->ia2_attributes.push_back(L"current:false");
+ break;
+ case ui::AX_ARIA_CURRENT_STATE_TRUE:
+ win_attributes_->ia2_attributes.push_back(L"current:true");
+ break;
+ case ui::AX_ARIA_CURRENT_STATE_PAGE:
+ win_attributes_->ia2_attributes.push_back(L"current:page");
+ break;
+ case ui::AX_ARIA_CURRENT_STATE_STEP:
+ win_attributes_->ia2_attributes.push_back(L"current:step");
+ break;
+ case ui::AX_ARIA_CURRENT_STATE_LOCATION:
+ win_attributes_->ia2_attributes.push_back(L"current:location");
+ break;
+ case ui::AX_ARIA_CURRENT_STATE_DATE:
+ win_attributes_->ia2_attributes.push_back(L"current:date");
+ break;
+ case ui::AX_ARIA_CURRENT_STATE_TIME:
+ win_attributes_->ia2_attributes.push_back(L"current:time");
+ break;
+ }
+ }
+
// Expose table cell index.
if (IsCellOrTableHeaderRole()) {
BrowserAccessibility* table = GetParent();
@@ -3403,7 +3433,9 @@ void BrowserAccessibilityWin::UpdateStep1ComputeWinAttributes() {
if ((ia_role() == ROLE_SYSTEM_COLUMNHEADER ||
ia_role() == ROLE_SYSTEM_ROWHEADER) &&
GetIntAttribute(ui::AX_ATTR_SORT_DIRECTION, &sort_direction)) {
- switch (sort_direction) {
+ switch (static_cast<ui::AXSortDirection>(sort_direction)) {
+ case ui::AX_SORT_DIRECTION_NONE:
+ break;
case ui::AX_SORT_DIRECTION_UNSORTED:
win_attributes_->ia2_attributes.push_back(L"sort:none");
break;
@@ -3416,8 +3448,6 @@ void BrowserAccessibilityWin::UpdateStep1ComputeWinAttributes() {
case ui::AX_SORT_DIRECTION_OTHER:
win_attributes_->ia2_attributes.push_back(L"sort:other");
break;
- default:
- NOTREACHED();
}
}
@@ -3740,8 +3770,6 @@ std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes()
}
break;
}
- default:
- NOTREACHED();
}
base::string16 language(GetInheritedString16Attribute(ui::AX_ATTR_LANGUAGE));
@@ -3786,8 +3814,6 @@ std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes()
// Not listed in the IA2 Spec.
attributes.push_back(L"writing-mode:bt");
break;
- default:
- NOTREACHED();
}
return attributes;
@@ -4231,9 +4257,8 @@ ui::TextBoundaryType BrowserAccessibilityWin::IA2TextBoundaryToTextBoundary(
return ui::PARAGRAPH_BOUNDARY;
case IA2_TEXT_BOUNDARY_ALL:
return ui::ALL_BOUNDARY;
- default:
- NOTREACHED();
}
+ NOTREACHED();
return ui::CHAR_BOUNDARY;
}
@@ -4278,8 +4303,6 @@ LONG BrowserAccessibilityWin::FindStartOfStyle(
return text_length;
return static_cast<LONG>(iterator->first);
}
- default:
- NOTREACHED();
}
return start_offset;
« no previous file with comments | « no previous file | content/browser/accessibility/dump_accessibility_tree_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698