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

Unified Diff: third_party/WebKit/Source/core/events/TouchEvent.cpp

Issue 2844823002: Support Coalesced Touch in ppapi (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/events/TouchEvent.cpp
diff --git a/third_party/WebKit/Source/core/events/TouchEvent.cpp b/third_party/WebKit/Source/core/events/TouchEvent.cpp
index 634c0f86983f5fcf80d18dadce6d86112fec581c..4dccc3456e4e6a55efc7d94bc1c53fac445bac80 100644
--- a/third_party/WebKit/Source/core/events/TouchEvent.cpp
+++ b/third_party/WebKit/Source/core/events/TouchEvent.cpp
@@ -36,6 +36,7 @@
#include "core/input/InputDeviceCapabilities.h"
#include "core/inspector/ConsoleMessage.h"
#include "platform/Histogram.h"
+#include "public/platform/WebCoalescedInputEvent.h"
namespace blink {
@@ -196,13 +197,17 @@ void LogTouchTargetHistogram(EventTarget* event_target,
static_cast<TouchTargetAndDispatchResultType>(result));
}
+// Helper function to get WebTouchEvent from WebCoalescedInputEvent.
+const WebTouchEvent* GetWebTouchEvent(const WebCoalescedInputEvent& event) {
+ return static_cast<const WebTouchEvent*>(&event.Event());
+}
} // namespace
TouchEvent::TouchEvent()
: default_prevented_before_current_target_(false),
current_touch_action_(kTouchActionAuto) {}
-TouchEvent::TouchEvent(const WebTouchEvent& event,
+TouchEvent::TouchEvent(const WebCoalescedInputEvent& event,
TouchList* touches,
TouchList* target_touches,
TouchList* changed_touches,
@@ -215,11 +220,11 @@ TouchEvent::TouchEvent(const WebTouchEvent& event,
: UIEventWithKeyState(
type,
true,
- event.IsCancelable(),
+ GetWebTouchEvent(event)->IsCancelable(),
view,
0,
- static_cast<WebInputEvent::Modifiers>(event.GetModifiers()),
- TimeTicks::FromSeconds(event.TimeStampSeconds()),
+ static_cast<WebInputEvent::Modifiers>(event.Event().GetModifiers()),
+ TimeTicks::FromSeconds(event.Event().TimeStampSeconds()),
view ? view->GetInputDeviceCapabilities()->FiresTouchEvents(true)
: nullptr),
touches_(touches),
@@ -227,7 +232,7 @@ TouchEvent::TouchEvent(const WebTouchEvent& event,
changed_touches_(changed_touches),
default_prevented_before_current_target_(false),
current_touch_action_(current_touch_action) {
- native_event_.reset(new WebTouchEvent(event));
+ native_event_.reset(new WebCoalescedInputEvent(event));
}
TouchEvent::TouchEvent(const AtomicString& type,
@@ -267,7 +272,7 @@ void TouchEvent::preventDefault() {
}
if (native_event_ &&
- native_event_->dispatch_type ==
+ GetWebTouchEvent(*native_event_)->dispatch_type ==
WebInputEvent::
kListenersForcedNonBlockingDueToMainThreadResponsiveness) {
// Non blocking due to main thread responsiveness.
@@ -338,7 +343,7 @@ void TouchEvent::preventDefault() {
bool TouchEvent::IsTouchStartOrFirstTouchMove() const {
if (!native_event_)
return false;
- return native_event_->touch_start_or_first_touch_move;
+ return GetWebTouchEvent(*native_event_)->touch_start_or_first_touch_move;
}
void TouchEvent::DoneDispatchingEventAtCurrentTarget() {

Powered by Google App Engine
This is Rietveld 408576698