Chromium Code Reviews| Index: ui/views/view.h |
| diff --git a/ui/views/view.h b/ui/views/view.h |
| index 2d028ef289e32b96e6c48006160f5199f2ad9af8..32e4a339872e4a632024ac3cbc91a2096e8fd5fe 100644 |
| --- a/ui/views/view.h |
| +++ b/ui/views/view.h |
| @@ -410,6 +410,15 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| const View* target, |
| gfx::Point* point); |
| + // Convert |rect| from the coordinate system of one View to another. |
| + // |
| + // |source| and |target| must be in the same widget, but doesn't need to be in |
| + // the same view hierarchy. |
| + // |source| can be NULL in which case it means the screen coordinate system. |
| + static void ConvertRectToTarget(const View* source, |
| + const View* target, |
| + gfx::Rect* rect); |
|
tdanderson
2012/09/18 19:19:02
nit: spacing
|
| + |
| // Convert a point from a View's coordinate system to that of its Widget. |
| static void ConvertPointToWidget(const View* src, gfx::Point* point); |
| @@ -500,7 +509,10 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // view's coordinates, except for a RootView. |
| // Returns the deepest visible descendant that contains the specified point. |
| - virtual View* GetEventHandlerForPoint(const gfx::Point& point); |
| + View* GetEventHandlerForPoint(const gfx::Point& point); |
| + |
| + // Returns the appropriate event handler for the given touch rect. |
|
sky
2012/09/18 19:51:41
If this is specific to touch, it should be named s
|
| + View* GetEventHandlerForRect(const gfx::Rect& rect); |
| // Return the cursor that should be used for this view or the default cursor. |
| // The event location is in the receiver's coordinate system. The caller is |
| @@ -1041,7 +1053,20 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // Called by HitTestRect() to retrieve a mask for hit-testing against. |
| // Subclasses override to provide custom shaped hit test regions. |
| virtual void GetHitTestMask(gfx::Path* mask) const; |
| - |
| +public: |
|
girard
2012/09/18 16:58:52
make protected.
This will mess up all the other he
sky
2012/09/18 19:51:41
Huh? Move the enum and function to the right secti
|
| + // Flags the event type, so that a single GetEvent routine can handle both. |
| + enum EventType { MOUSE, TOUCH }; |
|
sky
2012/09/18 19:51:41
Make these more descriptive. Maybe EventHandlerTyp
|
| + |
| + // Returns the appropriate event handler for the given |rect|. Location will |
| + // either be a rect (for a touch event) or a point (as a 1X1 rect) for a |
| + // mouse event. |
| + // Considers the bounding rectangles of all leaf descendant views that have |
| + // at least views::kFuzzingOverlapPercentage of their area covered by |
| + // |rect|. Among these rectangles, choose one that is closest to the center |
| + // line of |rect| and return its corresponding View. If there are no such |
| + // rectangles, NULL is returned. |
|
tdanderson
2012/09/18 19:19:02
I think this description is from my old patch. Are
|
| + virtual View* GetEventHandler(const gfx::Rect& rect, EventType type); |
| +protected: |
| // Focus --------------------------------------------------------------------- |
| // Override to be notified when focus has changed either to or from this View. |