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

Side by Side Diff: third_party/WebKit/Source/core/input/PointerEventManager.cpp

Issue 2973963003: Release mouse pointer capture when it starts drag (Closed)
Patch Set: Remove is_cancel from parameters Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/input/PointerEventManager.h" 5 #include "core/input/PointerEventManager.h"
6 6
7 #include "core/dom/ElementTraversal.h" 7 #include "core/dom/ElementTraversal.h"
8 #include "core/dom/FlatTreeTraversal.h" 8 #include "core/dom/FlatTreeTraversal.h"
9 #include "core/dom/UserGestureIndicator.h" 9 #include "core/dom/UserGestureIndicator.h"
10 #include "core/events/MouseEvent.h" 10 #include "core/events/MouseEvent.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // Sending the leave/out events and lostpointercapture because the next 483 // Sending the leave/out events and lostpointercapture because the next
484 // touch event will have a different id. 484 // touch event will have a different id.
485 ProcessCaptureAndPositionOfPointerEvent(pointer_event, nullptr); 485 ProcessCaptureAndPositionOfPointerEvent(pointer_event, nullptr);
486 486
487 RemovePointer(pointer_event); 487 RemovePointer(pointer_event);
488 } 488 }
489 489
490 return result; 490 return result;
491 } 491 }
492 492
493 WebInputEventResult PointerEventManager::HandlePointerEvent(
494 const WebPointerEvent& web_pointer_event,
495 Node* target) {
496 // TODO(crbug.com/625841): This function only handles pointercancel for now.
497 // But we should extend it to handle any pointerevents.
498 DCHECK(web_pointer_event.GetType() == WebInputEvent::Type::kPointerCancel);
dtapuska 2017/07/13 19:21:36 DCHECK_EQ is preferred
499 PointerEvent* pointer_event =
500 pointer_event_factory_.CreatePointerCancelEvent(web_pointer_event);
501
502 EventTarget* effective_target =
503 GetEffectiveTargetForPointerEvent(target, pointer_event->pointerId());
504 WebInputEventResult result =
505 DispatchPointerEvent(effective_target, pointer_event);
506
507 ReleasePointerCapture(pointer_event->pointerId());
508
509 // TODO(nzolghadr): Instead of |ProcessPendingPointerCapture| maybe we
510 // should have used ProcessCaptureAndPositionOfPointerEvent but that might
511 // be sending boundary events however we probably not want that all the
512 // time.
513 ProcessPendingPointerCapture(pointer_event);
514
515 RemovePointer(pointer_event);
516 return result;
517 }
518
493 WebInputEventResult PointerEventManager::SendMousePointerEvent( 519 WebInputEventResult PointerEventManager::SendMousePointerEvent(
494 Node* target, 520 Node* target,
495 const String& canvas_region_id, 521 const String& canvas_region_id,
496 const AtomicString& mouse_event_type, 522 const AtomicString& mouse_event_type,
497 const WebMouseEvent& mouse_event, 523 const WebMouseEvent& mouse_event,
498 const Vector<WebMouseEvent>& coalesced_events) { 524 const Vector<WebMouseEvent>& coalesced_events) {
499 PointerEvent* pointer_event = pointer_event_factory_.Create( 525 PointerEvent* pointer_event = pointer_event_factory_.Create(
500 mouse_event_type, mouse_event, coalesced_events, 526 mouse_event_type, mouse_event, coalesced_events,
501 frame_->GetDocument()->domWindow()); 527 frame_->GetDocument()->domWindow());
502 528
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 if (first_id > unique_touch_event_id) 808 if (first_id > unique_touch_event_id)
783 return false; 809 return false;
784 touch_ids_for_canceled_pointerdowns_.TakeFirst(); 810 touch_ids_for_canceled_pointerdowns_.TakeFirst();
785 if (first_id == unique_touch_event_id) 811 if (first_id == unique_touch_event_id)
786 return true; 812 return true;
787 } 813 }
788 return false; 814 return false;
789 } 815 }
790 816
791 } // namespace blink 817 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('k') | third_party/WebKit/Source/platform/WebPointerEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698