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

Unified Diff: Source/platform/PlatformGestureEvent.h

Issue 338543003: Gesture event hit test refactoring and reduction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge with trunk Created 6 years, 6 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: Source/platform/PlatformGestureEvent.h
diff --git a/Source/platform/PlatformGestureEvent.h b/Source/platform/PlatformGestureEvent.h
index 254224640898f9ccbc5dfc7b613207f82a226dcc..2a9b4ab770e5ba5091e7ea4ff38e37cd270abff9 100644
--- a/Source/platform/PlatformGestureEvent.h
+++ b/Source/platform/PlatformGestureEvent.h
@@ -49,15 +49,16 @@ public:
, m_globalPosition(globalPosition)
, m_area(area)
{
- ASSERT(type == PlatformEvent::GestureScrollBegin
+ memset(&m_data, 0, sizeof(m_data));
+ if (type == PlatformEvent::GestureScrollBegin
|| type == PlatformEvent::GestureScrollEnd
|| type == PlatformEvent::GestureScrollUpdate
- || type == PlatformEvent::GestureScrollUpdateWithoutPropagation);
- memset(&m_data, 0, sizeof(m_data));
- m_data.m_scrollUpdate.m_deltaX = deltaX;
- m_data.m_scrollUpdate.m_deltaY = deltaY;
- m_data.m_scrollUpdate.m_velocityX = velocityX;
- m_data.m_scrollUpdate.m_velocityY = velocityY;
+ || type == PlatformEvent::GestureScrollUpdateWithoutPropagation) {
+ m_data.m_scrollUpdate.m_deltaX = deltaX;
+ m_data.m_scrollUpdate.m_deltaY = deltaY;
+ m_data.m_scrollUpdate.m_velocityX = velocityX;
+ m_data.m_scrollUpdate.m_velocityY = velocityY;
+ }
}
const IntPoint& position() const { return m_position; } // PlatformWindow coordinates.
@@ -105,6 +106,30 @@ public:
return m_data.m_pinchUpdate.m_scale;
}
+ void applyTouchAdjustment(const IntPoint& adjustedPosition)
+ {
+ // Update the window-relative position of the event so that the node that was
+ // ultimately hit is under this point (i.e. elementFromPoint for the client
+ // co-ordinates in a 'click' event should yield the target). The global
+ // position is intentionally left unmodified because it's intended to reflect
+ // raw co-ordinates unrelated to any content.
+ m_position = adjustedPosition;
+ }
+
+ bool isScrollEvent() const
+ {
+ switch (m_type) {
+ case GestureScrollBegin:
+ case GestureScrollEnd:
+ case GestureScrollUpdate:
+ case GestureScrollUpdateWithoutPropagation:
+ case GestureFlingStart:
+ return true;
+ default:
+ return false;
esprehn 2014/06/27 08:33:58 Can you list them all instead? Then when someone a
Rick Byers 2014/06/27 15:38:24 Done.
+ }
+ }
+
protected:
IntPoint m_position;
IntPoint m_globalPosition;

Powered by Google App Engine
This is Rietveld 408576698