OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input/web_input_event_builders_win.h" | 5 #include "content/browser/renderer_host/input/web_input_event_builders_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
9 #include "ui/events/blink/blink_event_util.h" | 9 #include "ui/events/blink/blink_event_util.h" |
10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
11 #include "ui/gfx/win/dpi.h" | 11 #include "ui/gfx/screen_win.h" |
12 | 12 |
13 using blink::WebInputEvent; | 13 using blink::WebInputEvent; |
14 using blink::WebKeyboardEvent; | 14 using blink::WebKeyboardEvent; |
15 using blink::WebMouseEvent; | 15 using blink::WebMouseEvent; |
16 using blink::WebMouseWheelEvent; | 16 using blink::WebMouseWheelEvent; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 static const unsigned long kDefaultScrollLinesPerWheelDelta = 3; | 20 static const unsigned long kDefaultScrollLinesPerWheelDelta = 3; |
21 static const unsigned long kDefaultScrollCharsPerWheelDelta = 1; | 21 static const unsigned long kDefaultScrollCharsPerWheelDelta = 1; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 result.x = static_cast<short>(LOWORD(lparam)); | 157 result.x = static_cast<short>(LOWORD(lparam)); |
158 result.y = static_cast<short>(HIWORD(lparam)); | 158 result.y = static_cast<short>(HIWORD(lparam)); |
159 result.windowX = result.x; | 159 result.windowX = result.x; |
160 result.windowY = result.y; | 160 result.windowY = result.y; |
161 | 161 |
162 POINT global_point = { result.x, result.y }; | 162 POINT global_point = { result.x, result.y }; |
163 ClientToScreen(hwnd, &global_point); | 163 ClientToScreen(hwnd, &global_point); |
164 | 164 |
165 // We need to convert the global point back to DIP before using it. | 165 // We need to convert the global point back to DIP before using it. |
166 gfx::Point dip_global_point = gfx::win::ScreenToDIPPoint( | 166 gfx::Point dip_global_point = gfx::ScreenWin::ScreenToDIPPoint( |
167 gfx::Point(global_point.x, global_point.y)); | 167 gfx::Point(global_point.x, global_point.y)); |
168 | 168 |
169 result.globalX = dip_global_point.x(); | 169 result.globalX = dip_global_point.x(); |
170 result.globalY = dip_global_point.y(); | 170 result.globalY = dip_global_point.y(); |
171 | 171 |
172 // calculate number of clicks: | 172 // calculate number of clicks: |
173 | 173 |
174 // This differs slightly from the WebKit code in WebKit/win/WebView.cpp | 174 // This differs slightly from the WebKit code in WebKit/win/WebView.cpp |
175 // where their original code looks buggy. | 175 // where their original code looks buggy. |
176 static int last_click_position_x; | 176 static int last_click_position_x; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 result.wheelTicksX = wheel_delta; | 358 result.wheelTicksX = wheel_delta; |
359 } else { | 359 } else { |
360 result.deltaY = scroll_delta; | 360 result.deltaY = scroll_delta; |
361 result.wheelTicksY = wheel_delta; | 361 result.wheelTicksY = wheel_delta; |
362 } | 362 } |
363 | 363 |
364 return result; | 364 return result; |
365 } | 365 } |
366 | 366 |
367 } // namespace content | 367 } // namespace content |
OLD | NEW |