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

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

Issue 2858963002: Replace ASSERT with DCHECK in core/ (Closed)
Patch Set: WorkerBackingThread Created 3 years, 7 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/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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 continue; 347 continue;
348 } 348 }
349 } 349 }
350 if (!touch_info.touch_node) 350 if (!touch_info.touch_node)
351 continue; 351 continue;
352 if (!touch_sequence_document_) { 352 if (!touch_sequence_document_) {
353 // Keep track of which document should receive all touch events 353 // Keep track of which document should receive all touch events
354 // in the active sequence. This must be a single document to 354 // in the active sequence. This must be a single document to
355 // ensure we don't leak Nodes between documents. 355 // ensure we don't leak Nodes between documents.
356 touch_sequence_document_ = &(touch_info.touch_node->GetDocument()); 356 touch_sequence_document_ = &(touch_info.touch_node->GetDocument());
357 ASSERT(touch_sequence_document_->GetFrame()->View()); 357 DCHECK(touch_sequence_document_->GetFrame()->View());
358 } 358 }
359 359
360 // Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id()) 360 // Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id())
361 // since we shouldn't get a touchstart for a touch that's already 361 // since we shouldn't get a touchstart for a touch that's already
362 // down. However EventSender allows this to be violated and there's 362 // down. However EventSender allows this to be violated and there's
363 // some tests that take advantage of it. There may also be edge 363 // some tests that take advantage of it. There may also be edge
364 // cases in the browser where this happens. 364 // cases in the browser where this happens.
365 // See http://crbug.com/345372. 365 // See http://crbug.com/345372.
366 target_for_touch_id_.Set(touch_info.point.id, touch_info.touch_node); 366 target_for_touch_id_.Set(touch_info.point.id, touch_info.touch_node);
367 367
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // differentiate between a one and two finger gesture), but we won't 424 // differentiate between a one and two finger gesture), but we won't
425 // actually dispatch any events for it. Set the target to the 425 // actually dispatch any events for it. Set the target to the
426 // Document so that there's some valid node here. Perhaps this 426 // Document so that there's some valid node here. Perhaps this
427 // should really be LocalDOMWindow, but in all other cases the target of 427 // should really be LocalDOMWindow, but in all other cases the target of
428 // a Touch is a Node so using the window could be a breaking change. 428 // a Touch is a Node so using the window could be a breaking change.
429 // Since we know there was no handler invoked, the specific target 429 // Since we know there was no handler invoked, the specific target
430 // should be completely irrelevant to the application. 430 // should be completely irrelevant to the application.
431 touch_node = touch_sequence_document_; 431 touch_node = touch_sequence_document_;
432 target_frame = touch_sequence_document_->GetFrame(); 432 target_frame = touch_sequence_document_->GetFrame();
433 } 433 }
434 ASSERT(target_frame); 434 DCHECK(target_frame);
435 435
436 // pagePoint should always be in the target element's document coordinates. 436 // pagePoint should always be in the target element's document coordinates.
437 FloatPoint page_point = 437 FloatPoint page_point =
438 target_frame->View()->RootFrameToContents(touch_info.point.position); 438 target_frame->View()->RootFrameToContents(touch_info.point.position);
439 float scale_factor = 1.0f / target_frame->PageZoomFactor(); 439 float scale_factor = 1.0f / target_frame->PageZoomFactor();
440 440
441 touch_info.touch_node = touch_node; 441 touch_info.touch_node = touch_node;
442 touch_info.target_frame = target_frame; 442 touch_info.target_frame = target_frame;
443 touch_info.content_point = page_point.ScaledBy(scale_factor); 443 touch_info.content_point = page_point.ScaledBy(scale_factor);
444 touch_info.adjusted_radius = 444 touch_info.adjusted_radius =
(...skipping 20 matching lines...) Expand all
465 } 465 }
466 if (new_touch_sequence) { 466 if (new_touch_sequence) {
467 // Ideally we'd ASSERT(!m_touchSequenceDocument) here since we should 467 // Ideally we'd ASSERT(!m_touchSequenceDocument) here since we should
468 // have cleared the active document when we saw the last release. But we 468 // have cleared the active document when we saw the last release. But we
469 // have some tests that violate this, ClusterFuzz could trigger it, and 469 // have some tests that violate this, ClusterFuzz could trigger it, and
470 // there may be cases where the browser doesn't reliably release all 470 // there may be cases where the browser doesn't reliably release all
471 // touches. http://crbug.com/345372 tracks this. 471 // touches. http://crbug.com/345372 tracks this.
472 touch_sequence_document_.Clear(); 472 touch_sequence_document_.Clear();
473 } 473 }
474 474
475 ASSERT(frame_->View()); 475 DCHECK(frame_->View());
476 if (touch_sequence_document_ && 476 if (touch_sequence_document_ &&
477 (!touch_sequence_document_->GetFrame() || 477 (!touch_sequence_document_->GetFrame() ||
478 !touch_sequence_document_->GetFrame()->View())) { 478 !touch_sequence_document_->GetFrame()->View())) {
479 // If the active touch document has no frame or view, it's probably being 479 // If the active touch document has no frame or view, it's probably being
480 // destroyed so we can't dispatch events. 480 // destroyed so we can't dispatch events.
481 return false; 481 return false;
482 } 482 }
483 483
484 UpdateTargetAndRegionMapsForTouchStarts(touch_infos); 484 UpdateTargetAndRegionMapsForTouchStarts(touch_infos);
485 485
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 } 518 }
519 519
520 return DispatchTouchEvents(event, touch_infos, all_touches_released); 520 return DispatchTouchEvents(event, touch_infos, all_touches_released);
521 } 521 }
522 522
523 bool TouchEventManager::IsAnyTouchActive() const { 523 bool TouchEventManager::IsAnyTouchActive() const {
524 return touch_pressed_; 524 return touch_pressed_;
525 } 525 }
526 526
527 } // namespace blink 527 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | third_party/WebKit/Source/core/inspector/DOMEditor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698