Index: ui/android/view_android.h |
diff --git a/ui/android/view_android.h b/ui/android/view_android.h |
index 1b219e8f840f813d8ad9d585e1b6caaccae2c4c5..de4be143ac51903cccb230bcc2e8fde87f4d9fde 100644 |
--- a/ui/android/view_android.h |
+++ b/ui/android/view_android.h |
@@ -18,6 +18,7 @@ class Layer; |
} |
namespace ui { |
+class DragEventAndroid; |
class EventForwarder; |
class MotionEventAndroid; |
class ViewClient; |
@@ -63,13 +64,20 @@ class UI_ANDROID_EXPORT ViewAndroid { |
}; |
// Layout parameters used to set the view's position and size. |
- // Position is in parent's coordinate space. |
+ // Position is in parent's coordinate space, and all the values |
+ // are in CSS pixel. |
struct LayoutParams { |
static LayoutParams MatchParent() { return {true, 0, 0, 0, 0}; } |
static LayoutParams Normal(int x, int y, int width, int height) { |
return {false, x, y, width, height}; |
}; |
+ bool HitBy(const gfx::Point& point) { |
boliu
2017/05/24 22:54:02
this should not be part of the public interface
p
Jinsuk Kim
2017/05/25 03:18:19
Reverted (inlined it back).
|
+ if (match_parent) |
+ return true; |
+ return gfx::Rect(x, y, width, height).Contains(point); |
+ } |
+ |
bool match_parent; // Bounds matches that of the parent if true. |
int x; |
int y; |
@@ -151,6 +159,8 @@ class UI_ANDROID_EXPORT ViewAndroid { |
float GetDipScale(); |
+ bool HitBy(const gfx::Point& point); |
boliu
2017/05/24 22:54:02
ditto does this need to be public?
Jinsuk Kim
2017/05/25 03:18:18
Mistake. changed to private.
|
+ |
protected: |
ViewAndroid* parent_; |
@@ -158,25 +168,29 @@ class UI_ANDROID_EXPORT ViewAndroid { |
friend class EventForwarder; |
friend class ViewAndroidBoundsTest; |
- using ViewClientCallback = |
- const base::Callback<bool(ViewClient*, const MotionEventAndroid&)>; |
- |
+ bool OnDragEvent(const DragEventAndroid& event); |
bool OnTouchEvent(const MotionEventAndroid& event, bool for_touch_handle); |
bool OnMouseEvent(const MotionEventAndroid& event); |
bool OnMouseWheelEvent(const MotionEventAndroid& event); |
void RemoveChild(ViewAndroid* child); |
- bool HitTest(ViewClientCallback send_to_client, |
- const MotionEventAndroid& event); |
+ template <typename E, typename T> |
+ bool HitTest(T send_to_client, const E& event, const gfx::Point& point); |
+ static bool SendDragEventToClient(ViewClient* client, |
+ const DragEventAndroid& event, |
+ const gfx::Point& point); |
static bool SendTouchEventToClient(bool for_touch_handle, |
ViewClient* client, |
- const MotionEventAndroid& event); |
+ const MotionEventAndroid& event, |
+ const gfx::Point& point); |
static bool SendMouseEventToClient(ViewClient* client, |
- const MotionEventAndroid& event); |
+ const MotionEventAndroid& event, |
+ const gfx::Point& point); |
static bool SendMouseWheelEventToClient(ViewClient* client, |
- const MotionEventAndroid& event); |
+ const MotionEventAndroid& event, |
+ const gfx::Point& point); |
bool has_event_forwarder() const { return !!event_forwarder_; } |