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

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

Issue 15741009: Native Android accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address most reviewer feedback Created 7 years, 6 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
Index: content/browser/accessibility/browser_accessibility.cc
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc
index fcfd3655a8a6380c8e73c5453e4768e28f8c8e85..e904b6b3f5409cbcfdf70abf2ffa885061f0964e 100644
--- a/content/browser/accessibility/browser_accessibility.cc
+++ b/content/browser/accessibility/browser_accessibility.cc
@@ -19,7 +19,8 @@ typedef AccessibilityNodeData::StringAttribute StringAttribute;
#if !defined(OS_MACOSX) && \
!defined(OS_WIN) && \
- !defined(TOOLKIT_GTK)
+ !defined(TOOLKIT_GTK) && \
+ !defined(OS_ANDROID)
// We have subclassess of BrowserAccessibility on Mac, Linux/GTK,
// and Win. For any other platform, instantiate the base class.
// static
@@ -112,7 +113,7 @@ bool BrowserAccessibility::IsDescendantOf(
return false;
}
-BrowserAccessibility* BrowserAccessibility::GetChild(uint32 child_index) {
+BrowserAccessibility* BrowserAccessibility::GetChild(uint32 child_index) const {
DCHECK(child_index < children_.size());
return children_[child_index];
}
@@ -134,7 +135,7 @@ BrowserAccessibility* BrowserAccessibility::GetNextSibling() {
return NULL;
}
-gfx::Rect BrowserAccessibility::GetLocalBoundsRect() {
+gfx::Rect BrowserAccessibility::GetLocalBoundsRect() const {
gfx::Rect bounds = location_;
// Walk up the parent chain. Every time we encounter a Web Area, offset
@@ -151,6 +152,14 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() {
bounds.Offset(parent->location().x(), parent->location().y());
need_to_offset_web_area = false;
}
+
+ // On some platforms, we don't want to take the root scroll offsets
+ // into account.
+ if (parent->role() == AccessibilityNodeData::ROLE_ROOT_WEB_AREA &&
+ !manager()->UseRootScrollOffsetsWhenComputingBounds()) {
+ break;
+ }
+
if (parent->role() == AccessibilityNodeData::ROLE_WEB_AREA ||
parent->role() == AccessibilityNodeData::ROLE_ROOT_WEB_AREA) {
int sx = 0;
@@ -167,7 +176,7 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() {
return bounds;
}
-gfx::Rect BrowserAccessibility::GetGlobalBoundsRect() {
+gfx::Rect BrowserAccessibility::GetGlobalBoundsRect() const {
gfx::Rect bounds = GetLocalBoundsRect();
// Adjust the bounds by the top left corner of the containing view's bounds
@@ -303,6 +312,13 @@ bool BrowserAccessibility::HasState(
}
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) {
+ return false;
+ }
+
// Note: STATE_READONLY 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.

Powered by Google App Engine
This is Rietveld 408576698