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

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

Issue 12084028: Fix accessibility coordinates within iframes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 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 857a1619baaf2014b565d74e6e5945fca36dd234..7484ced00aebba56d0efa40659abca817a94c3d2 100644
--- a/content/browser/accessibility/browser_accessibility.cc
+++ b/content/browser/accessibility/browser_accessibility.cc
@@ -133,15 +133,30 @@ BrowserAccessibility* BrowserAccessibility::GetNextSibling() {
gfx::Rect BrowserAccessibility::GetLocalBoundsRect() {
gfx::Rect bounds = location_;
- // Adjust top left position by the root document's scroll offset.
- BrowserAccessibility* root = manager_->GetRoot();
- int scroll_x = 0;
- int scroll_y = 0;
- if (!root->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_X, &scroll_x) ||
- !root->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_Y, &scroll_y)) {
- return bounds;
+ // Walk up the parent chain. Every time we encounter a Web Area, offset
+ // based on the scroll bars and then offset based on the origin of that
+ // nested web area.
+ BrowserAccessibility* parent = parent_;
+ bool need_to_offset_web_area =
aboxhall 2013/01/29 01:52:40 I don't completely follow this. Why do we need to
dmazzoni 2013/01/29 16:51:50 We need to offset the bounds of the first parent o
aboxhall 2013/01/29 17:43:26 So a WebArea will have its _own_ coordinates in te
dmazzoni 2013/01/29 18:51:25 Yeah, internally the tree looks something like: D
aboxhall 2013/01/29 19:53:47 Got it, thanks for the explanation.
+ (role_ == AccessibilityNodeData::ROLE_WEB_AREA);
+ while (parent) {
+ if (need_to_offset_web_area &&
+ parent->location().width() > 0 &&
+ parent->location().height() > 0) {
+ bounds.Offset(parent->location().x(), parent->location().y());
+ need_to_offset_web_area = false;
+ }
+ if (parent->role() == AccessibilityNodeData::ROLE_WEB_AREA) {
+ int sx = 0;
+ int sy = 0;
+ if (parent->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_X, &sx) &&
+ parent->GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_Y, &sy)) {
+ bounds.Offset(-sx, -sy);
+ }
+ need_to_offset_web_area = true;
+ }
+ parent = parent->parent();
}
- bounds.Offset(-scroll_x, -scroll_y);
return bounds;
}

Powered by Google App Engine
This is Rietveld 408576698