Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 #include "ui/compositor/compositor_vsync_manager.h" | 73 #include "ui/compositor/compositor_vsync_manager.h" |
| 74 #include "ui/compositor/dip_util.h" | 74 #include "ui/compositor/dip_util.h" |
| 75 #include "ui/events/blink/blink_event_util.h" | 75 #include "ui/events/blink/blink_event_util.h" |
| 76 #include "ui/events/event.h" | 76 #include "ui/events/event.h" |
| 77 #include "ui/events/event_utils.h" | 77 #include "ui/events/event_utils.h" |
| 78 #include "ui/events/gesture_detection/gesture_configuration.h" | 78 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 79 #include "ui/events/gestures/gesture_recognizer.h" | 79 #include "ui/events/gestures/gesture_recognizer.h" |
| 80 #include "ui/gfx/canvas.h" | 80 #include "ui/gfx/canvas.h" |
| 81 #include "ui/gfx/color_profile.h" | 81 #include "ui/gfx/color_profile.h" |
| 82 #include "ui/gfx/display.h" | 82 #include "ui/gfx/display.h" |
| 83 #include "ui/gfx/geometry/dip_util.h" | |
| 83 #include "ui/gfx/geometry/rect_conversions.h" | 84 #include "ui/gfx/geometry/rect_conversions.h" |
| 84 #include "ui/gfx/geometry/size_conversions.h" | 85 #include "ui/gfx/geometry/size_conversions.h" |
| 85 #include "ui/gfx/screen.h" | 86 #include "ui/gfx/screen.h" |
| 86 #include "ui/gfx/skia_util.h" | 87 #include "ui/gfx/skia_util.h" |
| 87 #include "ui/touch_selection/touch_selection_controller.h" | 88 #include "ui/touch_selection/touch_selection_controller.h" |
| 88 #include "ui/wm/public/activation_client.h" | 89 #include "ui/wm/public/activation_client.h" |
| 89 #include "ui/wm/public/scoped_tooltip_disabler.h" | 90 #include "ui/wm/public/scoped_tooltip_disabler.h" |
| 90 #include "ui/wm/public/tooltip_client.h" | 91 #include "ui/wm/public/tooltip_client.h" |
| 91 #include "ui/wm/public/transient_window_client.h" | 92 #include "ui/wm/public/transient_window_client.h" |
| 92 #include "ui/wm/public/window_types.h" | 93 #include "ui/wm/public/window_types.h" |
| (...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2160 window_->parent()->delegate()->OnMouseEvent(event); | 2161 window_->parent()->delegate()->OnMouseEvent(event); |
| 2161 } | 2162 } |
| 2162 | 2163 |
| 2163 if (!IsXButtonUpEvent(event)) | 2164 if (!IsXButtonUpEvent(event)) |
| 2164 event->SetHandled(); | 2165 event->SetHandled(); |
| 2165 } | 2166 } |
| 2166 | 2167 |
| 2167 uint32_t RenderWidgetHostViewAura::SurfaceIdNamespaceAtPoint( | 2168 uint32_t RenderWidgetHostViewAura::SurfaceIdNamespaceAtPoint( |
| 2168 const gfx::Point& point, | 2169 const gfx::Point& point, |
| 2169 gfx::Point* transformed_point) { | 2170 gfx::Point* transformed_point) { |
| 2170 cc::SurfaceId id = | 2171 const gfx::Display display = window_ ? |
|
sadrul
2015/10/21 21:46:21
When can |window_| be null here?
| |
| 2171 delegated_frame_host_->SurfaceIdAtPoint(point, transformed_point); | 2172 gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_) : |
| 2173 gfx::Screen::GetScreenFor(window_)->GetPrimaryDisplay(); | |
| 2174 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
| |
| 2175 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); | |
| 2176 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint(point_in_pixels, | |
| 2177 transformed_point); | |
| 2178 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point); | |
| 2179 | |
| 2172 // It is possible that the renderer has not yet produced a surface, in which | 2180 // It is possible that the renderer has not yet produced a surface, in which |
| 2173 // case we return our current namespace. | 2181 // case we return our current namespace. |
| 2174 if (id.is_null()) | 2182 if (id.is_null()) |
| 2175 return GetSurfaceIdNamespace(); | 2183 return GetSurfaceIdNamespace(); |
| 2176 return cc::SurfaceIdAllocator::NamespaceForId(id); | 2184 return cc::SurfaceIdAllocator::NamespaceForId(id); |
| 2177 } | 2185 } |
| 2178 | 2186 |
| 2179 void RenderWidgetHostViewAura::ProcessMouseEvent( | 2187 void RenderWidgetHostViewAura::ProcessMouseEvent( |
| 2180 const blink::WebMouseEvent& event) { | 2188 const blink::WebMouseEvent& event) { |
| 2181 host_->ForwardMouseEvent(event); | 2189 host_->ForwardMouseEvent(event); |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2884 | 2892 |
| 2885 //////////////////////////////////////////////////////////////////////////////// | 2893 //////////////////////////////////////////////////////////////////////////////// |
| 2886 // RenderWidgetHostViewBase, public: | 2894 // RenderWidgetHostViewBase, public: |
| 2887 | 2895 |
| 2888 // static | 2896 // static |
| 2889 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2897 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2890 GetScreenInfoForWindow(results, NULL); | 2898 GetScreenInfoForWindow(results, NULL); |
| 2891 } | 2899 } |
| 2892 | 2900 |
| 2893 } // namespace content | 2901 } // namespace content |
| OLD | NEW |