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

Unified Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 2002693002: Automation API should use transforms for iframe coordinates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No dependencies Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/automation_internal_custom_bindings.cc
diff --git a/chrome/renderer/extensions/automation_internal_custom_bindings.cc b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
index e3ef183ec38ef5ac569029fa08acb618df3d31e4..11fd9e8726237cb448b2afd81e256989e5f42984 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -115,29 +115,31 @@ static gfx::Rect ComputeLocalNodeBounds(TreeCache* cache, ui::AXNode* node) {
// parent hierarchy to offset by frame offsets and scroll offsets.
static gfx::Rect ComputeGlobalNodeBounds(TreeCache* cache, ui::AXNode* node) {
gfx::Rect bounds = ComputeLocalNodeBounds(cache, node);
- ui::AXNode* parent = node->parent();
- bool need_to_offset_web_area = node->data().role == ui::AX_ROLE_WEB_AREA ||
- node->data().role == ui::AX_ROLE_ROOT_WEB_AREA;
- while (parent) {
- if (bounds.IsEmpty()) {
- bounds = parent->data().location;
- } else if (need_to_offset_web_area && parent->data().location.width() > 0 &&
- parent->data().location.height() > 0) {
- bounds.Offset(parent->data().location.x(), parent->data().location.y());
- need_to_offset_web_area = false;
- }
- if (parent->data().role == ui::AX_ROLE_WEB_AREA ||
- parent->data().role == ui::AX_ROLE_ROOT_WEB_AREA) {
+ ui::AXNode* root = cache->tree.root();
+ while (root) {
+ // Apply scroll offsets.
+ if (root != node) {
int sx = 0;
int sy = 0;
- if (parent->data().GetIntAttribute(ui::AX_ATTR_SCROLL_X, &sx) &&
- parent->data().GetIntAttribute(ui::AX_ATTR_SCROLL_Y, &sy)) {
+ if (root->data().GetIntAttribute(ui::AX_ATTR_SCROLL_X, &sx) &&
+ root->data().GetIntAttribute(ui::AX_ATTR_SCROLL_Y, &sy)) {
bounds.Offset(-sx, -sy);
}
- need_to_offset_web_area = true;
}
- parent = cache->owner->GetParent(parent, &cache);
+
+ if (root->data().transform) {
+ gfx::RectF boundsf(bounds);
+ root->data().transform->TransformRect(&boundsf);
+ bounds = gfx::Rect(boundsf.x(), boundsf.y(), boundsf.width(),
+ boundsf.height());
+ }
+
+ ui::AXNode* parent = cache->owner->GetParent(root, &cache);
+ if (!parent)
+ break;
+
+ root = cache->tree.root();
}
return bounds;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698