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 |