OLD | NEW |
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/TouchEventManager.h" | 5 #include "core/input/TouchEventManager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/events/TouchEvent.h" | 9 #include "core/events/TouchEvent.h" |
10 #include "core/frame/Deprecation.h" | 10 #include "core/frame/Deprecation.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if (!touch_info.touch_node) | 359 if (!touch_info.touch_node) |
360 continue; | 360 continue; |
361 if (!touch_sequence_document_) { | 361 if (!touch_sequence_document_) { |
362 // Keep track of which document should receive all touch events | 362 // Keep track of which document should receive all touch events |
363 // in the active sequence. This must be a single document to | 363 // in the active sequence. This must be a single document to |
364 // ensure we don't leak Nodes between documents. | 364 // ensure we don't leak Nodes between documents. |
365 touch_sequence_document_ = &(touch_info.touch_node->GetDocument()); | 365 touch_sequence_document_ = &(touch_info.touch_node->GetDocument()); |
366 DCHECK(touch_sequence_document_->GetFrame()->View()); | 366 DCHECK(touch_sequence_document_->GetFrame()->View()); |
367 } | 367 } |
368 | 368 |
369 // Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id()) | 369 // Ideally we'd DCHECK(!m_targetForTouchID.contains(point.id()) |
370 // since we shouldn't get a touchstart for a touch that's already | 370 // since we shouldn't get a touchstart for a touch that's already |
371 // down. However EventSender allows this to be violated and there's | 371 // down. However EventSender allows this to be violated and there's |
372 // some tests that take advantage of it. There may also be edge | 372 // some tests that take advantage of it. There may also be edge |
373 // cases in the browser where this happens. | 373 // cases in the browser where this happens. |
374 // See http://crbug.com/345372. | 374 // See http://crbug.com/345372. |
375 target_for_touch_id_.Set(touch_info.point.id, touch_info.touch_node); | 375 target_for_touch_id_.Set(touch_info.point.id, touch_info.touch_node); |
376 | 376 |
377 region_for_touch_id_.Set(touch_info.point.id, touch_info.region); | 377 region_for_touch_id_.Set(touch_info.point.id, touch_info.region); |
378 | 378 |
379 TouchAction effective_touch_action = | 379 TouchAction effective_touch_action = |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 466 |
467 for (unsigned i = 0; i < event.touches_length; ++i) { | 467 for (unsigned i = 0; i < event.touches_length; ++i) { |
468 WebTouchPoint::State state = event.touches[i].state; | 468 WebTouchPoint::State state = event.touches[i].state; |
469 if (state != WebTouchPoint::kStatePressed) | 469 if (state != WebTouchPoint::kStatePressed) |
470 new_touch_sequence = false; | 470 new_touch_sequence = false; |
471 if (state != WebTouchPoint::kStateReleased && | 471 if (state != WebTouchPoint::kStateReleased && |
472 state != WebTouchPoint::kStateCancelled) | 472 state != WebTouchPoint::kStateCancelled) |
473 all_touches_released = false; | 473 all_touches_released = false; |
474 } | 474 } |
475 if (new_touch_sequence) { | 475 if (new_touch_sequence) { |
476 // Ideally we'd ASSERT(!m_touchSequenceDocument) here since we should | 476 // Ideally we'd DCHECK(!m_touchSequenceDocument) here since we should |
477 // have cleared the active document when we saw the last release. But we | 477 // have cleared the active document when we saw the last release. But we |
478 // have some tests that violate this, ClusterFuzz could trigger it, and | 478 // have some tests that violate this, ClusterFuzz could trigger it, and |
479 // there may be cases where the browser doesn't reliably release all | 479 // there may be cases where the browser doesn't reliably release all |
480 // touches. http://crbug.com/345372 tracks this. | 480 // touches. http://crbug.com/345372 tracks this. |
481 touch_sequence_document_.Clear(); | 481 touch_sequence_document_.Clear(); |
482 } | 482 } |
483 | 483 |
484 DCHECK(frame_->View()); | 484 DCHECK(frame_->View()); |
485 if (touch_sequence_document_ && | 485 if (touch_sequence_document_ && |
486 (!touch_sequence_document_->GetFrame() || | 486 (!touch_sequence_document_->GetFrame() || |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 529 |
530 return DispatchTouchEvents(event, coalesced_events, touch_infos, | 530 return DispatchTouchEvents(event, coalesced_events, touch_infos, |
531 all_touches_released); | 531 all_touches_released); |
532 } | 532 } |
533 | 533 |
534 bool TouchEventManager::IsAnyTouchActive() const { | 534 bool TouchEventManager::IsAnyTouchActive() const { |
535 return touch_pressed_; | 535 return touch_pressed_; |
536 } | 536 } |
537 | 537 |
538 } // namespace blink | 538 } // namespace blink |
OLD | NEW |