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

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

Issue 1800143002: Notify Blink about start of gesture scroll through a queued event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/shadow/FlatTreeTraversal.h" 7 #include "core/dom/shadow/FlatTreeTraversal.h"
8 #include "core/events/MouseEvent.h" 8 #include "core/events/MouseEvent.h"
9 #include "core/input/EventHandler.h" 9 #include "core/input/EventHandler.h"
10 10
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (sendEvent) 276 if (sendEvent)
277 sendNodeTransitionEvents(node.target, target, pointerEvent); 277 sendNodeTransitionEvents(node.target, target, pointerEvent);
278 } else if (target) { 278 } else if (target) {
279 m_nodeUnderPointer.add(pointerEvent->pointerId(), 279 m_nodeUnderPointer.add(pointerEvent->pointerId(),
280 EventTargetAttributes(target, false)); 280 EventTargetAttributes(target, false));
281 if (sendEvent) 281 if (sendEvent)
282 sendNodeTransitionEvents(nullptr, target, pointerEvent); 282 sendNodeTransitionEvents(nullptr, target, pointerEvent);
283 } 283 }
284 } 284 }
285 285
286 void PointerEventManager::sendTouchCancelPointerEvent(EventTarget* target, const PlatformTouchPoint& point) 286 void PointerEventManager::blockTouchPointers()
287 { 287 {
288 PointerEvent* pointerEvent = m_pointerEventFactory.createPointerCancelEvent( point); 288 if (m_inCanceledStateForPointerTypeTouch)
289 return;
290 m_inCanceledStateForPointerTypeTouch = true;
289 291
292 HeapVector<int> touchPointerIds
293 = m_pointerEventFactory.getPointerIdsOfType(WebPointerProperties::Pointe rType::Touch);
290 294
291 processCaptureAndPositionOfPointerEvent(pointerEvent, target); 295 for (int pointerId : touchPointerIds) {
296 PointerEvent* pointerEvent
297 = m_pointerEventFactory.createPointerCancelEvent(
298 pointerId, WebPointerProperties::PointerType::Touch);
292 299
293 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing 300 ASSERT(m_nodeUnderPointer.contains(pointerId));
294 dispatchPointerEvent( 301 EventTarget* target = m_nodeUnderPointer.get(pointerId).target;
295 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()),
296 pointerEvent);
297 302
298 releasePointerCapture(pointerEvent->pointerId()); 303 processCaptureAndPositionOfPointerEvent(pointerEvent, target);
299 304
300 // Sending the leave/out events and lostpointercapture 305 // TODO(crbug.com/579553): This event follows implicit TE capture. The a ctual target
bokan 2016/04/11 22:22:00 Please keep the TODO format from before: |TODO(nam
mustaq 2016/04/12 17:16:14 My interpretation of the Blink style guide entry (
301 // because the next touch event will have a different id. So delayed 306 // would depend on PE capturing. Perhaps need to split TE/PE event path upstream?
302 // sending of lostpointercapture won't work here. 307 dispatchPointerEvent(
303 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr); 308 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()) ,
309 pointerEvent);
304 310
305 removePointer(pointerEvent); 311 releasePointerCapture(pointerEvent->pointerId());
312
313 // Sending the leave/out events and lostpointercapture
314 // because the next touch event will have a different id. So delayed
315 // sending of lostpointercapture won't work here.
316 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr);
317
318 removePointer(pointerEvent);
319 }
320 }
321
322 void PointerEventManager::unblockTouchPointers()
323 {
324 m_inCanceledStateForPointerTypeTouch = false;
306 } 325 }
307 326
308 WebInputEventResult PointerEventManager::sendTouchPointerEvent( 327 WebInputEventResult PointerEventManager::sendTouchPointerEvent(
309 EventTarget* target, 328 EventTarget* target,
310 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers, 329 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers,
311 const double width, const double height, 330 const double width, const double height,
312 const double clientX, const double clientY) 331 const double clientX, const double clientY)
313 { 332 {
333 if (m_inCanceledStateForPointerTypeTouch)
334 return WebInputEventResult::NotHandled;
335
314 PointerEvent* pointerEvent = 336 PointerEvent* pointerEvent =
315 m_pointerEventFactory.create( 337 m_pointerEventFactory.create(
316 pointerEventNameForTouchPointState(touchPoint.state()), 338 pointerEventNameForTouchPointState(touchPoint.state()),
317 touchPoint, modifiers, width, height, clientX, clientY); 339 touchPoint, modifiers, width, height, clientX, clientY);
318 340
319 processCaptureAndPositionOfPointerEvent(pointerEvent, target); 341 processCaptureAndPositionOfPointerEvent(pointerEvent, target);
320 342
321 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing 343 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing
322 WebInputEventResult result = dispatchPointerEvent( 344 WebInputEventResult result = dispatchPointerEvent(
323 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), 345 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 clear(); 413 clear();
392 } 414 }
393 415
394 PointerEventManager::~PointerEventManager() 416 PointerEventManager::~PointerEventManager()
395 { 417 {
396 } 418 }
397 419
398 void PointerEventManager::clear() 420 void PointerEventManager::clear()
399 { 421 {
400 m_preventMouseEventForPointerTypeMouse = false; 422 m_preventMouseEventForPointerTypeMouse = false;
423 m_inCanceledStateForPointerTypeTouch = false;
401 m_pointerEventFactory.clear(); 424 m_pointerEventFactory.clear();
402 m_nodeUnderPointer.clear(); 425 m_nodeUnderPointer.clear();
403 m_pointerCaptureTarget.clear(); 426 m_pointerCaptureTarget.clear();
404 m_pendingPointerCaptureTarget.clear(); 427 m_pendingPointerCaptureTarget.clear();
405 } 428 }
406 429
407 void PointerEventManager::processCaptureAndPositionOfPointerEvent( 430 void PointerEventManager::processCaptureAndPositionOfPointerEvent(
408 PointerEvent* pointerEvent, 431 PointerEvent* pointerEvent,
409 EventTarget* hitTestTarget, 432 EventTarget* hitTestTarget,
410 EventTarget* lastNodeUnderMouse, 433 EventTarget* lastNodeUnderMouse,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 EventTarget* PointerEventManager::getCapturingNode(int pointerId) 543 EventTarget* PointerEventManager::getCapturingNode(int pointerId)
521 { 544 {
522 if (m_pointerCaptureTarget.contains(pointerId)) 545 if (m_pointerCaptureTarget.contains(pointerId))
523 return m_pointerCaptureTarget.get(pointerId); 546 return m_pointerCaptureTarget.get(pointerId);
524 return nullptr; 547 return nullptr;
525 } 548 }
526 549
527 void PointerEventManager::removePointer( 550 void PointerEventManager::removePointer(
528 PointerEvent* pointerEvent) 551 PointerEvent* pointerEvent)
529 { 552 {
530 if (m_pointerEventFactory.remove(pointerEvent)) { 553 int pointerId = pointerEvent->pointerId();
531 int pointerId = pointerEvent->pointerId(); 554 if (m_pointerEventFactory.remove(pointerId)) {
532 m_pendingPointerCaptureTarget.remove(pointerId); 555 m_pendingPointerCaptureTarget.remove(pointerId);
533 m_pointerCaptureTarget.remove(pointerId); 556 m_pointerCaptureTarget.remove(pointerId);
534 m_nodeUnderPointer.remove(pointerId); 557 m_nodeUnderPointer.remove(pointerId);
535 } 558 }
536 } 559 }
537 560
538 void PointerEventManager::elementRemoved(EventTarget* target) 561 void PointerEventManager::elementRemoved(EventTarget* target)
539 { 562 {
540 removeTargetFromPointerCapturingMapping(m_pendingPointerCaptureTarget, targe t); 563 removeTargetFromPointerCapturingMapping(m_pendingPointerCaptureTarget, targe t);
541 } 564 }
(...skipping 28 matching lines...) Expand all
570 593
571 DEFINE_TRACE(PointerEventManager) 594 DEFINE_TRACE(PointerEventManager)
572 { 595 {
573 visitor->trace(m_nodeUnderPointer); 596 visitor->trace(m_nodeUnderPointer);
574 visitor->trace(m_pointerCaptureTarget); 597 visitor->trace(m_pointerCaptureTarget);
575 visitor->trace(m_pendingPointerCaptureTarget); 598 visitor->trace(m_pendingPointerCaptureTarget);
576 } 599 }
577 600
578 601
579 } // namespace blink 602 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('k') | third_party/WebKit/Source/platform/PlatformEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698