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

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

Issue 849143003: Fix focus and bounds calculations for guest frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 fb533aa85e5380b9a514b1228376785251dd4b0d..846936f3298c3eb3866464cf21f299187f25ec1c 100644
--- a/content/browser/accessibility/browser_accessibility.cc
+++ b/content/browser/accessibility/browser_accessibility.cc
@@ -183,7 +183,7 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() const {
// 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 = GetParent();
+ BrowserAccessibility* parent = GetParentForBoundsCalculation();
bool need_to_offset_web_area =
(GetRole() == ui::AX_ROLE_WEB_AREA ||
GetRole() == ui::AX_ROLE_ROOT_WEB_AREA);
@@ -212,7 +212,7 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() const {
}
need_to_offset_web_area = true;
}
- parent = parent->GetParent();
+ parent = parent->GetParentForBoundsCalculation();
}
return bounds;
@@ -716,4 +716,23 @@ int BrowserAccessibility::GetStaticTextLenRecursive() const {
return len;
}
+BrowserAccessibility* BrowserAccessibility::GetParentForBoundsCalculation()
+ const {
+ if (!node_ || !manager_)
+ return NULL;
+ ui::AXNode* parent = node_->parent();
+ if (parent)
+ return manager_->GetFromAXNode(parent);
+
+ if (!manager_->delegate())
+ return NULL;
+
+ BrowserAccessibility* host_node =
+ manager_->delegate()->AccessibilityGetParentFrame();
+ if (!host_node)
+ return NULL;
aboxhall 2015/01/15 05:08:25 Totally fine if you want to leave it this way, but
dmazzoni 2015/01/15 21:02:33 Great observation. Simplified.
+
+ return host_node;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698