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 7bb165b62668ca110bd4bb4a272e67d45329ef66..19800057cde640977569e9fb5a5892a33c810a99 100644 |
| --- a/content/browser/accessibility/browser_accessibility.cc |
| +++ b/content/browser/accessibility/browser_accessibility.cc |
| @@ -15,6 +15,7 @@ |
| #include "content/browser/accessibility/browser_accessibility_manager.h" |
| #include "content/common/accessibility_messages.h" |
| #include "ui/accessibility/ax_text_utils.h" |
| +#include "ui/gfx/geometry/rect_f.h" |
| namespace content { |
| @@ -877,6 +878,20 @@ void BrowserAccessibility::FixEmptyBounds(gfx::Rect* bounds) const |
| gfx::Rect BrowserAccessibility::ElementBoundsToLocalBounds(gfx::Rect bounds) |
| const { |
| + // If this element has a transform, apply it and we're done. |
|
aboxhall
2016/02/24 19:38:21
Why is this true in the case where, e.g., the pare
|
| + if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && |
| + GetParent() && |
| + GetParent()->manager() != manager() && |
| + manager()->delegate()) { |
|
aboxhall
2016/02/24 18:46:07
When would this be false?
dmazzoni
2016/02/24 18:53:26
Only in unit tests
|
| + manager()->delegate()->AccessibilityTransformToRootCoordSpace(&bounds); |
| + return bounds; |
| + } else if (!GetData().transform.IsIdentity()) { |
| + gfx::RectF boundsf(bounds); |
| + GetData().transform.TransformRect(&boundsf); |
| + return gfx::Rect(boundsf.x(), boundsf.y(), |
| + boundsf.width(), boundsf.height()); |
| + } |
| + |
| // 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. |
| @@ -885,9 +900,13 @@ gfx::Rect BrowserAccessibility::ElementBoundsToLocalBounds(gfx::Rect bounds) |
| (GetRole() == ui::AX_ROLE_WEB_AREA || |
| GetRole() == ui::AX_ROLE_ROOT_WEB_AREA); |
| while (parent) { |
| + bool parent_is_in_different_tree = parent->manager() != manager(); |
| + |
| if (need_to_offset_web_area && |
| parent->GetLocation().width() > 0 && |
| - parent->GetLocation().height() > 0) { |
| + parent->GetLocation().height() > 0 && |
| + parent->GetData().transform.IsIdentity() && |
| + !parent_is_in_different_tree) { |
| bounds.Offset(parent->GetLocation().x(), parent->GetLocation().y()); |
| need_to_offset_web_area = false; |
| } |
| @@ -908,7 +927,19 @@ gfx::Rect BrowserAccessibility::ElementBoundsToLocalBounds(gfx::Rect bounds) |
| bounds.Offset(-sx, -sy); |
| } |
| need_to_offset_web_area = true; |
| + |
| + if (parent_is_in_different_tree && manager()->delegate()) { |
| + manager()->delegate()->AccessibilityTransformToRootCoordSpace(&bounds); |
| + break; |
| + } else if (!parent->GetData().transform.IsIdentity()) { |
| + gfx::RectF boundsf(bounds); |
| + parent->GetData().transform.TransformRect(&boundsf); |
| + bounds = gfx::Rect(boundsf.x(), boundsf.y(), |
| + boundsf.width(), boundsf.height()); |
| + need_to_offset_web_area = false; |
| + } |
| } |
| + |
| parent = parent->GetParent(); |
| } |