Skip to content

Commit

Permalink
Merge pull request #430 from brave/new_tab
Browse files Browse the repository at this point in the history
Fix newtab button isn't clickable
  • Loading branch information
petemill committed Sep 11, 2018
1 parent 84b2fee commit 04a458f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions browser/ui/views/tabs/brave_new_tab_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,16 @@ void BraveNewTabButton::PaintPlusIcon(gfx::Canvas* canvas, int offset, int size)
const int fixed_offset = (GetContentsBounds().width() / 2) - (size / 2);
NewTabButton::PaintPlusIcon(canvas, fixed_offset, size);
}

SkPath BraveNewTabButton::GetNewerMaterialUiButtonPath(float button_y,
float scale,
bool extend_to_top,
bool for_fill) const {
SkPath path;
const gfx::Rect contents_bounds = GetContentsBounds();
path.addRect(0, extend_to_top ? 0 : button_y,
contents_bounds.width() * scale,
button_y + contents_bounds.height() * scale);
path.close();
return path;
}
4 changes: 4 additions & 0 deletions browser/ui/views/tabs/brave_new_tab_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class BraveNewTabButton : public NewTabButton {
private:
gfx::Size CalculatePreferredSize() const override;
void PaintPlusIcon(gfx::Canvas* canvas, int offset, int size) override;
SkPath GetNewerMaterialUiButtonPath(float button_y,
float scale,
bool extend_to_top,
bool for_fill) const override;
DISALLOW_COPY_AND_ASSIGN(BraveNewTabButton);
};

Expand Down
10 changes: 9 additions & 1 deletion patches/chrome-browser-ui-views-tabs-new_tab_button.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/chrome/browser/ui/views/tabs/new_tab_button.h b/chrome/browser/ui/views/tabs/new_tab_button.h
index ee40211315f979cfc34a7373195b2179b72429d4..9b3715cfe72390310b277f1ed0361821558da189 100644
index ee40211315f979cfc34a7373195b2179b72429d4..6b0e87c2a7ae38b47c4a452ff0d6bacb1cb2620f 100644
--- a/chrome/browser/ui/views/tabs/new_tab_button.h
+++ b/chrome/browser/ui/views/tabs/new_tab_button.h
@@ -25,6 +25,7 @@ class NewTabButton : public views::ImageButton,
Expand All @@ -19,3 +19,11 @@ index ee40211315f979cfc34a7373195b2179b72429d4..9b3715cfe72390310b277f1ed0361821

SkColor GetButtonFillColor(bool opaque) const;
SkColor GetIconColor() const;
@@ -120,6 +121,7 @@ class NewTabButton : public views::ImageButton,
// the path will be shrunk by 1px from all sides to allow room for the stroke
// to show up. If |extend_to_top| is true, the path is extended vertically to
// y = 0.
+ virtual
SkPath GetNewerMaterialUiButtonPath(float button_y,
float scale,
bool extend_to_top,

0 comments on commit 04a458f

Please sign in to comment.