Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility.cc |
| diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc |
| index b50a47662f01504097641479285641aa058f995c..c71cee6800c01d3a195114d854082d59b2ff8114 100644 |
| --- a/content/browser/accessibility/browser_accessibility.cc |
| +++ b/content/browser/accessibility/browser_accessibility.cc |
| @@ -188,6 +188,7 @@ BrowserAccessibility::GetHtmlAttributes() const { |
| gfx::Rect BrowserAccessibility::GetLocalBoundsRect() const { |
| gfx::Rect bounds = GetLocation(); |
| + FixEmptyBounds(&bounds); |
| return ElementBoundsToLocalBounds(bounds); |
| } |
| @@ -695,6 +696,21 @@ BrowserAccessibility* BrowserAccessibility::GetParentForBoundsCalculation() |
| return manager_->delegate()->AccessibilityGetParentFrame(); |
| } |
| +void BrowserAccessibility::FixEmptyBounds(gfx::Rect* bounds) const |
| +{ |
| + if (bounds->width() > 0 && bounds->height() > 0) |
| + return; |
| + |
| + for (size_t i = 0; i < InternalChildCount(); ++i) { |
| + BrowserAccessibility* child = InternalGetChild(i); |
| + gfx::Rect child_bounds = child->GetLocalBoundsRect(); |
| + if (bounds->width() > 0 && bounds->height() > 0) |
| + bounds->Union(child_bounds); |
| + else |
|
David Tseng
2015/06/22 21:29:36
I'm confused why you have this branch at all?
dmazzoni
2015/06/23 05:36:42
If the width and height are already nonzero the fu
David Tseng
2015/06/23 18:27:53
So, you're assuming child's height and width are n
dmazzoni
2015/06/23 23:37:11
OK, I made this more explicit and added a comment.
|
| + *bounds = child_bounds; |
| + } |
| +} |
| + |
| gfx::Rect BrowserAccessibility::ElementBoundsToLocalBounds(gfx::Rect bounds) |
| const { |
| // Walk up the parent chain. Every time we encounter a Web Area, offset |