Chromium Code Reviews| 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 "ui/events/gestures/gesture_sequence.h" | 5 #include "ui/events/gestures/gesture_sequence.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 point.Reset(); | 589 point.Reset(); |
| 590 --point_count_; | 590 --point_count_; |
| 591 CHECK_GE(point_count_, 0); | 591 CHECK_GE(point_count_, 0); |
| 592 RecreateBoundingBox(); | 592 RecreateBoundingBox(); |
| 593 if (state_ == GS_PINCH) { | 593 if (state_ == GS_PINCH) { |
| 594 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_); | 594 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_); |
| 595 pinch_distance_start_ = pinch_distance_current_; | 595 pinch_distance_start_ = pinch_distance_current_; |
| 596 } | 596 } |
| 597 } | 597 } |
| 598 | 598 |
| 599 const ui::LatencyInfo* touch_latency = event.latency(); | 599 // If the touch event does not cause any rendering scheduled, then |
| 600 Gestures::iterator it = gestures->begin(); | 600 // 1) If the touch event does not generate any gesture event, its |
| 601 for (; it != gestures->end(); it++) { | 601 // LatencyInfo ends here. |
| 602 (*it)->latency()->MergeWith(*touch_latency); | 602 // 2) If the touch event generates gesture events, its latencyinfo |
| 603 // is copied into the gesture events. | |
| 604 if (!event.latency()->FindLatency( | |
| 605 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | |
| 606 if (gestures->empty()) { | |
| 607 ui::LatencyInfo* touch_latency = | |
| 608 const_cast<ui::LatencyInfo*>(event.latency()); | |
| 609 touch_latency->AddLatencyNumber( | |
| 610 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | |
| 611 } else { | |
| 612 Gestures::iterator it = gestures->begin(); | |
| 613 for (; it != gestures->end(); it++) { | |
| 614 (*it)->latency()->MergeWith(*event.latency()); | |
| 615 // Inheriting the trace_id from the touch event's LatencyInfo | |
| 616 (*it)->latency()->trace_id = event.latency()->trace_id; | |
| 617 } | |
| 618 } | |
|
sadrul
2013/10/09 19:23:27
Please move this block of code into a separate ind
Yufeng Shen (Slow to review)
2013/10/09 20:53:50
Done.
| |
| 603 } | 619 } |
| 604 | 620 |
| 605 return gestures.release(); | 621 return gestures.release(); |
| 606 } | 622 } |
| 607 | 623 |
| 608 void GestureSequence::RecreateBoundingBox() { | 624 void GestureSequence::RecreateBoundingBox() { |
| 609 // TODO(sad): Recreating the bounding box at every touch-event is not very | 625 // TODO(sad): Recreating the bounding box at every touch-event is not very |
| 610 // efficient. This should be made better. | 626 // efficient. This should be made better. |
| 611 if (point_count_ == 0) { | 627 if (point_count_ == 0) { |
| 612 bounding_box_.SetRect(0, 0, 0, 0); | 628 bounding_box_.SetRect(0, 0, 0, 0); |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1229 return; | 1245 return; |
| 1230 | 1246 |
| 1231 // Since long press timer has been started, there should be a non-NULL point. | 1247 // Since long press timer has been started, there should be a non-NULL point. |
| 1232 const GesturePoint* point = GetPointByPointId(0); | 1248 const GesturePoint* point = GetPointByPointId(0); |
| 1233 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 1249 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
| 1234 event.location())) | 1250 event.location())) |
| 1235 GetLongPressTimer()->Stop(); | 1251 GetLongPressTimer()->Stop(); |
| 1236 } | 1252 } |
| 1237 | 1253 |
| 1238 } // namespace ui | 1254 } // namespace ui |
| OLD | NEW |