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

Unified Diff: ui/aura/window_targeter.h

Issue 1119423003: Refactors away method implementations in ui::EventTargeter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactors away method implementations in ui::EventTargeter (moves tests to aura) Created 5 years, 7 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: ui/aura/window_targeter.h
diff --git a/ui/aura/window_targeter.h b/ui/aura/window_targeter.h
index 9571f2ab32f70d982bd533af4ea540964d6dd01d..ea47217aa90e7d0aa2aa8c23d895ff239b918358 100644
--- a/ui/aura/window_targeter.h
+++ b/ui/aura/window_targeter.h
@@ -17,22 +17,47 @@ class AURA_EXPORT WindowTargeter : public ui::EventTargeter {
WindowTargeter();
~WindowTargeter() override;
+ // Returns true if |target| or one of its descendants can be a target of
+ // |event|. This requires that |target| and its descendants are not
+ // prohibited from accepting the event, and that the event is within an
+ // actionable region of the target's bounds. Note that the location etc. of
+ // |event| is in |target|'s parent's coordinate system.
+ virtual bool SubtreeShouldBeExploredForEvent(ui::EventTarget* target,
+ const ui::LocatedEvent& event);
+
protected:
+ // Same as FindTargetForEvent(), but used for positional events. The location
+ // etc. of |event| are in |root|'s coordinate system. When finding the target
+ // for the event, the targeter can mutate the |event| (e.g. change the
+ // coordinate to be in the returned target's coordinate system) so that it can
+ // be dispatched to the target without any further modification.
+ virtual ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root,
tdanderson 2015/05/13 18:38:25 Since these four methods are being removed from th
varkha 2015/05/21 19:11:04 Done. Seems like there are fewer casts than before
+ ui::LocatedEvent* event);
+
+ // Returns false if neither |target| nor any of its descendants are allowed
+ // to accept |event| for reasons unrelated to the event's location or the
+ // target's bounds. For example, overrides of this function may consider
+ // attributes such as the visibility or enabledness of |target|. Note that
+ // the location etc. of |event| is in |target|'s parent's coordinate system.
+ virtual bool SubtreeCanAcceptEvent(ui::EventTarget* target,
+ const ui::LocatedEvent& event) const;
+
+ // Returns whether the location of the event is in an actionable region of the
+ // target. Note that the location etc. of |event| is in the |target|'s
+ // parent's coordinate system.
+ virtual bool EventLocationInsideBounds(ui::EventTarget* target,
+ const ui::LocatedEvent& event) const;
+
// ui::EventTargeter:
ui::EventTarget* FindTargetForEvent(ui::EventTarget* root,
ui::Event* event) override;
- ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root,
- ui::LocatedEvent* event) override;
- bool SubtreeCanAcceptEvent(ui::EventTarget* target,
- const ui::LocatedEvent& event) const override;
- bool EventLocationInsideBounds(ui::EventTarget* target,
- const ui::LocatedEvent& event) const override;
-
private:
- Window* FindTargetForKeyEvent(Window* root_window,
- const ui::KeyEvent& event);
+ Window* FindTargetForKeyEvent(Window* root_window, const ui::KeyEvent& event);
+ Window* FindTargetForNonKeyEvent(Window* root_window, ui::Event* event);
Window* FindTargetInRootWindow(Window* root_window,
const ui::LocatedEvent& event);
+ ui::EventTarget* FindTargetForEventRecursively(Window* root_window,
tdanderson 2015/05/13 18:38:25 nit: FindTargetForLocatedEventRecursively?
varkha 2015/05/21 19:11:04 Done.
+ ui::LocatedEvent* event);
DISALLOW_COPY_AND_ASSIGN(WindowTargeter);
};

Powered by Google App Engine
This is Rietveld 408576698