| 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..5bf31bd13c1573ddc0fcbefa265ffa910cb53069 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,21 @@ 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.
|
| + if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA &&
|
| + GetParent() &&
|
| + GetParent()->manager() != manager() &&
|
| + manager()->delegate()) {
|
| + manager()->delegate()->AccessibilityTransformToRootCoordSpace(&bounds);
|
| + return bounds;
|
| + } else if (GetData().transform.get() &&
|
| + !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 +901,16 @@ 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();
|
| +
|
| + bool parent_transform_is_identity = !parent->GetData().transform.get() ||
|
| + parent->GetData().transform->IsIdentity();
|
| +
|
| if (need_to_offset_web_area &&
|
| parent->GetLocation().width() > 0 &&
|
| - parent->GetLocation().height() > 0) {
|
| + parent->GetLocation().height() > 0 &&
|
| + parent_transform_is_identity &&
|
| + !parent_is_in_different_tree) {
|
| bounds.Offset(parent->GetLocation().x(), parent->GetLocation().y());
|
| need_to_offset_web_area = false;
|
| }
|
| @@ -908,7 +931,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_transform_is_identity) {
|
| + 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();
|
| }
|
|
|
|
|