Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rectangle tab shape #22

Merged
merged 3 commits into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions patches/chrome-browser-ui-layout_constants.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff --git a/chrome/browser/ui/layout_constants.cc b/chrome/browser/ui/layout_constants.cc
index 06dbe30d30e72a9af6d0345ff314257d577d76c2..18fb76fa1f344952637c7e7b23e141c43b5a43f9 100644
--- a/chrome/browser/ui/layout_constants.cc
+++ b/chrome/browser/ui/layout_constants.cc
@@ -25,7 +25,12 @@ int GetLayoutConstant(LayoutConstant constant) {
case LOCATION_BAR_HEIGHT:
return hybrid ? 32 : 28;
case TABSTRIP_NEW_TAB_BUTTON_OVERLAP:
- return hybrid ? 6 : 5;
+ // Originally here was `return hybrid ? 6 : 5`
+ // This value means how the new tab button is moved to the most right tab
+ // from the position of rectangle shape.
+ // The was required to have beautiful positioning with inclided sides of
+ // tabs and new tab button. Does not required for rectangle tabs and button.
+ return hybrid ? 0 : 0;
case TAB_HEIGHT:
return hybrid ? 33 : 29;
case TOOLBAR_ELEMENT_PADDING:
@@ -42,7 +47,12 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
ui::MaterialDesignController::MATERIAL_HYBRID;
switch (inset) {
case TAB:
- return gfx::Insets(1, hybrid ? 18 : 16);
+ // Originally here was `return gfx::Insets(1, hybrid ? 18 : 16)`
+ // Insets is a content border inside of the tab. When the tab has been
+ // changed to rectangle shape instead of trapezoid, then top part
+ // of the tab had more space. So reasonable to decrease the content
+ // border.
+ return gfx::Insets(1, hybrid ? 9 : 8);
}
NOTREACHED();
return gfx::Insets();
@@ -53,7 +63,9 @@ gfx::Size GetLayoutSize(LayoutSize size) {
ui::MaterialDesignController::MATERIAL_HYBRID;
switch (size) {
case NEW_TAB_BUTTON:
- return hybrid ? gfx::Size(39, 21) : gfx::Size(36, 18);
+ // Originally was 'return hybrid ? gfx::Size(39, 21) : gfx::Size(36, 18)'
+ // Making small square button for rectangle tabs
+ return hybrid ? gfx::Size(21, 21) : gfx::Size(18, 18);
}
NOTREACHED();
return gfx::Size();
16 changes: 16 additions & 0 deletions patches/chrome-browser-ui-views-tabs-tab.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 6d88fa75e31be381e66a9c1fb848dd95aaae45cf..26abbdce98445dcb4400834b82ca7b908e63dda7 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -112,7 +112,10 @@ bool ShouldShowThrobber(TabRendererData::NetworkState state) {
//
// The value returned here must be at least Tab::kMinimumEndcapWidth.
float GetTabEndcapWidth() {
- return GetLayoutInsets(TAB).left() - 0.5f;
+ // Originally was `return GetLayoutInsets(TAB).left() - 0.5f`
+ // For rectangle tab shape forcing GetInverseDiagonalSlope give 0 by
+ // (GetTabEndcapWidth() - Tab::kMinimumEndcapWidth) == 0
+ return Tab::kMinimumEndcapWidth;
}

void DrawHighlight(gfx::Canvas* canvas,