summaryrefslogtreecommitdiffstats
path: root/content/browser/accessibility/browser_accessibility.cc
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-04 23:32:20 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-04 23:32:20 +0000
commit10760e4acd398a047a25284b308134760ce2c0c6 (patch)
tree7131003922c3befdd30d761cda668572bd7387bb /content/browser/accessibility/browser_accessibility.cc
parentfa94127695795ba1b35953a88d829e4381e78e7b (diff)
downloadchromium_src-10760e4acd398a047a25284b308134760ce2c0c6.zip
chromium_src-10760e4acd398a047a25284b308134760ce2c0c6.tar.gz
chromium_src-10760e4acd398a047a25284b308134760ce2c0c6.tar.bz2
Use Blink accessibility enums in Chromium
This is a refactoring-only change! Eliminates enums for accessibility roles, states, and notifications and uses equivalent enums from Blink instead. Saves several giant switch statements, saves a few characters per line, and makes future changes to roles and states simpler. Another benefit is that you can search for a role, state, or event and find all of the places where it's used throughout the code at once. Also renames WebAccessibilityObject -> WebAXObject and notification -> event in the context of accessibility. BUG=269034 Review URL: https://chromiumcodereview.appspot.com/23651003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/accessibility/browser_accessibility.cc')
-rw-r--r--content/browser/accessibility/browser_accessibility.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc
index 37217c7..e039cc7 100644
--- a/content/browser/accessibility/browser_accessibility.cc
+++ b/content/browser/accessibility/browser_accessibility.cc
@@ -142,8 +142,8 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() const {
// nested web area.
BrowserAccessibility* parent = parent_;
bool need_to_offset_web_area =
- (role_ == AccessibilityNodeData::ROLE_WEB_AREA ||
- role_ == AccessibilityNodeData::ROLE_ROOT_WEB_AREA);
+ (role_ == WebKit::WebAXRoleWebArea ||
+ role_ == WebKit::WebAXRoleRootWebArea);
while (parent) {
if (need_to_offset_web_area &&
parent->location().width() > 0 &&
@@ -154,13 +154,13 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() const {
// On some platforms, we don't want to take the root scroll offsets
// into account.
- if (parent->role() == AccessibilityNodeData::ROLE_ROOT_WEB_AREA &&
+ if (parent->role() == WebKit::WebAXRoleRootWebArea &&
!manager()->UseRootScrollOffsetsWhenComputingBounds()) {
break;
}
- if (parent->role() == AccessibilityNodeData::ROLE_WEB_AREA ||
- parent->role() == AccessibilityNodeData::ROLE_ROOT_WEB_AREA) {
+ if (parent->role() == WebKit::WebAXRoleWebArea ||
+ parent->role() == WebKit::WebAXRoleRootWebArea) {
int sx = 0;
int sy = 0;
if (parent->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_X, &sx) &&
@@ -211,7 +211,7 @@ void BrowserAccessibility::Destroy() {
PostInitialize();
manager_->NotifyAccessibilityEvent(
- AccessibilityNotificationObjectHide, this);
+ WebKit::WebAXEventHide, this);
instance_active_ = false;
manager_->RemoveNode(this);
@@ -456,25 +456,24 @@ bool BrowserAccessibility::GetAriaTristate(
return false; // Not set
}
-bool BrowserAccessibility::HasState(
- AccessibilityNodeData::State state_enum) const {
+bool BrowserAccessibility::HasState(WebKit::WebAXState state_enum) const {
return (state_ >> state_enum) & 1;
}
bool BrowserAccessibility::IsEditableText() const {
// These roles don't have readonly set, but they're not editable text.
- if (role_ == AccessibilityNodeData::ROLE_SCROLLAREA ||
- role_ == AccessibilityNodeData::ROLE_COLUMN ||
- role_ == AccessibilityNodeData::ROLE_TABLE_HEADER_CONTAINER) {
+ if (role_ == WebKit::WebAXRoleScrollArea ||
+ role_ == WebKit::WebAXRoleColumn ||
+ role_ == WebKit::WebAXRoleTableHeaderContainer) {
return false;
}
- // Note: STATE_READONLY being false means it's either a text control,
+ // Note: WebAXStateReadonly being false means it's either a text control,
// or contenteditable. We also check for editable text roles to cover
// another element that has role=textbox set on it.
- return (!HasState(AccessibilityNodeData::STATE_READONLY) ||
- role_ == AccessibilityNodeData::ROLE_TEXT_FIELD ||
- role_ == AccessibilityNodeData::ROLE_TEXTAREA);
+ return (!HasState(WebKit::WebAXStateReadonly) ||
+ role_ == WebKit::WebAXRoleTextField ||
+ role_ == WebKit::WebAXRoleTextArea);
}
std::string BrowserAccessibility::GetTextRecursive() const {