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_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <peninputpanel_i.c> | 9 #include <peninputpanel_i.c> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 DCHECK(false) << "Unexpected ui type. " << t; | 393 DCHECK(false) << "Unexpected ui type. " << t; |
| 394 return WebKit::WebInputEvent::Undefined; | 394 return WebKit::WebInputEvent::Undefined; |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 class LocalGestureEvent : | 398 class LocalGestureEvent : |
| 399 public WrappedObject<ui::GestureEvent, WebKit::WebGestureEvent> { | 399 public WrappedObject<ui::GestureEvent, WebKit::WebGestureEvent> { |
| 400 public: | 400 public: |
| 401 LocalGestureEvent( | 401 LocalGestureEvent( |
| 402 HWND hwnd, | 402 HWND hwnd, |
| 403 ui::EventType type, | 403 const ui::GestureEventDetails& details, |
| 404 const gfx::Point& location, | 404 const gfx::Point& location, |
| 405 int flags, | 405 int flags, |
| 406 base::Time time, | 406 base::Time time, |
| 407 float param_first, | |
| 408 float param_second, | |
| 409 unsigned int touch_id_bitfield) | 407 unsigned int touch_id_bitfield) |
| 410 : touch_ids_bitfield_(touch_id_bitfield), | 408 : touch_ids_bitfield_(touch_id_bitfield), |
| 411 type_(type) { | 409 type_(details.type()) { |
| 412 // location is given in window coordinates, based on the parent window. | 410 // location is given in window coordinates, based on the parent window. |
| 413 // Map to the appropriate window's coordinates. For a root window the | 411 // Map to the appropriate window's coordinates. For a root window the |
| 414 // coordinates won't change, because the parent shares our rect. | 412 // coordinates won't change, because the parent shares our rect. |
| 415 POINT client_point = { location.x(), location.y()}; | 413 POINT client_point = { location.x(), location.y()}; |
| 416 MapWindowPoints(::GetParent(hwnd), hwnd, &client_point, 1); | 414 MapWindowPoints(::GetParent(hwnd), hwnd, &client_point, 1); |
| 417 POINT screen_point = { location.x(), location.y()}; | 415 POINT screen_point = { location.x(), location.y()}; |
| 418 MapWindowPoints(hwnd, HWND_DESKTOP, &screen_point, 1); | 416 MapWindowPoints(hwnd, HWND_DESKTOP, &screen_point, 1); |
| 419 data().x = client_point.x; | 417 data().x = client_point.x; |
| 420 data().y = client_point.y; | 418 data().y = client_point.y; |
| 421 data().globalX = screen_point.x; | 419 data().globalX = screen_point.x; |
| 422 data().globalY = screen_point.y; | 420 data().globalY = screen_point.y; |
| 423 data().deltaX = param_first; | 421 data().deltaX = details.generic_x(); |
| 424 data().deltaY = param_second; | 422 data().deltaY = details.generic_y(); |
| 425 data().type = ConvertToWebInputEvent(type); | 423 data().type = ConvertToWebInputEvent(type_); |
| 424 | |
| 425 // WebKit gesture events do not have bounding-boxes yet, and expect the data | |
| 426 // in deltaX/deltaY instead (and instead of bounding box, WebKit expects the | |
| 427 // radius). This is currently used only for tap events. So special case this | |
| 428 // particular case. | |
| 429 // http://crbug.com/138572 | |
| 430 if (type_ == ui::ET_GESTURE_TAP) { | |
| 431 data().deltaX = details.bounding_box().width() / 2; | |
| 432 data().deltaY = details.bounding_box().height() / 2; | |
| 433 } | |
| 426 } | 434 } |
| 427 | 435 |
| 428 virtual int GetLowestTouchId() const OVERRIDE { | 436 virtual int GetLowestTouchId() const OVERRIDE { |
| 429 return LowestBit(touch_ids_bitfield_); | 437 return LowestBit(touch_ids_bitfield_); |
| 430 } | 438 } |
| 431 | 439 |
| 432 ui::EventType type() { | 440 ui::EventType type() { |
| 433 return type_; | 441 return type_; |
| 434 } | 442 } |
| 435 | 443 |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 SetToGestureMode(); | 1288 SetToGestureMode(); |
| 1281 } | 1289 } |
| 1282 } | 1290 } |
| 1283 | 1291 |
| 1284 ui::GestureEvent* RenderWidgetHostViewWin::CreateGestureEvent( | 1292 ui::GestureEvent* RenderWidgetHostViewWin::CreateGestureEvent( |
| 1285 const ui::GestureEventDetails& details, | 1293 const ui::GestureEventDetails& details, |
| 1286 const gfx::Point& location, | 1294 const gfx::Point& location, |
| 1287 int flags, | 1295 int flags, |
| 1288 base::Time time, | 1296 base::Time time, |
| 1289 unsigned int touch_id_bitfield) { | 1297 unsigned int touch_id_bitfield) { |
| 1290 | 1298 |
|
sky
2012/07/23 22:33:47
nit: remove newline.
sadrul
2012/07/23 22:40:55
Done.
| |
| 1291 return new LocalGestureEvent(m_hWnd, details.type(), location, flags, time, | 1299 return new LocalGestureEvent(m_hWnd, details, location, flags, time, |
| 1292 details.generic_x(), details.generic_y(), touch_id_bitfield); | 1300 touch_id_bitfield); |
| 1293 } | 1301 } |
| 1294 | 1302 |
| 1295 ui::TouchEvent* RenderWidgetHostViewWin::CreateTouchEvent( | 1303 ui::TouchEvent* RenderWidgetHostViewWin::CreateTouchEvent( |
| 1296 ui::EventType type, | 1304 ui::EventType type, |
| 1297 const gfx::Point& location, | 1305 const gfx::Point& location, |
| 1298 int touch_id, | 1306 int touch_id, |
| 1299 base::TimeDelta time_stamp) { | 1307 base::TimeDelta time_stamp) { |
| 1300 return new LocalTouchEvent(type, location, touch_id, time_stamp); | 1308 return new LocalTouchEvent(type, location, touch_id, time_stamp); |
| 1301 } | 1309 } |
| 1302 | 1310 |
| (...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3155 // receive a focus change in the context of a pointer down message, it means | 3163 // receive a focus change in the context of a pointer down message, it means |
| 3156 // that the pointer down message occurred on the edit field and we should | 3164 // that the pointer down message occurred on the edit field and we should |
| 3157 // display the on screen keyboard | 3165 // display the on screen keyboard |
| 3158 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3166 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 3159 DisplayOnScreenKeyboardIfNeeded(); | 3167 DisplayOnScreenKeyboardIfNeeded(); |
| 3160 received_focus_change_after_pointer_down_ = false; | 3168 received_focus_change_after_pointer_down_ = false; |
| 3161 pointer_down_context_ = false; | 3169 pointer_down_context_ = false; |
| 3162 } | 3170 } |
| 3163 | 3171 |
| 3164 } // namespace content | 3172 } // namespace content |
| OLD | NEW |