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

Side by Side Diff: content/common/input/touch_event_stream_validator.cc

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: Rebased 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 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/touch_event_stream_validator.h" 5 #include "content/common/input/touch_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 "content/common/input/web_touch_event_traits.h" 10 #include "content/common/input/web_touch_event_traits.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 TouchEventStreamValidator::~TouchEventStreamValidator() { 43 TouchEventStreamValidator::~TouchEventStreamValidator() {
44 } 44 }
45 45
46 bool TouchEventStreamValidator::Validate(const WebTouchEvent& event, 46 bool TouchEventStreamValidator::Validate(const WebTouchEvent& event,
47 std::string* error_msg) { 47 std::string* error_msg) {
48 DCHECK(error_msg); 48 DCHECK(error_msg);
49 error_msg->clear(); 49 error_msg->clear();
50 50
51 // TouchScrollStarted is not part of a regular touch event stream.
52 if (event.type == WebInputEvent::TouchScrollStarted)
53 return true;
54
51 WebTouchEvent previous_event = previous_event_; 55 WebTouchEvent previous_event = previous_event_;
52 previous_event_ = event; 56 previous_event_ = event;
53 57
54 if (!event.touchesLength) { 58 if (!event.touchesLength) {
55 error_msg->append("Touch event is empty.\n"); 59 error_msg->append("Touch event is empty.\n");
56 return false; 60 return false;
57 } 61 }
58 62
59 if (!WebInputEvent::isTouchEventType(event.type)) { 63 if (!WebInputEvent::isTouchEventType(event.type)) {
60 error_msg->append(StringPrintf("Touch event has invalid type: %s\n", 64 error_msg->append(StringPrintf("Touch event has invalid type: %s\n",
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (!found_valid_state_for_type) { 160 if (!found_valid_state_for_type) {
157 error_msg->append( 161 error_msg->append(
158 StringPrintf("No valid touch point corresponding to event type: %s\n", 162 StringPrintf("No valid touch point corresponding to event type: %s\n",
159 WebInputEventTraits::GetName(event.type))); 163 WebInputEventTraits::GetName(event.type)));
160 } 164 }
161 165
162 return error_msg->empty(); 166 return error_msg->empty();
163 } 167 }
164 168
165 } // namespace content 169 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/common/input/web_input_event_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698