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

Update shadow layer bounds when tab's layer bounds changes #18111

Merged
merged 1 commit into from
Apr 19, 2023
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
22 changes: 14 additions & 8 deletions browser/ui/views/tabs/brave_tab.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,20 @@ void BraveTab::UpdateIconVisibility() {
}
}

void BraveTab::OnLayerBoundsChanged(const gfx::Rect& old_bounds,
ui::PropertyChangeReason reason) {
Tab::OnLayerBoundsChanged(old_bounds, reason);

if (!base::FeatureList::IsEnabled(tabs::features::kBraveVerticalTabs)) {
return;
}

if (shadow_layer_ && shadow_layer_->parent() &&
shadow_layer_->parent() == layer()->parent()) {
LayoutShadowLayer();
}
}

void BraveTab::Layout() {
Tab::Layout();
if (IsAtMinWidthForVerticalTabStrip()) {
Expand Down Expand Up @@ -211,14 +225,6 @@ void BraveTab::ReorderChildLayers(ui::Layer* parent_layer) {
layer()->parent()->StackBelow(shadow_layer_.get(), layer());
}

void BraveTab::OnBoundsChanged(const gfx::Rect& previous_bounds) {
Tab::OnBoundsChanged(previous_bounds);

if (shadow_layer_ && shadow_layer_->parent()) {
LayoutShadowLayer();
}
}

void BraveTab::MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds,
int visual_width) const {
if (!base::FeatureList::IsEnabled(tabs::features::kBraveVerticalTabs) ||
Expand Down
4 changes: 3 additions & 1 deletion browser/ui/views/tabs/brave_tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ class BraveTab : public Tab {
bool ShouldRenderAsNormalTab() const override;
void Layout() override;
void ReorderChildLayers(ui::Layer* parent_layer) override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
void MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds,
int visual_width) const override;

void OnLayerBoundsChanged(const gfx::Rect& old_bounds,
ui::PropertyChangeReason reason) override;

private:
bool IsAtMinWidthForVerticalTabStrip() const;

Expand Down