Commit 9f1da68e authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Add PreferredSizeChanged() calls.

When a view changes size, it's important to call PreferredSizeChanged()
so that its parent knows it might need to re-layout or repaint.

The current code either fails to call PreferredSizeChanged() or instead
lays out the current view in a couple of cases relevant to the toolbar,
preventing us from using a consistent layout manager. This CL is a
prerequisite for actually switching to a layout manager for the toolbar.

Bug: 898632
Change-Id: I7154eb6ac58a11eca9069b25655a6c2666a704e0
Reviewed-on: https://chromium-review.googlesource.com/c/1372715
Commit-Queue: Dana Fried <dfried@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615969}
parent ccb389f8
...@@ -1154,8 +1154,7 @@ void LocationBarView::OnTouchUiChanged() { ...@@ -1154,8 +1154,7 @@ void LocationBarView::OnTouchUiChanged() {
if (save_credit_card_icon_view_) if (save_credit_card_icon_view_)
save_credit_card_icon_view_->SetFontList(font_list); save_credit_card_icon_view_->SetFontList(font_list);
location_icon_view_->Update(/*suppress_animations=*/false); location_icon_view_->Update(/*suppress_animations=*/false);
Layout(); PreferredSizeChanged();
SchedulePaint();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -161,6 +161,7 @@ void BrowserActionsContainer::AddViewForAction( ...@@ -161,6 +161,7 @@ void BrowserActionsContainer::AddViewForAction(
toolbar_action_views_.insert(toolbar_action_views_.begin() + index, toolbar_action_views_.insert(toolbar_action_views_.begin() + index,
base::WrapUnique(view)); base::WrapUnique(view));
AddChildViewAt(view, index); AddChildViewAt(view, index);
PreferredSizeChanged();
} }
void BrowserActionsContainer::RemoveViewForAction( void BrowserActionsContainer::RemoveViewForAction(
...@@ -174,10 +175,12 @@ void BrowserActionsContainer::RemoveViewForAction( ...@@ -174,10 +175,12 @@ void BrowserActionsContainer::RemoveViewForAction(
break; break;
} }
} }
PreferredSizeChanged();
} }
void BrowserActionsContainer::RemoveAllViews() { void BrowserActionsContainer::RemoveAllViews() {
toolbar_action_views_.clear(); toolbar_action_views_.clear();
PreferredSizeChanged();
} }
void BrowserActionsContainer::Redraw(bool order_changed) { void BrowserActionsContainer::Redraw(bool order_changed) {
......
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