Skip to content

Commit

Permalink
Implement BraveLocationBarView::ChildVisibilityChanged()
Browse files Browse the repository at this point in the history
The `BraveActionsContainer` was not being shown when tearing off a tab
into a new window. This was due to `BraveActionsContainer::Update()` not
forcing a `Layout()` in `BraveLocationBarView`. This is now done by
implementing the aforementioned callback.

Fixes brave/brave-browser#1276.
  • Loading branch information
hferreiro authored and bbondy committed Oct 4, 2018
1 parent 37892ba commit afb17e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions browser/ui/views/location_bar/brave_location_bar_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ void BraveLocationBarView::OnChanged() {
LocationBarView::OnChanged();
}

void BraveLocationBarView::ChildVisibilityChanged(views::View* child) {
// We should trigger Layout() when visibility of |brave_actions_| is changed.
// When BraveActionsContainer::Update() is called by
// BraveLocationBarView::Update(), the location bar's Layout() is triggered.
// However, when BraveActionsContainer::Update() is called by others, the
// location bar isn't re-layouted.
if (child == brave_actions_)
Layout();
}

gfx::Size BraveLocationBarView::CalculatePreferredSize() const {
gfx::Size min_size = LocationBarView::CalculatePreferredSize();
if (brave_actions_ && brave_actions_->visible()){
Expand Down
2 changes: 2 additions & 0 deletions browser/ui/views/location_bar/brave_location_bar_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class BraveLocationBarView : public LocationBarView {
private:
void UpdateBookmarkStarVisibility() override;
OmniboxTint GetTint() override;
void ChildVisibilityChanged(views::View* child) override;

BraveActionsContainer* brave_actions_ = nullptr;

DISALLOW_COPY_AND_ASSIGN(BraveLocationBarView);
Expand Down

0 comments on commit afb17e5

Please sign in to comment.