-
Notifications
You must be signed in to change notification settings - Fork 877
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
Forward preferred size changes from BraveActionsContainer
#587
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,18 +105,20 @@ void BraveActionsContainer::AddAction(const extensions::Extension* extension, | |
// The button view | ||
actions_[id].view_ = std::make_unique<ToolbarActionView>( | ||
actions_[id].view_controller_.get(), this); | ||
// we control destruction | ||
actions_[id].view_->set_owned_by_client(); | ||
// Sets overall size of button but not image graphic. We set a large width | ||
// in order to give space for the bubble. | ||
actions_[id].view_->SetPreferredSize(gfx::Size(32, 24)); | ||
// Add extension view after separator view | ||
// `AddChildView` should be called first, so that changes that modify | ||
// layout (e.g. preferred size) are forwarded to its parent | ||
if (actions_[id].position_ != ACTION_ANY_POSITION) { | ||
DCHECK(actions_[id].position_ > 0); | ||
AddChildViewAt(actions_[id].view_.get(), actions_[id].position_); | ||
} else { | ||
AddChildView(actions_[id].view_.get()); | ||
} | ||
// we control destruction | ||
actions_[id].view_->set_owned_by_client(); | ||
// Sets overall size of button but not image graphic. We set a large width | ||
// in order to give space for the bubble. | ||
actions_[id].view_->SetPreferredSize(gfx::Size(32, 24)); | ||
Update(); | ||
} | ||
} | ||
|
@@ -244,3 +246,7 @@ void BraveActionsContainer::OnExtensionActionUpdated( | |
UpdateActionState(extension_action->extension_id()); | ||
} | ||
// end ExtensionActionAPI::Observer | ||
|
||
void BraveActionsContainer::ChildPreferredSizeChanged(views::View* child) { | ||
PreferredSizeChanged(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I think it is more clean this way. In the future, we may want to do other things instead of or besides calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I got what you mean. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think this relocation isn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, actually I just moved the code calling
AddChildView()
so that it happens just after creation. It's just thatgit diff
shows it the other way around.