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

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

Issue 2372253003: Account for device scale factor in automation API bounding boxes. (Closed)
Patch Set: Created 4 years, 3 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 | « chrome/common/extensions/api/automation_api_constants.h ('k') | 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 225d68d4a01b6a150cdd15c93da95797a0ea6b17..221c166b9f8f63a27b781a7524c0c49ac5cefe25 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -13,6 +13,7 @@
#include "base/macros.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
+#include "chrome/common/extensions/api/automation_api_constants.h"
#include "chrome/common/extensions/chrome_extension_messages.h"
#include "chrome/common/extensions/manifest_handlers/automation.h"
#include "content/public/renderer/render_frame.h"
@@ -149,6 +150,17 @@ static gfx::Rect ComputeGlobalNodeBounds(TreeCache* cache,
node = container;
}
+ // All trees other than the desktop tree are scaled by the device
+ // scale factor. Unscale them so they're all in consistent units.
+ if (cache->tree_id != api::automation::kDesktopTreeID) {
+ float scale_factor = cache->owner->context()
+ ->GetRenderFrame()
+ ->GetRenderView()
+ ->GetDeviceScaleFactor();
+ if (scale_factor > 0)
+ bounds.Scale(1.0 / scale_factor);
+ }
+
return gfx::ToEnclosingRect(bounds);
}
« no previous file with comments | « chrome/common/extensions/api/automation_api_constants.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698