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

Unified Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 381323002: [rough WIP] Make View::GetEventHandlerForRect() non-virtual (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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: chrome/browser/ui/views/tabs/tab.cc
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index e5c19d3cbf28da09f90500a71b639cc4809c02e8..cdc12e619863751fff2f8aa784591b18db180144 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -245,21 +245,6 @@ class Tab::TabCloseButton : public views::ImageButton,
virtual ~TabCloseButton() {}
// views::View:
- virtual View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE {
- if (!views::UsePointBasedTargeting(rect))
- return View::GetEventHandlerForRect(rect);
-
- // Ignore the padding set on the button.
- gfx::Rect contents_bounds = GetContentsBounds();
- contents_bounds.set_x(GetMirroredXForRect(contents_bounds));
-
- // Include the padding in hit-test for touch events.
- if (aura::Env::GetInstance()->is_touch_down())
- contents_bounds = GetLocalBounds();
-
- return contents_bounds.Intersects(rect) ? this : parent();
- }
-
virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) OVERRIDE {
// Tab close button has no children, so tooltip handler should be the same
// as the event handler.
@@ -330,6 +315,25 @@ class Tab::TabCloseButton : public views::ImageButton,
return button_bounds;
}
+ // views::ViewTargeterDelegate:
+ virtual View* TargetForRect(View* root,
+ const gfx::Rect& rect) OVERRIDE {
+ CHECK_EQ(root, this);
+
+ if (!views::UsePointBasedTargeting(rect))
+ return ViewTargeterDelegate::TargetForRect(root, rect);
+
+ // Ignore the padding set on the button.
+ gfx::Rect contents_bounds = GetContentsBounds();
+ contents_bounds.set_x(GetMirroredXForRect(contents_bounds));
+
+ // Include the padding in hit-test for touch events.
+ if (aura::Env::GetInstance()->is_touch_down())
+ contents_bounds = GetLocalBounds();
+
+ return contents_bounds.Intersects(rect) ? this : parent();
+ }
+
// views:MaskedTargeterDelegate:
virtual bool GetHitTestMask(gfx::Path* mask) const OVERRIDE {
DCHECK(mask);

Powered by Google App Engine
This is Rietveld 408576698