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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 10808083: gesture recognizer: Expose bounding-box for the points in a gesture-event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/web_input_event_aurax11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 return new LocalGestureEvent(m_hWnd, details, location, flags, time,
1291 return new LocalGestureEvent(m_hWnd, details.type(), location, flags, time, 1299 touch_id_bitfield);
1292 details.generic_x(), details.generic_y(), touch_id_bitfield);
1293 } 1300 }
1294 1301
1295 ui::TouchEvent* RenderWidgetHostViewWin::CreateTouchEvent( 1302 ui::TouchEvent* RenderWidgetHostViewWin::CreateTouchEvent(
1296 ui::EventType type, 1303 ui::EventType type,
1297 const gfx::Point& location, 1304 const gfx::Point& location,
1298 int touch_id, 1305 int touch_id,
1299 base::TimeDelta time_stamp) { 1306 base::TimeDelta time_stamp) {
1300 return new LocalTouchEvent(type, location, touch_id, time_stamp); 1307 return new LocalTouchEvent(type, location, touch_id, time_stamp);
1301 } 1308 }
1302 1309
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 // receive a focus change in the context of a pointer down message, it means 3162 // 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 3163 // that the pointer down message occurred on the edit field and we should
3157 // display the on screen keyboard 3164 // display the on screen keyboard
3158 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) 3165 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_)
3159 DisplayOnScreenKeyboardIfNeeded(); 3166 DisplayOnScreenKeyboardIfNeeded();
3160 received_focus_change_after_pointer_down_ = false; 3167 received_focus_change_after_pointer_down_ = false;
3161 pointer_down_context_ = false; 3168 pointer_down_context_ = false;
3162 } 3169 }
3163 3170
3164 } // namespace content 3171 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/web_input_event_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698