Commit 1e220a7a authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Hide separators on ends when tab shapes are visible.

Bug: 862438
Change-Id: I51e0b61d14184e0f94467bc957240091d77897f3
Reviewed-on: https://chromium-review.googlesource.com/1173755
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584263}
parent 7efb8e42
......@@ -386,6 +386,11 @@ void BrowserTabStripController::OnStoppedDraggingTabs() {
immersive_reveal_lock_.reset();
}
bool BrowserTabStripController::HasVisibleBackgroundTabShapes() const {
return GetFrameView()->HasVisibleBackgroundTabShapes(
BrowserNonClientFrameView::kUseCurrent);
}
bool BrowserTabStripController::EverHasVisibleBackgroundTabShapes() const {
return GetFrameView()->EverHasVisibleBackgroundTabShapes();
}
......
......@@ -76,6 +76,7 @@ class BrowserTabStripController : public TabStripController,
bool ShouldDrawStrokes() const override;
void OnStartedDraggingTabs() override;
void OnStoppedDraggingTabs() override;
bool HasVisibleBackgroundTabShapes() const override;
bool EverHasVisibleBackgroundTabShapes() const override;
SkColor GetFrameColor() const override;
SkColor GetToolbarTopSeparatorColor() const override;
......
......@@ -150,6 +150,10 @@ void FakeBaseTabStripController::OnStartedDraggingTabs() {
void FakeBaseTabStripController::OnStoppedDraggingTabs() {
}
bool FakeBaseTabStripController::HasVisibleBackgroundTabShapes() const {
return false;
}
bool FakeBaseTabStripController::EverHasVisibleBackgroundTabShapes() const {
return false;
}
......
......@@ -52,6 +52,7 @@ class FakeBaseTabStripController : public TabStripController {
bool ShouldDrawStrokes() const override;
void OnStartedDraggingTabs() override;
void OnStoppedDraggingTabs() override;
bool HasVisibleBackgroundTabShapes() const override;
bool EverHasVisibleBackgroundTabShapes() const override;
SkColor GetFrameColor() const override;
SkColor GetToolbarTopSeparatorColor() const override;
......
......@@ -1678,9 +1678,14 @@ Tab::SeparatorOpacities Tab::GetSeparatorOpacities(bool for_layout) const {
const int tab_width = std::max(width(), target_bounds.width());
const float target_opacity =
float{std::min(std::abs(x() - target_bounds.x()), tab_width)} / tab_width;
if (ntb_position != LEADING && controller_->IsFirstVisibleTab(this))
// If the tab shapes are visible, never draw end separators.
const bool always_hide_separators_on_ends =
controller_->HasVisibleBackgroundTabShapes();
if (controller_->IsFirstVisibleTab(this) &&
(ntb_position != LEADING || always_hide_separators_on_ends))
leading_opacity = target_opacity;
if (ntb_position != AFTER_TABS && controller_->IsLastVisibleTab(this))
if (controller_->IsLastVisibleTab(this) &&
(ntb_position != AFTER_TABS || always_hide_separators_on_ends))
trailing_opacity = target_opacity;
// Return the opacities in physical order, rather than logical.
......
......@@ -142,6 +142,10 @@ class TabController {
// in the same window will redraw on top of the the favicon area of any tab.
virtual bool CanPaintThrobberToLayer() const = 0;
// Returns whether the shapes of background tabs are visible against the
// frame.
virtual bool HasVisibleBackgroundTabShapes() const = 0;
// Returns COLOR_TOOLBAR_TOP_SEPARATOR[,_INACTIVE] depending on the activation
// state of the window.
virtual SkColor GetToolbarTopSeparatorColor() const = 0;
......
......@@ -1139,6 +1139,10 @@ bool TabStrip::CanPaintThrobberToLayer() const {
!widget->IsFullscreen();
}
bool TabStrip::HasVisibleBackgroundTabShapes() const {
return controller_->HasVisibleBackgroundTabShapes();
}
SkColor TabStrip::GetToolbarTopSeparatorColor() const {
return controller_->GetToolbarTopSeparatorColor();
}
......
......@@ -256,6 +256,7 @@ class TabStrip : public views::View,
gfx::Path* clip) override;
int GetStrokeThickness() const override;
bool CanPaintThrobberToLayer() const override;
bool HasVisibleBackgroundTabShapes() const override;
SkColor GetToolbarTopSeparatorColor() const override;
SkColor GetTabSeparatorColor() const override;
SkColor GetTabBackgroundColor(TabState state, bool opaque) const override;
......
......@@ -120,6 +120,10 @@ class TabStripController {
// from this tabstrip but the user is still dragging the tabs.
virtual void OnStoppedDraggingTabs() = 0;
// Returns whether the shapes of background tabs are visible against the
// frame.
virtual bool HasVisibleBackgroundTabShapes() const = 0;
// Returns whether the shapes of background tabs are visible against the
// frame for either active or inactive windows.
virtual bool EverHasVisibleBackgroundTabShapes() const = 0;
......
......@@ -86,6 +86,7 @@ class FakeTabController : public TabController {
bool CanPaintThrobberToLayer() const override {
return paint_throbber_to_layer_;
}
bool HasVisibleBackgroundTabShapes() const override { return false; }
SkColor GetToolbarTopSeparatorColor() const override { return SK_ColorBLACK; }
SkColor GetTabSeparatorColor() const override { return SK_ColorBLACK; }
SkColor GetTabBackgroundColor(TabState state, bool opaque) const override {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment