Commit 855fff5c authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Simplify ToolbarIconContainerView margin usage

Let's put FlexLayout's SetIgnoreDefaultMainAxisMargins through some
real-world usage.

Bug: chromium:943702
Change-Id: I21fb28d21494f9df0045ac9e31ed2fd26875bdc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1739648
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684472}
parent 3a369e9c
......@@ -17,9 +17,10 @@
ToolbarIconContainerView::ToolbarIconContainerView(bool uses_highlight)
: uses_highlight_(uses_highlight) {
auto layout_manager = std::make_unique<views::FlexLayout>();
layout_manager->SetCollapseMargins(true).SetDefault(
views::kMarginsKey,
gfx::Insets(0, 0, 0, GetLayoutConstant(TOOLBAR_ELEMENT_PADDING)));
layout_manager->SetCollapseMargins(true)
.SetIgnoreDefaultMainAxisMargins(true)
.SetDefault(views::kMarginsKey,
gfx::Insets(0, GetLayoutConstant(TOOLBAR_ELEMENT_PADDING)));
SetLayoutManager(std::move(layout_manager));
}
......@@ -29,9 +30,6 @@ void ToolbarIconContainerView::UpdateAllIcons() {}
void ToolbarIconContainerView::AddMainButton(views::Button* main_button) {
DCHECK(!main_button_);
// Set empty margins from this view to remove the default ones set in the
// constructor.
main_button->SetProperty(views::kMarginsKey, gfx::Insets());
main_button->AddObserver(this);
main_button->AddButtonObserver(this);
main_button_ = main_button;
......
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