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

Side by Side Diff: ui/events/blink/blink_event_util.cc

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and non-const ref passed back 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
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "ui/events/blink/blink_event_util.h" 8 #include "ui/events/blink/blink_event_util.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( 162 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent(
163 const MotionEvent& event, 163 const MotionEvent& event,
164 bool moved_beyond_slop_region) { 164 bool moved_beyond_slop_region) {
165 static_assert(static_cast<int>(MotionEvent::MAX_TOUCH_POINT_COUNT) == 165 static_assert(static_cast<int>(MotionEvent::MAX_TOUCH_POINT_COUNT) ==
166 static_cast<int>(blink::WebTouchEvent::touchesLengthCap), 166 static_cast<int>(blink::WebTouchEvent::touchesLengthCap),
167 "inconsistent maximum number of active touch points"); 167 "inconsistent maximum number of active touch points");
168 168
169 blink::WebTouchEvent result; 169 blink::WebTouchEvent result;
170 170
171 result.type = ToWebInputEventType(event.GetAction()); 171 result.type = ToWebInputEventType(event.GetAction());
172 result.cancelable = (result.type != WebInputEvent::TouchCancel); 172 result.dispatchType = result.type == WebInputEvent::TouchCancel
173 ? WebInputEvent::EventNonBlocking
174 : WebInputEvent::Blocking;
173 result.timeStampSeconds = 175 result.timeStampSeconds =
174 (event.GetEventTime() - base::TimeTicks()).InSecondsF(); 176 (event.GetEventTime() - base::TimeTicks()).InSecondsF();
175 result.movedBeyondSlopRegion = moved_beyond_slop_region; 177 result.movedBeyondSlopRegion = moved_beyond_slop_region;
176 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags()); 178 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags());
177 DCHECK_NE(event.GetUniqueEventId(), 0U); 179 DCHECK_NE(event.GetUniqueEventId(), 0U);
178 result.uniqueTouchEventId = event.GetUniqueEventId(); 180 result.uniqueTouchEventId = event.GetUniqueEventId();
179 result.touchesLength = 181 result.touchesLength =
180 std::min(static_cast<unsigned>(event.GetPointerCount()), 182 std::min(static_cast<unsigned>(event.GetPointerCount()),
181 static_cast<unsigned>(WebTouchEvent::touchesLengthCap)); 183 static_cast<unsigned>(WebTouchEvent::touchesLengthCap));
182 DCHECK_GT(result.touchesLength, 0U); 184 DCHECK_GT(result.touchesLength, 0U);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 case MotionEvent::TOOL_TYPE_MOUSE: 458 case MotionEvent::TOOL_TYPE_MOUSE:
457 return WebPointerProperties::PointerType::Mouse; 459 return WebPointerProperties::PointerType::Mouse;
458 case MotionEvent::TOOL_TYPE_ERASER: 460 case MotionEvent::TOOL_TYPE_ERASER:
459 return WebPointerProperties::PointerType::Unknown; 461 return WebPointerProperties::PointerType::Unknown;
460 } 462 }
461 NOTREACHED() << "Invalid MotionEvent::ToolType = " << tool_type; 463 NOTREACHED() << "Invalid MotionEvent::ToolType = " << tool_type;
462 return WebPointerProperties::PointerType::Unknown; 464 return WebPointerProperties::PointerType::Unknown;
463 } 465 }
464 466
465 } // namespace ui 467 } // namespace ui
OLDNEW
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698