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

Unified Diff: ui/events/blink/blink_event_util.h

Issue 2552853002: [Compositor event queue] Coalesce gesture scroll&pinch of the same sequence (Closed)
Patch Set: dtapuska's review 2 - Allocate |last_gesture_event| on stack; inline |ToWebGestureEvent| Created 4 years 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
« no previous file with comments | « ui/events/blink/DEPS ('k') | ui/events/blink/blink_event_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/blink/blink_event_util.h
diff --git a/ui/events/blink/blink_event_util.h b/ui/events/blink/blink_event_util.h
index 5636d58b28511f0351c00c98d97ee86d628772f1..8759205500a4b915dd116e364f870e9d1de09ab6 100644
--- a/ui/events/blink/blink_event_util.h
+++ b/ui/events/blink/blink_event_util.h
@@ -7,12 +7,11 @@
#include <memory>
+#include "third_party/WebKit/public/platform/WebGestureEvent.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "ui/events/gesture_detection/motion_event.h"
namespace blink {
-class WebGestureEvent;
-class WebInputEvent;
class WebTouchEvent;
}
@@ -33,6 +32,16 @@ bool CanCoalesce(const blink::WebInputEvent& event_to_coalesce,
void Coalesce(const blink::WebInputEvent& event_to_coalesce,
blink::WebInputEvent* event);
+bool IsCompatibleScrollorPinch(const blink::WebGestureEvent& new_event,
+ const blink::WebGestureEvent& event_in_queue);
+
+// Coalesces 3 GestureScroll/PinchUpdate into 2 events.
+// Returns <GestureScrollUpdate, GesturePinchUpdate>.
+std::pair<blink::WebGestureEvent, blink::WebGestureEvent>
+CoalesceScrollAndPinch(const blink::WebGestureEvent* second_last_event,
+ const blink::WebGestureEvent& last_event,
+ const blink::WebGestureEvent& new_event);
+
blink::WebTouchEvent CreateWebTouchEventFromMotionEvent(
const MotionEvent& event,
bool may_cause_scrolling);
@@ -84,6 +93,18 @@ bool IsGestureScollOrPinch(blink::WebInputEvent::Type);
bool IsContinuousGestureEvent(blink::WebInputEvent::Type);
+inline const blink::WebGestureEvent* ToWebGestureEvent(
tdresser 2016/12/13 17:18:19 The asymmetry of these methods is a bit tricky. Co
chongz 2016/12/13 18:55:45 Removed the pointer version. However I'm not enti
+ const blink::WebInputEvent* event) {
+ DCHECK(!event || IsGestureScollOrPinch(event->type));
+ return static_cast<const blink::WebGestureEvent*>(event);
+}
+
+inline const blink::WebGestureEvent& ToWebGestureEvent(
+ const blink::WebInputEvent& event) {
+ DCHECK(IsGestureScollOrPinch(event.type));
+ return static_cast<const blink::WebGestureEvent&>(event);
+}
+
} // namespace ui
#endif // UI_EVENTS_BLINK_BLINK_EVENT_UTIL_H_
« no previous file with comments | « ui/events/blink/DEPS ('k') | ui/events/blink/blink_event_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698