-
Notifications
You must be signed in to change notification settings - Fork 893
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
Update horizontal tabs styling #20044
Conversation
9b402ee
to
f9d141a
Compare
f84738d
to
133f468
Compare
1b5e3ff
to
81b3631
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! LGTM👍
|
||
// The tab strip will maintain the necessary padding between the top of the | ||
// frame and the top of tabs. | ||
return 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double checking, do you happen to check if "immersive tab strip on fullscreen" works? (Tabstrip slides down in fullscreen when mouse hovers on the topside, this is enabled only when view > Always show toolbar in fullscreen
from OS app menu is unchecked)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's been checked in fullscreen. (Although I'm seeing an unrelated macOS fullscreen tabs issue in master at the moment. I'll attempt to put together a repro.)
@@ -138,6 +138,7 @@ void BraveCompoundTabContainer::SetScrollEnabled(bool enabled) { | |||
|
|||
if (enabled) { | |||
scroll_view_ = AddChildView(std::make_unique<CustomScrollView>()); | |||
scroll_view_->SetBackgroundThemeColorId(kColorToolbar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q. I'm curious why this was added. Isn't this code only reachable when it's vertical tab strip?
Update: maybe related to change in tab container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right - the scroll view is also painted to an (opaque?) layer, so needs all pixels painted. Previously, the tab container would paint the background for it, but since we're moving background painting into BraveTabStrip
(which is above this scroll view), we need to have the scroll view also take care of background painting.
Maybe it would be easier to have the tab container paint to a layer instead of BraveTabStrip
. I'm not sure if I tried that, but I'll try it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BraveTabStrip
needs to be the layer-based ancestor for tabs because tabs are moved out of TabContainer
and into TabDragContext
when dragging. BraveTabStrip
is the parent for both.
@@ -32,6 +33,21 @@ | |||
#include "ui/gfx/skbitmap_operations.h" | |||
#include "ui/views/view_utils.h" | |||
|
|||
namespace { | |||
|
|||
gfx::Size AddHorizontalTabStripSpacing(gfx::Size size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional:
gfx::Size AddHorizontalTabStripSpacing(gfx::Size size) { | |
gfx::Size AddHorizontalTabStripSpacing(const gfx::Size& size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you might want to use mutable reference. But it might not possible when it comes to the xvalue returned from PreferredSize().
gfx::Size& AddHorizontalTabStripSpacing(gfx::Size& size) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to leave it as pass-by-value, since we need to construct a new Size
anyway, and since Size
is a very small object.
void BraveTabContainer::OnPaintBackground(gfx::Canvas* canvas) { | ||
if (!tabs::utils::ShouldShowVerticalTabs( | ||
tab_slot_controller_->GetBrowser())) { | ||
TabContainerImpl::OnPaintBackground(canvas); | ||
return; | ||
} | ||
|
||
canvas->DrawColor(GetColorProvider()->GetColor(kColorToolbar)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! this seems to be why scroll view in the compound container has the background. For vertical tabs, we have two different tab container instance for pinned tabs and unpinned tabs. And pinned tab container doesn't belong to the scroll view. so I'm wondering if pinned tabs container has background properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, is it painted from BraveTabStrip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right - it now paints the background in BraveTabStrip
, because BraveTabStrip
paints to an opaque layer. Since BraveTabStrip
is a parent of BraveTabContainer
, the background painting in BraveTabContainer
is no longer required.
81b3631
to
a352375
Compare
a352375
to
b5a338c
Compare
#include "brave/browser/ui/color/brave_color_id.h" | ||
#include "brave/browser/ui/tabs/brave_tab_layout_constants.h" | ||
#include "brave/browser/ui/tabs/features.h" | ||
#include "brave/browser/ui/views/tabs/brave_tab_group_header.h" | ||
#include "brave/browser/ui/views/tabs/vertical_tab_utils.h" | ||
#include "chrome/browser/ui/views/tabs/tab_slot_controller.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all these needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are needed by brave_tab_style_views.inc.cc
, which does not include its own dependencies (it relies on the includes defined in tab_style_views.cc
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chromium_src
, patches
++
Resolves brave/brave-browser#31646
This changes updates the horizontal tabs styling, under the feature flag
#brave-horizontal-tabs-update
.Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: