OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/input/gesture_event_stream_validator.h" | 5 #include "content/common/input/gesture_event_stream_validator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "content/common/input/web_input_event_traits.h" | 9 #include "content/common/input/web_input_event_traits.h" |
10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 if (scrolling_) | 33 if (scrolling_) |
34 error_msg->append("Scroll begin during scroll\n"); | 34 error_msg->append("Scroll begin during scroll\n"); |
35 if (pinching_) | 35 if (pinching_) |
36 error_msg->append("Scroll begin during pinch\n"); | 36 error_msg->append("Scroll begin during pinch\n"); |
37 scrolling_ = true; | 37 scrolling_ = true; |
38 break; | 38 break; |
39 case WebInputEvent::GestureScrollUpdate: | 39 case WebInputEvent::GestureScrollUpdate: |
40 if (!scrolling_) | 40 if (!scrolling_) |
41 error_msg->append("Scroll update outside of scroll\n"); | 41 error_msg->append("Scroll update outside of scroll\n"); |
42 break; | 42 break; |
| 43 // add validators for smoothscroll |
43 case WebInputEvent::GestureFlingStart: | 44 case WebInputEvent::GestureFlingStart: |
44 if (event.sourceDevice == blink::WebGestureDeviceTouchscreen && | 45 if (event.sourceDevice == blink::WebGestureDeviceTouchscreen && |
45 !event.data.flingStart.velocityX && | 46 !event.data.flingStart.velocityX && |
46 !event.data.flingStart.velocityY) { | 47 !event.data.flingStart.velocityY && |
| 48 !event.data.flingStart.isSmoothScroll) { |
47 error_msg->append("Zero velocity touchscreen fling\n"); | 49 error_msg->append("Zero velocity touchscreen fling\n"); |
48 } | 50 } |
| 51 if (event.sourceDevice == blink::WebGestureDeviceTouchscreen && |
| 52 event.data.flingStart.isSmoothScroll && !event.data.flingStart.dx && |
| 53 !event.data.flingStart.dy) { |
| 54 error_msg->append("Zero distance smooth scroll\n"); |
| 55 } |
49 if (!scrolling_) | 56 if (!scrolling_) |
50 error_msg->append("Fling start outside of scroll\n"); | 57 error_msg->append("Fling start outside of scroll\n"); |
51 if (pinching_) | 58 if (pinching_) |
52 error_msg->append("Flinging while pinching\n"); | 59 error_msg->append("Flinging while pinching\n"); |
53 scrolling_ = false; | 60 scrolling_ = false; |
54 break; | 61 break; |
55 case WebInputEvent::GestureScrollEnd: | 62 case WebInputEvent::GestureScrollEnd: |
56 if (!scrolling_) | 63 if (!scrolling_) |
57 error_msg->append("Scroll end outside of scroll\n"); | 64 error_msg->append("Scroll end outside of scroll\n"); |
58 if (pinching_) | 65 if (pinching_) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // preceding TapDown. | 104 // preceding TapDown. |
98 waiting_for_tap_end_ = false; | 105 waiting_for_tap_end_ = false; |
99 break; | 106 break; |
100 default: | 107 default: |
101 break; | 108 break; |
102 } | 109 } |
103 return error_msg->empty(); | 110 return error_msg->empty(); |
104 } | 111 } |
105 | 112 |
106 } // namespace content | 113 } // namespace content |
OLD | NEW |