0

Fix for HoverView layout bug when using a ColorTrackingIconView

Change-Id: I824dccd031fdeb05e171aed877eff5d4235ac18e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3016421
Reviewed-by: Jeffrey Cohen <jeffreycohen@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#899758}
This commit is contained in:
Jeffrey Cohen
2021-07-08 23:33:14 +00:00
committed by Chromium LUCI CQ
parent 6d377e4a66
commit b87d01e997
2 changed files with 7 additions and 1 deletions
chrome/browser/ui/views
ui/views/controls

@ -54,6 +54,8 @@ class HoverButton : public views::LabelButton {
// When |resize_row_for_secondary_icon| is false, the button tries to
// accommodate the view's preferred size by reducing the top and bottom
// insets appropriately up to a value of 0.
// Warning: |icon_view| must have a fixed size and be correctly set during its
// constructor for the HoverButton to layout correctly.
HoverButton(PressedCallback callback,
std::unique_ptr<views::View> icon_view,
const std::u16string& title,

@ -11,7 +11,11 @@ namespace views {
ColorTrackingIconView::ColorTrackingIconView(const gfx::VectorIcon& icon,
int icon_size)
: icon_(icon), icon_size_(icon_size) {}
: icon_(icon), icon_size_(icon_size) {
// Set the image using a placeholder color. This will allow the ImageView to
// report its preferred size before OnThemeChanged for layout purposes.
SetImage(gfx::CreateVectorIcon(icon_, icon_size_, gfx::kPlaceholderColor));
}
void ColorTrackingIconView::OnThemeChanged() {
ImageView::OnThemeChanged();