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

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

Issue 1198203002: Fix accessibility objects with zero width and height. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aria-owns-test
Patch Set: Created 5 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 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

Powered by Google App Engine
This is Rietveld 408576698