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 <peninputpanel_i.c> | 8 #include <peninputpanel_i.c> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 using ui::ViewProp; | 74 using ui::ViewProp; |
75 using WebKit::WebInputEvent; | 75 using WebKit::WebInputEvent; |
76 using WebKit::WebInputEventFactory; | 76 using WebKit::WebInputEventFactory; |
77 using WebKit::WebMouseEvent; | 77 using WebKit::WebMouseEvent; |
78 using WebKit::WebTextDirection; | 78 using WebKit::WebTextDirection; |
79 using webkit::npapi::WebPluginGeometry; | 79 using webkit::npapi::WebPluginGeometry; |
80 | 80 |
81 const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND"; | 81 const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND"; |
82 | 82 |
83 namespace { | 83 namespace { |
84 | |
85 // Tooltips will wrap after this width. Yes, wrap. Imagine that! | 84 // Tooltips will wrap after this width. Yes, wrap. Imagine that! |
86 const int kTooltipMaxWidthPixels = 300; | 85 const int kTooltipMaxWidthPixels = 300; |
87 | 86 |
88 // Maximum number of characters we allow in a tooltip. | 87 // Maximum number of characters we allow in a tooltip. |
89 const int kMaxTooltipLength = 1024; | 88 const int kMaxTooltipLength = 1024; |
90 | 89 |
91 // A custom MSAA object id used to determine if a screen reader is actively | 90 // A custom MSAA object id used to determine if a screen reader is actively |
92 // listening for MSAA events. | 91 // listening for MSAA events. |
93 const int kIdCustom = 1; | 92 const int kIdCustom = 1; |
94 | 93 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 static const int kTouchMask = 0x7; | 297 static const int kTouchMask = 0x7; |
299 | 298 |
300 inline int GetTouchType(const TOUCHINPUT& point) { | 299 inline int GetTouchType(const TOUCHINPUT& point) { |
301 return point.dwFlags & kTouchMask; | 300 return point.dwFlags & kTouchMask; |
302 } | 301 } |
303 | 302 |
304 inline void SetTouchType(TOUCHINPUT* point, int type) { | 303 inline void SetTouchType(TOUCHINPUT* point, int type) { |
305 point->dwFlags = (point->dwFlags & kTouchMask) | type; | 304 point->dwFlags = (point->dwFlags & kTouchMask) | type; |
306 } | 305 } |
307 | 306 |
| 307 template <class IINTERFACE, class PAYLOAD> |
| 308 class WrappedObject : public IINTERFACE { |
| 309 public: |
| 310 WrappedObject() { |
| 311 } |
| 312 WrappedObject(const PAYLOAD ©) |
| 313 : data_(copy) { |
| 314 } |
| 315 const PAYLOAD& data() const { |
| 316 return data_; |
| 317 } |
| 318 PAYLOAD& data() { |
| 319 return data_; |
| 320 } |
| 321 |
| 322 private: |
| 323 PAYLOAD data_; |
| 324 |
| 325 typedef WrappedObject<IINTERFACE,PAYLOAD> Type; |
| 326 DISALLOW_COPY_AND_ASSIGN(Type); |
| 327 }; |
| 328 |
| 329 ui::EventType ConvertToUIEvent(WebKit::WebTouchPoint::State t) { |
| 330 switch (t) { |
| 331 case WebKit::WebTouchPoint::StatePressed: |
| 332 return ui::ET_TOUCH_PRESSED; |
| 333 case WebKit::WebTouchPoint::StateMoved: |
| 334 return ui::ET_TOUCH_MOVED; |
| 335 case WebKit::WebTouchPoint::StateStationary: |
| 336 return ui::ET_TOUCH_STATIONARY; |
| 337 case WebKit::WebTouchPoint::StateReleased: |
| 338 return ui::ET_TOUCH_RELEASED; |
| 339 case WebKit::WebTouchPoint::StateCancelled: |
| 340 return ui::ET_TOUCH_CANCELLED; |
| 341 default: |
| 342 DCHECK(false) << "Unexpected ui type. " << t; |
| 343 return ui::ET_UNKNOWN; |
| 344 } |
| 345 } |
| 346 |
| 347 WebKit::WebInputEvent::Type ConvertToWebInputEvent(ui::EventType t) { |
| 348 switch (t) { |
| 349 case ui::ET_UNKNOWN: |
| 350 return WebKit::WebInputEvent::Undefined; |
| 351 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 352 return WebKit::WebGestureEvent::GestureScrollBegin; |
| 353 case ui::ET_GESTURE_SCROLL_END: |
| 354 return WebKit::WebGestureEvent::GestureScrollEnd; |
| 355 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 356 return WebKit::WebGestureEvent::GestureScrollUpdate; |
| 357 case ui::ET_SCROLL_FLING_START: |
| 358 // TODO: Confirm that ui and webkit agree on fling api. |
| 359 return WebKit::WebGestureEvent::GestureFlingStart; |
| 360 case ui::ET_SCROLL_FLING_CANCEL: |
| 361 // TODO: Confirm that ui and webkit agree on fling api. |
| 362 return WebKit::WebGestureEvent::GestureFlingCancel; |
| 363 case ui::ET_GESTURE_TAP: |
| 364 return WebKit::WebGestureEvent::GestureTap; |
| 365 case ui::ET_GESTURE_TAP_DOWN: |
| 366 return WebKit::WebGestureEvent::GestureTapDown; |
| 367 case ui::ET_GESTURE_DOUBLE_TAP: |
| 368 return WebKit::WebGestureEvent::GestureDoubleTap; |
| 369 case ui::ET_GESTURE_LONG_PRESS: |
| 370 return WebKit::WebGestureEvent::GestureLongPress; |
| 371 case ui::ET_GESTURE_PINCH_BEGIN: |
| 372 return WebKit::WebGestureEvent::GesturePinchBegin; |
| 373 case ui::ET_GESTURE_PINCH_END: |
| 374 return WebKit::WebGestureEvent::GesturePinchEnd; |
| 375 case ui::ET_GESTURE_PINCH_UPDATE: |
| 376 return WebKit::WebGestureEvent::GesturePinchUpdate; |
| 377 case ui::ET_TOUCH_PRESSED: |
| 378 return WebKit::WebInputEvent::TouchStart; |
| 379 case ui::ET_TOUCH_MOVED: |
| 380 case ui::ET_TOUCH_STATIONARY: |
| 381 return WebKit::WebInputEvent::TouchMove; |
| 382 case ui::ET_TOUCH_RELEASED: |
| 383 return WebKit::WebInputEvent::TouchEnd; |
| 384 case ui::ET_TOUCH_CANCELLED: |
| 385 return WebKit::WebInputEvent::TouchCancel; |
| 386 default: |
| 387 DCHECK(false) << "Unexpected ui type. " << t; |
| 388 return WebKit::WebInputEvent::Undefined; |
| 389 } |
| 390 } |
| 391 |
| 392 class LocalGestureEvent : |
| 393 public WrappedObject<ui::GestureEvent, WebKit::WebGestureEvent> { |
| 394 public: |
| 395 LocalGestureEvent( |
| 396 ui::EventType type, |
| 397 const gfx::Point& location, |
| 398 int flags, |
| 399 base::Time time, |
| 400 float param_first, |
| 401 float param_second, |
| 402 unsigned int touch_id_bitfield) |
| 403 : touch_ids_bitfield_(touch_id_bitfield), |
| 404 type_(type) { |
| 405 data().x = location.x(); |
| 406 data().y = location.y(); |
| 407 data().deltaX = param_first; |
| 408 data().deltaY = param_second; |
| 409 data().type = ConvertToWebInputEvent(type); |
| 410 } |
| 411 |
| 412 virtual int GetLowestTouchId() const OVERRIDE { |
| 413 return LowestBit(touch_ids_bitfield_); |
| 414 } |
| 415 |
| 416 ui::EventType type() { |
| 417 return type_; |
| 418 } |
| 419 |
| 420 private: |
| 421 // The set of indices of ones in the binary representation of |
| 422 // |touch_ids_bitfield_| is the set of touch_ids associate with this gesture. |
| 423 // This value is stored as a bitfield because the number of touch ids varies, |
| 424 // but we currently don't need more than 32 touches at a time. |
| 425 const unsigned int touch_ids_bitfield_; |
| 426 |
| 427 ui::EventType type_; |
| 428 |
| 429 DISALLOW_COPY_AND_ASSIGN(LocalGestureEvent); |
| 430 }; |
| 431 |
| 432 class LocalTouchEvent : |
| 433 public WrappedObject<ui::TouchEvent, WebKit::WebTouchEvent> { |
| 434 public: |
| 435 LocalTouchEvent() : index_(0) {} |
| 436 LocalTouchEvent( |
| 437 ui::EventType type, |
| 438 const gfx::Point& location, |
| 439 int touch_id, |
| 440 base::TimeDelta time_stamp) : |
| 441 index_(0) { |
| 442 data().type = ConvertToWebInputEvent(type); |
| 443 data().timeStampSeconds = time_stamp.InSecondsF(); |
| 444 } |
| 445 |
| 446 LocalTouchEvent(const WebKit::WebTouchEvent& copy, |
| 447 ui::EventType type, |
| 448 base::TimeDelta time_stamp, |
| 449 size_t index = 0) : |
| 450 WrappedObject<ui::TouchEvent, WebKit::WebTouchEvent>(copy), |
| 451 index_(index) { |
| 452 data().type = ConvertToWebInputEvent(type); |
| 453 DCHECK(copy.touchesLength > index) << "Undefined touch point."; |
| 454 data().timeStampSeconds = time_stamp.InSecondsF(); |
| 455 } |
| 456 |
| 457 // TODO: make these functions non-virtual post http://crbug.com/125937 |
| 458 virtual ui::EventType GetEventType() const OVERRIDE { |
| 459 return ConvertToUIEvent(data().touches[index_].state); |
| 460 } |
| 461 virtual gfx::Point GetLocation() const OVERRIDE { |
| 462 return data().touches[index_].position; |
| 463 } |
| 464 virtual int GetTouchId() const OVERRIDE { |
| 465 return data().touches[index_].id; |
| 466 } |
| 467 virtual int GetEventFlags() const OVERRIDE { |
| 468 return 0; |
| 469 } |
| 470 virtual base::TimeDelta GetTimestamp() const OVERRIDE { |
| 471 return base::TimeDelta::FromMilliseconds( 1000 * data().timeStampSeconds); |
| 472 } |
| 473 void SetTimestamp(base::TimeDelta t) { |
| 474 data().timeStampSeconds = t.InSecondsF(); |
| 475 } |
| 476 virtual float RadiusX() const OVERRIDE { |
| 477 return data().touches[index_].radiusX; |
| 478 } |
| 479 virtual float RadiusY() const OVERRIDE { |
| 480 return data().touches[index_].radiusY; |
| 481 } |
| 482 virtual float RotationAngle() const OVERRIDE { |
| 483 return data().touches[index_].rotationAngle; |
| 484 } |
| 485 virtual float Force() const OVERRIDE { |
| 486 return data().touches[index_].force; |
| 487 } |
| 488 |
| 489 // Returns a copy of this touch event. Used when queueing events for |
| 490 // asynchronous gesture recognition. |
| 491 virtual TouchEvent* Copy() const OVERRIDE { |
| 492 return new LocalTouchEvent(data(), GetEventType(), GetTimestamp()); |
| 493 } |
| 494 |
| 495 // Returns a copy of the touch event at the specified index. |
| 496 const LocalTouchEvent& Index( size_t index) { |
| 497 const int touch_history_size = 40; |
| 498 static LocalTouchEvent touch_history[touch_history_size]; |
| 499 static int touch_history_index; |
| 500 int current = (touch_history_index++ % touch_history_size); |
| 501 touch_history[current].data() = data(); |
| 502 touch_history[current].index_ = index; |
| 503 return touch_history[current]; |
| 504 } |
| 505 |
| 506 private: |
| 507 size_t index_; |
| 508 |
| 509 DISALLOW_COPY_AND_ASSIGN(LocalTouchEvent); |
| 510 }; |
| 511 |
308 } // namespace | 512 } // namespace |
309 | 513 |
| 514 // Wrapper for maintaining touchstate associated with a WebTouchEvent. |
| 515 class WebTouchState { |
| 516 public: |
| 517 explicit WebTouchState(const RenderWidgetHostViewWin* window); |
| 518 |
| 519 // Updates the current touchpoint state with the supplied touches. |
| 520 // Touches will be consumed only if they are of the same type (e.g. down, |
| 521 // up, move). Returns the number of consumed touches. |
| 522 size_t UpdateTouchPoints(TOUCHINPUT* points, size_t count); |
| 523 |
| 524 // Marks all active touchpoints as released. |
| 525 bool ReleaseTouchPoints(); |
| 526 |
| 527 // The contained WebTouchEvent. |
| 528 const WebKit::WebTouchEvent& touch_event() { return touch_event_.data(); } |
| 529 const LocalTouchEvent* ui_touch_event() { return &touch_event_; } |
| 530 |
| 531 // Returns if any touches are modified in the event. |
| 532 bool is_changed() { return touch_event_.data().changedTouchesLength != 0; } |
| 533 |
| 534 void QueueEvents(ui::GestureConsumer* consumer, ui::GestureRecognizer* gr) { |
| 535 for (size_t i = 0; i < touch_event_.data().touchesLength; ++i) { |
| 536 gr->QueueTouchEventForGesture(consumer, touch_event_.Index(i)); |
| 537 } |
| 538 } |
| 539 |
| 540 private: |
| 541 // Adds a touch point or returns NULL if there's not enough space. |
| 542 WebKit::WebTouchPoint* AddTouchPoint(TOUCHINPUT* touch_input); |
| 543 |
| 544 // Copy details from a TOUCHINPUT to an existing WebTouchPoint, returning |
| 545 // true if the resulting point is a stationary move. |
| 546 bool UpdateTouchPoint(WebKit::WebTouchPoint* touch_point, |
| 547 TOUCHINPUT* touch_input); |
| 548 |
| 549 LocalTouchEvent touch_event_; |
| 550 const RenderWidgetHostViewWin* const window_; |
| 551 |
| 552 DISALLOW_COPY_AND_ASSIGN(WebTouchState); |
| 553 }; |
| 554 |
310 /////////////////////////////////////////////////////////////////////////////// | 555 /////////////////////////////////////////////////////////////////////////////// |
311 // RenderWidgetHostViewWin, public: | 556 // RenderWidgetHostViewWin, public: |
312 | 557 |
313 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) | 558 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) |
314 : render_widget_host_(RenderWidgetHostImpl::From(widget)), | 559 : render_widget_host_(RenderWidgetHostImpl::From(widget)), |
315 compositor_host_window_(NULL), | 560 compositor_host_window_(NULL), |
316 hide_compositor_window_at_next_paint_(false), | 561 hide_compositor_window_at_next_paint_(false), |
317 track_mouse_leave_(false), | 562 track_mouse_leave_(false), |
318 ime_notification_(false), | 563 ime_notification_(false), |
319 capture_enter_key_(false), | 564 capture_enter_key_(false), |
320 is_hidden_(false), | 565 is_hidden_(false), |
321 about_to_validate_and_paint_(false), | 566 about_to_validate_and_paint_(false), |
322 close_on_deactivate_(false), | 567 close_on_deactivate_(false), |
323 being_destroyed_(false), | 568 being_destroyed_(false), |
324 tooltip_hwnd_(NULL), | 569 tooltip_hwnd_(NULL), |
325 tooltip_showing_(false), | 570 tooltip_showing_(false), |
326 weak_factory_(this), | 571 weak_factory_(this), |
327 parent_hwnd_(NULL), | 572 parent_hwnd_(NULL), |
328 is_loading_(false), | 573 is_loading_(false), |
329 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 574 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
330 is_fullscreen_(false), | 575 is_fullscreen_(false), |
331 ignore_mouse_movement_(true), | 576 ignore_mouse_movement_(true), |
332 composition_range_(ui::Range::InvalidRange()), | 577 composition_range_(ui::Range::InvalidRange()), |
333 touch_state_(this), | 578 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 579 touch_state_(new WebTouchState(this))), |
334 pointer_down_context_(false), | 580 pointer_down_context_(false), |
335 focus_on_editable_field_(false), | 581 focus_on_editable_field_(false), |
336 received_focus_change_after_pointer_down_(false), | 582 received_focus_change_after_pointer_down_(false), |
337 touch_events_enabled_(false) { | 583 touch_events_enabled_(false), |
| 584 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 585 gesture_recognizer_(ui::GestureRecognizer::Create(this))) { |
338 render_widget_host_->SetView(this); | 586 render_widget_host_->SetView(this); |
339 registrar_.Add(this, | 587 registrar_.Add(this, |
340 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 588 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
341 content::NotificationService::AllBrowserContextsAndSources()); | 589 content::NotificationService::AllBrowserContextsAndSources()); |
342 registrar_.Add(this, | 590 registrar_.Add(this, |
343 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 591 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
344 content::NotificationService::AllBrowserContextsAndSources()); | 592 content::NotificationService::AllBrowserContextsAndSources()); |
345 } | 593 } |
346 | 594 |
347 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { | 595 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 callback.Run(result); | 1169 callback.Run(result); |
922 } | 1170 } |
923 | 1171 |
924 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { | 1172 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { |
925 content::RenderWidgetHostViewBase::SetBackground(background); | 1173 content::RenderWidgetHostViewBase::SetBackground(background); |
926 render_widget_host_->SetBackground(background); | 1174 render_widget_host_->SetBackground(background); |
927 } | 1175 } |
928 | 1176 |
929 void RenderWidgetHostViewWin::ProcessTouchAck( | 1177 void RenderWidgetHostViewWin::ProcessTouchAck( |
930 WebKit::WebInputEvent::Type type, bool processed) { | 1178 WebKit::WebInputEvent::Type type, bool processed) { |
| 1179 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
| 1180 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(this, processed)); |
| 1181 ProcessGestures(gestures.get()); |
| 1182 |
931 if (type == WebKit::WebInputEvent::TouchStart) | 1183 if (type == WebKit::WebInputEvent::TouchStart) |
932 UpdateDesiredTouchMode(processed); | 1184 UpdateDesiredTouchMode(processed); |
933 } | 1185 } |
934 | 1186 |
935 void RenderWidgetHostViewWin::SetToGestureMode() { | 1187 void RenderWidgetHostViewWin::SetToGestureMode() { |
936 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 1188 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
937 return; | 1189 return; |
938 UnregisterTouchWindow(m_hWnd); | 1190 UnregisterTouchWindow(m_hWnd); |
939 // Single finger panning is consistent with other windows applications. | 1191 // Single finger panning is consistent with other windows applications. |
940 const DWORD gesture_allow = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | | 1192 const DWORD gesture_allow = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 // state. If we want touch mode, then we attempt to register for touch | 1228 // state. If we want touch mode, then we attempt to register for touch |
977 // events, and otherwise to unregister. | 1229 // events, and otherwise to unregister. |
978 if (touch_mode) { | 1230 if (touch_mode) { |
979 touch_mode = SetToTouchMode(); | 1231 touch_mode = SetToTouchMode(); |
980 } | 1232 } |
981 if (!touch_mode) { | 1233 if (!touch_mode) { |
982 SetToGestureMode(); | 1234 SetToGestureMode(); |
983 } | 1235 } |
984 } | 1236 } |
985 | 1237 |
| 1238 ui::GestureEvent* RenderWidgetHostViewWin::CreateGestureEvent( |
| 1239 ui::EventType type, |
| 1240 const gfx::Point& location, |
| 1241 int flags, |
| 1242 base::Time time, |
| 1243 float param_first, |
| 1244 float param_second, |
| 1245 unsigned int touch_id_bitfield) { |
| 1246 |
| 1247 return new LocalGestureEvent(type, location, flags, time, |
| 1248 param_first, param_second, touch_id_bitfield); |
| 1249 } |
| 1250 |
| 1251 ui::TouchEvent* RenderWidgetHostViewWin::CreateTouchEvent( |
| 1252 ui::EventType type, |
| 1253 const gfx::Point& location, |
| 1254 int touch_id, |
| 1255 base::TimeDelta time_stamp) { |
| 1256 return new LocalTouchEvent( type, location, touch_id, time_stamp); |
| 1257 } |
| 1258 |
| 1259 bool RenderWidgetHostViewWin::DispatchLongPressGestureEvent( |
| 1260 ui::GestureEvent* event) { |
| 1261 return ForwardGestureEventToRenderer(event); |
| 1262 } |
| 1263 |
| 1264 bool RenderWidgetHostViewWin::DispatchCancelTouchEvent( |
| 1265 ui::TouchEvent* event) { |
| 1266 if (!render_widget_host_) |
| 1267 return false; |
| 1268 |
| 1269 DCHECK(event->GetEventType() == WebKit::WebInputEvent::TouchCancel); |
| 1270 LocalTouchEvent touchEvent(event->GetEventType(), |
| 1271 event->GetLocation(), event->GetTouchId(), event->GetTimestamp()); |
| 1272 render_widget_host_->ForwardTouchEvent(touchEvent.data()); |
| 1273 return true; |
| 1274 } |
| 1275 |
986 void RenderWidgetHostViewWin::SetHasHorizontalScrollbar( | 1276 void RenderWidgetHostViewWin::SetHasHorizontalScrollbar( |
987 bool has_horizontal_scrollbar) { | 1277 bool has_horizontal_scrollbar) { |
988 } | 1278 } |
989 | 1279 |
990 void RenderWidgetHostViewWin::SetScrollOffsetPinning( | 1280 void RenderWidgetHostViewWin::SetScrollOffsetPinning( |
991 bool is_pinned_to_left, bool is_pinned_to_right) { | 1281 bool is_pinned_to_left, bool is_pinned_to_right) { |
992 } | 1282 } |
993 | 1283 |
994 /////////////////////////////////////////////////////////////////////////////// | 1284 /////////////////////////////////////////////////////////////////////////////// |
995 // RenderWidgetHostViewWin, private: | 1285 // RenderWidgetHostViewWin, private: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 void RenderWidgetHostViewWin::OnSetFocus(HWND window) { | 1532 void RenderWidgetHostViewWin::OnSetFocus(HWND window) { |
1243 if (!render_widget_host_) | 1533 if (!render_widget_host_) |
1244 return; | 1534 return; |
1245 | 1535 |
1246 if (GetBrowserAccessibilityManager()) | 1536 if (GetBrowserAccessibilityManager()) |
1247 GetBrowserAccessibilityManager()->GotFocus(); | 1537 GetBrowserAccessibilityManager()->GotFocus(); |
1248 | 1538 |
1249 render_widget_host_->GotFocus(); | 1539 render_widget_host_->GotFocus(); |
1250 render_widget_host_->SetActive(true); | 1540 render_widget_host_->SetActive(true); |
1251 | 1541 |
1252 if (touch_state_.ReleaseTouchPoints()) | 1542 if (touch_state_->ReleaseTouchPoints()) |
1253 render_widget_host_->ForwardTouchEvent(touch_state_.touch_event()); | 1543 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); |
1254 } | 1544 } |
1255 | 1545 |
1256 void RenderWidgetHostViewWin::OnKillFocus(HWND window) { | 1546 void RenderWidgetHostViewWin::OnKillFocus(HWND window) { |
1257 if (!render_widget_host_) | 1547 if (!render_widget_host_) |
1258 return; | 1548 return; |
1259 | 1549 |
1260 render_widget_host_->SetActive(false); | 1550 render_widget_host_->SetActive(false); |
1261 render_widget_host_->Blur(); | 1551 render_widget_host_->Blur(); |
1262 | 1552 |
1263 if (touch_state_.ReleaseTouchPoints()) | 1553 if (touch_state_->ReleaseTouchPoints()) |
1264 render_widget_host_->ForwardTouchEvent(touch_state_.touch_event()); | 1554 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); |
1265 } | 1555 } |
1266 | 1556 |
1267 void RenderWidgetHostViewWin::OnCaptureChanged(HWND window) { | 1557 void RenderWidgetHostViewWin::OnCaptureChanged(HWND window) { |
1268 if (render_widget_host_) | 1558 if (render_widget_host_) |
1269 render_widget_host_->LostCapture(); | 1559 render_widget_host_->LostCapture(); |
1270 } | 1560 } |
1271 | 1561 |
1272 void RenderWidgetHostViewWin::OnCancelMode() { | 1562 void RenderWidgetHostViewWin::OnCancelMode() { |
1273 if (render_widget_host_) | 1563 if (render_widget_host_) |
1274 render_widget_host_->LostCapture(); | 1564 render_widget_host_->LostCapture(); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 | 1997 |
1708 if (!handled_by_WebContentsImpl && render_widget_host_) { | 1998 if (!handled_by_WebContentsImpl && render_widget_host_) { |
1709 render_widget_host_->ForwardWheelEvent( | 1999 render_widget_host_->ForwardWheelEvent( |
1710 WebInputEventFactory::mouseWheelEvent(m_hWnd, message, wparam, | 2000 WebInputEventFactory::mouseWheelEvent(m_hWnd, message, wparam, |
1711 lparam)); | 2001 lparam)); |
1712 } | 2002 } |
1713 handled = TRUE; | 2003 handled = TRUE; |
1714 return 0; | 2004 return 0; |
1715 } | 2005 } |
1716 | 2006 |
1717 RenderWidgetHostViewWin::WebTouchState::WebTouchState(const CWindowImpl* window) | 2007 WebTouchState::WebTouchState(const RenderWidgetHostViewWin* window) |
1718 : window_(window) { } | 2008 : window_(window) { } |
1719 | 2009 |
1720 size_t RenderWidgetHostViewWin::WebTouchState::UpdateTouchPoints( | 2010 size_t WebTouchState::UpdateTouchPoints( |
1721 TOUCHINPUT* points, size_t count) { | 2011 TOUCHINPUT* points, size_t count) { |
1722 // First we reset all touch event state. This involves removing any released | 2012 // First we reset all touch event state. This involves removing any released |
1723 // touchpoints and marking the rest as stationary. After that we go through | 2013 // touchpoints and marking the rest as stationary. After that we go through |
1724 // and alter/add any touchpoints (from the touch input buffer) that we can | 2014 // and alter/add any touchpoints (from the touch input buffer) that we can |
1725 // coalesce into a single message. The return value is the number of consumed | 2015 // coalesce into a single message. The return value is the number of consumed |
1726 // input message. | 2016 // input message. |
1727 WebKit::WebTouchPoint* point = touch_event_.touches; | 2017 WebKit::WebTouchPoint* point = touch_event_.data().touches; |
1728 WebKit::WebTouchPoint* end = point + touch_event_.touchesLength; | 2018 WebKit::WebTouchPoint* end = point + touch_event_.data().touchesLength; |
1729 while (point < end) { | 2019 while (point < end) { |
1730 if (point->state == WebKit::WebTouchPoint::StateReleased) { | 2020 if (point->state == WebKit::WebTouchPoint::StateReleased) { |
1731 *point = *(--end); | 2021 *point = *(--end); |
1732 --touch_event_.touchesLength; | 2022 --touch_event_.data().touchesLength; |
1733 } else { | 2023 } else { |
1734 point->state = WebKit::WebTouchPoint::StateStationary; | 2024 point->state = WebKit::WebTouchPoint::StateStationary; |
1735 point++; | 2025 point++; |
1736 } | 2026 } |
1737 } | 2027 } |
1738 touch_event_.changedTouchesLength = 0; | 2028 touch_event_.data().changedTouchesLength = 0; |
1739 | 2029 |
1740 // Consume all events of the same type and add them to the changed list. | 2030 // Consume all events of the same type and add them to the changed list. |
1741 int last_type = 0; | 2031 int last_type = 0; |
1742 for (size_t i = 0; i < count; ++i) { | 2032 for (size_t i = 0; i < count; ++i) { |
1743 if (points[i].dwID == 0ul) | 2033 if (points[i].dwID == 0ul) |
1744 continue; | 2034 continue; |
1745 | 2035 |
1746 WebKit::WebTouchPoint* point = NULL; | 2036 WebKit::WebTouchPoint* point = NULL; |
1747 for (unsigned j = 0; j < touch_event_.touchesLength; ++j) { | 2037 for (unsigned j = 0; j < touch_event_.data().touchesLength; ++j) { |
1748 if (static_cast<DWORD>(touch_event_.touches[j].id) == points[i].dwID) { | 2038 if (static_cast<DWORD>(touch_event_.data().touches[j].id) == |
1749 point = &touch_event_.touches[j]; | 2039 points[i].dwID) { |
| 2040 point = &touch_event_.data().touches[j]; |
1750 break; | 2041 break; |
1751 } | 2042 } |
1752 } | 2043 } |
1753 | 2044 |
1754 // Use a move instead if we see a down on a point we already have. | 2045 // Use a move instead if we see a down on a point we already have. |
1755 int type = GetTouchType(points[i]); | 2046 int type = GetTouchType(points[i]); |
1756 if (point && type == TOUCHEVENTF_DOWN) | 2047 if (point && type == TOUCHEVENTF_DOWN) |
1757 SetTouchType(&points[i], TOUCHEVENTF_MOVE); | 2048 SetTouchType(&points[i], TOUCHEVENTF_MOVE); |
1758 | 2049 |
1759 // Stop processing when the event type changes. | 2050 // Stop processing when the event type changes. |
1760 if (touch_event_.changedTouchesLength && type != last_type) | 2051 if (touch_event_.data().changedTouchesLength && type != last_type) |
1761 return i; | 2052 return i; |
1762 | 2053 |
| 2054 touch_event_.SetTimestamp( |
| 2055 base::TimeDelta::FromMilliseconds(points[i].dwTime)); |
| 2056 |
1763 last_type = type; | 2057 last_type = type; |
1764 switch (type) { | 2058 switch (type) { |
1765 case TOUCHEVENTF_DOWN: { | 2059 case TOUCHEVENTF_DOWN: { |
1766 if (!(point = AddTouchPoint(&points[i]))) | 2060 if (!(point = AddTouchPoint(&points[i]))) |
1767 continue; | 2061 continue; |
1768 touch_event_.type = WebKit::WebInputEvent::TouchStart; | 2062 touch_event_.data().type = WebKit::WebInputEvent::TouchStart; |
1769 break; | 2063 break; |
1770 } | 2064 } |
1771 | 2065 |
1772 case TOUCHEVENTF_UP: { | 2066 case TOUCHEVENTF_UP: { |
1773 if (!point) // Just throw away a stray up. | 2067 if (!point) // Just throw away a stray up. |
1774 continue; | 2068 continue; |
1775 point->state = WebKit::WebTouchPoint::StateReleased; | 2069 point->state = WebKit::WebTouchPoint::StateReleased; |
1776 UpdateTouchPoint(point, &points[i]); | 2070 UpdateTouchPoint(point, &points[i]); |
1777 touch_event_.type = WebKit::WebInputEvent::TouchEnd; | 2071 touch_event_.data().type = WebKit::WebInputEvent::TouchEnd; |
1778 break; | 2072 break; |
1779 } | 2073 } |
1780 | 2074 |
1781 case TOUCHEVENTF_MOVE: { | 2075 case TOUCHEVENTF_MOVE: { |
1782 if (point) { | 2076 if (point) { |
1783 point->state = WebKit::WebTouchPoint::StateMoved; | 2077 point->state = WebKit::WebTouchPoint::StateMoved; |
1784 // Don't update the message if the point didn't really move. | 2078 // Don't update the message if the point didn't really move. |
1785 if (UpdateTouchPoint(point, &points[i])) | 2079 if (UpdateTouchPoint(point, &points[i])) |
1786 continue; | 2080 continue; |
1787 touch_event_.type = WebKit::WebInputEvent::TouchMove; | 2081 touch_event_.data().type = WebKit::WebInputEvent::TouchMove; |
1788 } else if (touch_event_.changedTouchesLength) { | 2082 } else if (touch_event_.data().changedTouchesLength) { |
1789 // Can't add a point if we're already handling move events. | 2083 // Can't add a point if we're already handling move events. |
1790 return i; | 2084 return i; |
1791 } else { | 2085 } else { |
1792 // Treat a move with no existing point as a down. | 2086 // Treat a move with no existing point as a down. |
1793 if (!(point = AddTouchPoint(&points[i]))) | 2087 if (!(point = AddTouchPoint(&points[i]))) |
1794 continue; | 2088 continue; |
1795 last_type = TOUCHEVENTF_DOWN; | 2089 last_type = TOUCHEVENTF_DOWN; |
1796 SetTouchType(&points[i], TOUCHEVENTF_DOWN); | 2090 SetTouchType(&points[i], TOUCHEVENTF_DOWN); |
1797 touch_event_.type = WebKit::WebInputEvent::TouchStart; | 2091 touch_event_.data().type = WebKit::WebInputEvent::TouchStart; |
1798 } | 2092 } |
1799 break; | 2093 break; |
1800 } | 2094 } |
1801 | 2095 |
1802 default: | 2096 default: |
1803 NOTREACHED(); | 2097 NOTREACHED(); |
1804 continue; | 2098 continue; |
1805 } | 2099 } |
1806 touch_event_.changedTouches[touch_event_.changedTouchesLength++] = *point; | 2100 touch_event_.data().changedTouches[ |
| 2101 touch_event_.data().changedTouchesLength++] = *point; |
1807 } | 2102 } |
1808 | 2103 |
1809 return count; | 2104 return count; |
1810 } | 2105 } |
1811 | 2106 |
1812 bool RenderWidgetHostViewWin::WebTouchState::ReleaseTouchPoints() { | 2107 bool WebTouchState::ReleaseTouchPoints() { |
1813 if (touch_event_.touchesLength == 0) | 2108 if (touch_event_.data().touchesLength == 0) |
1814 return false; | 2109 return false; |
1815 // Mark every active touchpoint as released. | 2110 // Mark every active touchpoint as released. |
1816 touch_event_.type = WebKit::WebInputEvent::TouchEnd; | 2111 touch_event_.data().type = WebKit::WebInputEvent::TouchEnd; |
1817 touch_event_.changedTouchesLength = touch_event_.touchesLength; | 2112 touch_event_.data().changedTouchesLength = touch_event_.data().touchesLength; |
1818 for (unsigned int i = 0; i < touch_event_.touchesLength; ++i) { | 2113 for (unsigned int i = 0; i < touch_event_.data().touchesLength; ++i) { |
1819 touch_event_.touches[i].state = WebKit::WebTouchPoint::StateReleased; | 2114 touch_event_.data().touches[i].state = WebKit::WebTouchPoint::StateReleased; |
1820 touch_event_.changedTouches[i].state = | 2115 touch_event_.data().changedTouches[i].state = |
1821 WebKit::WebTouchPoint::StateReleased; | 2116 WebKit::WebTouchPoint::StateReleased; |
1822 } | 2117 } |
1823 | 2118 |
1824 return true; | 2119 return true; |
1825 } | 2120 } |
1826 | 2121 |
1827 WebKit::WebTouchPoint* RenderWidgetHostViewWin::WebTouchState::AddTouchPoint( | 2122 WebKit::WebTouchPoint* WebTouchState::AddTouchPoint( |
1828 TOUCHINPUT* touch_input) { | 2123 TOUCHINPUT* touch_input) { |
1829 if (touch_event_.touchesLength >= WebKit::WebTouchEvent::touchesLengthCap) | 2124 if (touch_event_.data().touchesLength >= |
| 2125 WebKit::WebTouchEvent::touchesLengthCap) |
1830 return NULL; | 2126 return NULL; |
1831 WebKit::WebTouchPoint* point = | 2127 WebKit::WebTouchPoint* point = |
1832 &touch_event_.touches[touch_event_.touchesLength++]; | 2128 &touch_event_.data().touches[touch_event_.data().touchesLength++]; |
1833 point->state = WebKit::WebTouchPoint::StatePressed; | 2129 point->state = WebKit::WebTouchPoint::StatePressed; |
1834 point->id = touch_input->dwID; | 2130 point->id = touch_input->dwID; |
1835 UpdateTouchPoint(point, touch_input); | 2131 UpdateTouchPoint(point, touch_input); |
1836 return point; | 2132 return point; |
1837 } | 2133 } |
1838 | 2134 |
1839 bool RenderWidgetHostViewWin::WebTouchState::UpdateTouchPoint( | 2135 bool WebTouchState::UpdateTouchPoint( |
1840 WebKit::WebTouchPoint* touch_point, | 2136 WebKit::WebTouchPoint* touch_point, |
1841 TOUCHINPUT* touch_input) { | 2137 TOUCHINPUT* touch_input) { |
1842 CPoint coordinates(TOUCH_COORD_TO_PIXEL(touch_input->x), | 2138 CPoint coordinates(TOUCH_COORD_TO_PIXEL(touch_input->x), |
1843 TOUCH_COORD_TO_PIXEL(touch_input->y)); | 2139 TOUCH_COORD_TO_PIXEL(touch_input->y)); |
1844 int radius_x = 1; | 2140 int radius_x = 1; |
1845 int radius_y = 1; | 2141 int radius_y = 1; |
1846 if (touch_input->dwMask & TOUCHINPUTMASKF_CONTACTAREA) { | 2142 if (touch_input->dwMask & TOUCHINPUTMASKF_CONTACTAREA) { |
1847 radius_x = TOUCH_COORD_TO_PIXEL(touch_input->cxContact); | 2143 radius_x = TOUCH_COORD_TO_PIXEL(touch_input->cxContact); |
1848 radius_y = TOUCH_COORD_TO_PIXEL(touch_input->cyContact); | 2144 radius_y = TOUCH_COORD_TO_PIXEL(touch_input->cyContact); |
1849 } | 2145 } |
(...skipping 25 matching lines...) Expand all Loading... |
1875 // TODO(jschuh): Add support for an arbitrary number of touchpoints. | 2171 // TODO(jschuh): Add support for an arbitrary number of touchpoints. |
1876 size_t total = std::min(static_cast<int>(LOWORD(wparam)), | 2172 size_t total = std::min(static_cast<int>(LOWORD(wparam)), |
1877 static_cast<int>(WebKit::WebTouchEvent::touchesLengthCap)); | 2173 static_cast<int>(WebKit::WebTouchEvent::touchesLengthCap)); |
1878 TOUCHINPUT points[WebKit::WebTouchEvent::touchesLengthCap]; | 2174 TOUCHINPUT points[WebKit::WebTouchEvent::touchesLengthCap]; |
1879 | 2175 |
1880 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total, | 2176 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total, |
1881 points, sizeof(TOUCHINPUT))) { | 2177 points, sizeof(TOUCHINPUT))) { |
1882 return 0; | 2178 return 0; |
1883 } | 2179 } |
1884 | 2180 |
| 2181 bool has_touch_handler = render_widget_host_->has_touch_handler(); |
| 2182 |
| 2183 // Send a copy of the touch events on to the gesture recognizer. |
1885 for (size_t start = 0; start < total;) { | 2184 for (size_t start = 0; start < total;) { |
1886 start += touch_state_.UpdateTouchPoints(points + start, total - start); | 2185 start += touch_state_->UpdateTouchPoints(points + start, total - start); |
1887 if (touch_state_.is_changed()) | 2186 if (has_touch_handler) { |
1888 render_widget_host_->ForwardTouchEvent(touch_state_.touch_event()); | 2187 if (touch_state_->is_changed()) |
| 2188 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); |
| 2189 touch_state_->QueueEvents(this,gesture_recognizer_.get()); |
| 2190 } else { |
| 2191 // TODO: This probably needs to be updated to call Next() |
| 2192 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
| 2193 gestures.reset(gesture_recognizer_->ProcessTouchEventForGesture( |
| 2194 *touch_state_->ui_touch_event(), ui::TOUCH_STATUS_UNKNOWN, this)); |
| 2195 ProcessGestures(gestures.get()); |
| 2196 } |
1889 } | 2197 } |
1890 | 2198 |
1891 CloseTouchInputHandle((HTOUCHINPUT)lparam); | 2199 CloseTouchInputHandle((HTOUCHINPUT)lparam); |
1892 | 2200 |
1893 return 0; | 2201 return 0; |
1894 } | 2202 } |
1895 | 2203 |
| 2204 void RenderWidgetHostViewWin::ProcessGestures( |
| 2205 ui::GestureRecognizer::Gestures* gestures) { |
| 2206 if ((gestures == NULL) || gestures->empty()) |
| 2207 return; |
| 2208 for (ui::GestureRecognizer::Gestures::iterator g_it = gestures->begin(); |
| 2209 g_it != gestures->end(); |
| 2210 ++g_it) { |
| 2211 ForwardGestureEventToRenderer(*g_it); |
| 2212 } |
| 2213 } |
| 2214 |
1896 LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT message, | 2215 LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT message, |
1897 WPARAM wparam, | 2216 WPARAM wparam, |
1898 LPARAM lparam, | 2217 LPARAM lparam, |
1899 BOOL& handled) { | 2218 BOOL& handled) { |
1900 if (!render_widget_host_) | 2219 if (!render_widget_host_) |
1901 return MA_NOACTIVATE; | 2220 return MA_NOACTIVATE; |
1902 | 2221 |
1903 if (!IsActivatable()) | 2222 if (!IsActivatable()) |
1904 return MA_NOACTIVATE; | 2223 return MA_NOACTIVATE; |
1905 | 2224 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 // Send a touch event at this location; if the touch start is handled | 2285 // Send a touch event at this location; if the touch start is handled |
1967 // then we switch to touch mode, rather than gesture mode (in the ACK). | 2286 // then we switch to touch mode, rather than gesture mode (in the ACK). |
1968 TOUCHINPUT fake_touch; | 2287 TOUCHINPUT fake_touch; |
1969 fake_touch.x = gi.ptsLocation.x * 100; | 2288 fake_touch.x = gi.ptsLocation.x * 100; |
1970 fake_touch.y = gi.ptsLocation.y * 100; | 2289 fake_touch.y = gi.ptsLocation.y * 100; |
1971 fake_touch.cxContact = 100; | 2290 fake_touch.cxContact = 100; |
1972 fake_touch.cyContact = 100; | 2291 fake_touch.cyContact = 100; |
1973 fake_touch.dwMask = 0; | 2292 fake_touch.dwMask = 0; |
1974 fake_touch.dwFlags = TOUCHEVENTF_DOWN | TOUCHEVENTF_PRIMARY; | 2293 fake_touch.dwFlags = TOUCHEVENTF_DOWN | TOUCHEVENTF_PRIMARY; |
1975 fake_touch.dwID = gi.dwInstanceID; | 2294 fake_touch.dwID = gi.dwInstanceID; |
1976 touch_state_.UpdateTouchPoints(&fake_touch, 1); | 2295 touch_state_->UpdateTouchPoints(&fake_touch, 1); |
1977 if (touch_state_.is_changed()) | 2296 if (touch_state_->is_changed()) |
1978 render_widget_host_->ForwardTouchEvent(touch_state_.touch_event()); | 2297 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); |
1979 } else if (gi.dwID == GID_END) { | 2298 } else if (gi.dwID == GID_END) { |
1980 if (touch_state_.ReleaseTouchPoints()) | 2299 if (touch_state_->ReleaseTouchPoints()) |
1981 render_widget_host_->ForwardTouchEvent(touch_state_.touch_event()); | 2300 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); |
1982 } | 2301 } |
1983 ::CloseGestureInfoHandle(gi_handle); | 2302 ::CloseGestureInfoHandle(gi_handle); |
1984 return 0; | 2303 return 0; |
1985 } | 2304 } |
1986 | 2305 |
1987 void RenderWidgetHostViewWin::OnAccessibilityNotifications( | 2306 void RenderWidgetHostViewWin::OnAccessibilityNotifications( |
1988 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { | 2307 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { |
1989 if (!GetBrowserAccessibilityManager()) { | 2308 if (!GetBrowserAccessibilityManager()) { |
1990 SetBrowserAccessibilityManager( | 2309 SetBrowserAccessibilityManager( |
1991 BrowserAccessibilityManager::CreateEmptyDocument( | 2310 BrowserAccessibilityManager::CreateEmptyDocument( |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2423 GetClientRect(&ti.rect); | 2742 GetClientRect(&ti.rect); |
2424 SendMessage(tooltip_hwnd_, message, NULL, reinterpret_cast<LPARAM>(&ti)); | 2743 SendMessage(tooltip_hwnd_, message, NULL, reinterpret_cast<LPARAM>(&ti)); |
2425 } | 2744 } |
2426 | 2745 |
2427 void RenderWidgetHostViewWin::ResetTooltip() { | 2746 void RenderWidgetHostViewWin::ResetTooltip() { |
2428 if (::IsWindow(tooltip_hwnd_)) | 2747 if (::IsWindow(tooltip_hwnd_)) |
2429 ::DestroyWindow(tooltip_hwnd_); | 2748 ::DestroyWindow(tooltip_hwnd_); |
2430 tooltip_hwnd_ = NULL; | 2749 tooltip_hwnd_ = NULL; |
2431 } | 2750 } |
2432 | 2751 |
| 2752 bool RenderWidgetHostViewWin::ForwardGestureEventToRenderer( |
| 2753 ui::GestureEvent* gesture) { |
| 2754 if (!render_widget_host_) |
| 2755 return false; |
| 2756 |
| 2757 LocalGestureEvent* local = static_cast<LocalGestureEvent*>(gesture); |
| 2758 const WebKit::WebGestureEvent& generatedEvent = local->data(); |
| 2759 render_widget_host_->ForwardGestureEvent(generatedEvent); |
| 2760 return true; |
| 2761 } |
| 2762 |
2433 void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message, | 2763 void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message, |
2434 WPARAM wparam, | 2764 WPARAM wparam, |
2435 LPARAM lparam) { | 2765 LPARAM lparam) { |
2436 if (!render_widget_host_) | 2766 if (!render_widget_host_) |
2437 return; | 2767 return; |
2438 | 2768 |
2439 WebMouseEvent event( | 2769 WebMouseEvent event( |
2440 WebInputEventFactory::mouseEvent(m_hWnd, message, wparam, lparam)); | 2770 WebInputEventFactory::mouseEvent(m_hWnd, message, wparam, lparam)); |
2441 | 2771 |
2442 if (mouse_locked_) { | 2772 if (mouse_locked_) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 3005 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
2676 // If the default focus on the page is on an edit field and we did not | 3006 // If the default focus on the page is on an edit field and we did not |
2677 // receive a focus change in the context of a pointer down message, it means | 3007 // receive a focus change in the context of a pointer down message, it means |
2678 // that the pointer down message occurred on the edit field and we should | 3008 // that the pointer down message occurred on the edit field and we should |
2679 // display the on screen keyboard | 3009 // display the on screen keyboard |
2680 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3010 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
2681 DisplayOnScreenKeyboardIfNeeded(); | 3011 DisplayOnScreenKeyboardIfNeeded(); |
2682 received_focus_change_after_pointer_down_ = false; | 3012 received_focus_change_after_pointer_down_ = false; |
2683 pointer_down_context_ = false; | 3013 pointer_down_context_ = false; |
2684 } | 3014 } |
OLD | NEW |