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

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

Issue 2844823002: Support Coalesced Touch in ppapi (Closed)
Patch Set: Support Coalesced Touch in ppapi Created 3 years, 7 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 481207383cb7f484320e39fe3800b1b9ebfefe15..643ecf8b4930143cedcd2e70c47fa651c7d8e7f2 100644
--- a/third_party/WebKit/Source/core/events/TouchEvent.cpp
+++ b/third_party/WebKit/Source/core/events/TouchEvent.cpp
@@ -36,6 +36,7 @@
#include "platform/Histogram.h"
#include "platform/bindings/DOMWrapperWorld.h"
#include "platform/bindings/ScriptState.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_(TouchAction::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,8 @@ 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));
+ DCHECK(WebInputEvent::IsTouchEventType(event.Event().GetType()));
+ native_event_.reset(new WebCoalescedInputEvent(event));
}
TouchEvent::TouchEvent(const AtomicString& type,
@@ -267,7 +273,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 +344,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() {
« no previous file with comments | « third_party/WebKit/Source/core/events/TouchEvent.h ('k') | third_party/WebKit/Source/core/events/TouchEventTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698