From 11f57949d5726af24f66cdec331347afe14bfc8e Mon Sep 17 00:00:00 2001 From: "tdanderson@chromium.org" <tdanderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Tue, 5 Aug 2014 22:28:50 +0000 Subject: Do not call into EventTargeter methods from ViewTargeter Now that hit-testing for views (crbug.com/388838) and event-targeting for views (crbug.com/391845) use ViewTargeterDelegate to define custom behaviour for these operations (instead of the now-obsolete approach of subclassing ViewTargeter itself), we should not be calling into EventTargeter for this purpose. Changes in this CL: * Finding the target of a scroll event is now performed correctly by using the logic in ViewTargeterDelegate and its overrides. * The dead code ViewTargeter::SubtreeCanAcceptEvent(), ViewTargeter::EventLocationInsideBounds(), and ViewTargeter::BoundsForEvent() have been removed along with their corresponding tests. * The class-level documentation for ViewTargeter and ViewTargeterDelegate has been updated to clarify the purpose of these classes. BUG=395387,370579 TEST=ViewTargeterTest.* Review URL: https://codereview.chromium.org/426443002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287620 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/views/view_targeter.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'ui/views/view_targeter.h') diff --git a/ui/views/view_targeter.h b/ui/views/view_targeter.h index 52e7a0e..ee4e7c3 100644 --- a/ui/views/view_targeter.h +++ b/ui/views/view_targeter.h @@ -13,13 +13,8 @@ namespace views { class View; class ViewTargeterDelegate; -// Contains the logic used to determine the View to which an -// event should be dispatched. A ViewTargeter (or one of its -// derived classes) is installed on a View to specify the -// targeting behaviour to be used for the subtree rooted at -// that View. -// TODO(tdanderson): Remove overrides of all EventHandler methods except for -// FindTargetForEvent() and FindNextBestTarget(). +// A ViewTargeter is installed on a View that wishes to use the custom +// hit-testing or event-targeting behaviour defined by |delegate|. class VIEWS_EXPORT ViewTargeter : public ui::EventTargeter { public: explicit ViewTargeter(ViewTargeterDelegate* delegate); @@ -32,11 +27,6 @@ class VIEWS_EXPORT ViewTargeter : public ui::EventTargeter { View* TargetForRect(View* root, const gfx::Rect& rect) const; protected: - // Returns the location of |event| represented as a rect. If |event| is - // a gesture event, its bounding box is returned. Otherwise, a 1x1 rect - // having its origin at the location of |event| is returned. - gfx::RectF BoundsForEvent(const ui::LocatedEvent& event) const; - // ui::EventTargeter: virtual ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, ui::Event* event) OVERRIDE; @@ -50,7 +40,8 @@ class VIEWS_EXPORT ViewTargeter : public ui::EventTargeter { const ui::LocatedEvent& event) const OVERRIDE; private: - View* FindTargetForKeyEvent(View* view, const ui::KeyEvent& key); + View* FindTargetForKeyEvent(View* root, const ui::KeyEvent& key); + View* FindTargetForScrollEvent(View* root, const ui::ScrollEvent& scroll); // ViewTargeter does not own the |delegate_|, but |delegate_| must // outlive the targeter. -- cgit v1.1