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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1308553007: Convert MouseEvents from DIPS to Pixels before passing it to surfaces for hittesting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaning up Created 5 years, 2 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 | content/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 96cfc510dc14128fa6a06fa56334fd0c15fa7418..2ab4e5d2dbc8121cc0c8b44569ead4a28bc4ebd4 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -80,6 +80,7 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_profile.h"
#include "ui/gfx/display.h"
+#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/screen.h"
@@ -2167,8 +2168,15 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
uint32_t RenderWidgetHostViewAura::SurfaceIdNamespaceAtPoint(
const gfx::Point& point,
gfx::Point* transformed_point) {
- cc::SurfaceId id =
- delegated_frame_host_->SurfaceIdAtPoint(point, transformed_point);
+ const gfx::Display display = window_ ?
sadrul 2015/10/21 21:46:21 When can |window_| be null here?
+ gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_) :
+ gfx::Screen::GetScreenFor(window_)->GetPrimaryDisplay();
+ float scale_factor = display.device_scale_factor();
sadrul 2015/10/21 21:46:21 How often do we have to do this? Would it make sen
+ gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point);
+ cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint(point_in_pixels,
+ transformed_point);
+ *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point);
+
// It is possible that the renderer has not yet produced a surface, in which
// case we return our current namespace.
if (id.is_null())
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698