| Index: chrome/browser/ui/views/tabs/tab_strip.cc
|
| diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
|
| index 6275f202f297a7a3fdcb2bc88883c7dba41b88ee..00e496b631b24e1b8c33442d8eda6fd716c1a614 100644
|
| --- a/chrome/browser/ui/views/tabs/tab_strip.cc
|
| +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
|
| @@ -47,7 +47,6 @@
|
| #include "ui/gfx/screen.h"
|
| #include "ui/gfx/size.h"
|
| #include "ui/views/controls/image_view.h"
|
| -#include "ui/views/masked_view_targeter.h"
|
| #include "ui/views/mouse_watcher_view_host.h"
|
| #include "ui/views/rect_based_targeting_utils.h"
|
| #include "ui/views/view_model_utils.h"
|
| @@ -296,13 +295,25 @@ bool NewTabButton::HasHitTestMask() const {
|
| return !tab_strip_->SizeTabButtonToTopOfTabStrip();
|
| }
|
|
|
| -// TODO(tdanderson): Move the implementation into View::HitTestRect() and
|
| -// delete this function. See crbug.com/377527.
|
| void NewTabButton::GetHitTestMask(HitTestSource source, gfx::Path* path) const {
|
| - const ui::EventTargeter* targeter = GetEventTargeter();
|
| - DCHECK(targeter);
|
| - static_cast<const views::MaskedViewTargeter*>(targeter)
|
| - ->GetHitTestMask(this, path);
|
| + DCHECK(path);
|
| +
|
| + SkScalar w = SkIntToScalar(width());
|
| + SkScalar v_offset = SkIntToScalar(TabStrip::kNewTabButtonVerticalOffset);
|
| +
|
| + // These values are defined by the shape of the new tab image. Should that
|
| + // image ever change, these values will need to be updated. They're so
|
| + // custom it's not really worth defining constants for.
|
| + // These values are correct for regular and USE_ASH versions of the image.
|
| + path->moveTo(0, v_offset + 1);
|
| + path->lineTo(w - 7, v_offset + 1);
|
| + path->lineTo(w - 4, v_offset + 4);
|
| + path->lineTo(w, v_offset + 16);
|
| + path->lineTo(w - 1, v_offset + 17);
|
| + path->lineTo(7, v_offset + 17);
|
| + path->lineTo(4, v_offset + 13);
|
| + path->lineTo(0, v_offset + 1);
|
| + path->close();
|
| }
|
|
|
| #if defined(OS_WIN)
|
| @@ -447,44 +458,6 @@ gfx::ImageSkia NewTabButton::GetImageForScale(float scale) const {
|
| hover_animation_->GetCurrentValue());
|
| }
|
|
|
| -// Used to define the custom hit-test region of the new tab button
|
| -// for the purposes of event targeting.
|
| -class NewTabButtonTargeter : public views::MaskedViewTargeter {
|
| - public:
|
| - explicit NewTabButtonTargeter(views::View* new_tab_button)
|
| - : views::MaskedViewTargeter(new_tab_button) {}
|
| - virtual ~NewTabButtonTargeter() {}
|
| -
|
| - private:
|
| - // views::MaskedViewTargeter:
|
| - virtual bool GetHitTestMask(const views::View* view,
|
| - gfx::Path* mask) const OVERRIDE {
|
| - DCHECK(mask);
|
| - DCHECK_EQ(view, masked_view());
|
| -
|
| - SkScalar w = SkIntToScalar(view->width());
|
| - SkScalar v_offset = SkIntToScalar(TabStrip::kNewTabButtonVerticalOffset);
|
| -
|
| - // These values are defined by the shape of the new tab image. Should that
|
| - // image ever change, these values will need to be updated. They're so
|
| - // custom it's not really worth defining constants for.
|
| - // These values are correct for regular and USE_ASH versions of the image.
|
| - mask->moveTo(0, v_offset + 1);
|
| - mask->lineTo(w - 7, v_offset + 1);
|
| - mask->lineTo(w - 4, v_offset + 4);
|
| - mask->lineTo(w, v_offset + 16);
|
| - mask->lineTo(w - 1, v_offset + 17);
|
| - mask->lineTo(7, v_offset + 17);
|
| - mask->lineTo(4, v_offset + 13);
|
| - mask->lineTo(0, v_offset + 1);
|
| - mask->close();
|
| -
|
| - return true;
|
| - }
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(NewTabButtonTargeter);
|
| -};
|
| -
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // TabStrip::RemoveTabDelegate
|
| //
|
| @@ -1497,9 +1470,6 @@ void TabStrip::Init() {
|
| newtab_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT,
|
| views::ImageButton::ALIGN_BOTTOM);
|
| AddChildView(newtab_button_);
|
| - newtab_button_->SetEventTargeter(
|
| - scoped_ptr<ui::EventTargeter>(new NewTabButtonTargeter(newtab_button_)));
|
| -
|
| if (drop_indicator_width == 0) {
|
| // Direction doesn't matter, both images are the same size.
|
| gfx::ImageSkia* drop_image = GetDropArrowImage(true);
|
|
|