From f24aa8ad5db849c114c91cddcc297475b8ead2c8 Mon Sep 17 00:00:00 2001 From: estark Date: Fri, 20 Jan 2017 00:45:41 -0800 Subject: [PATCH] Do not size PermissionSelectorRow to preferred size PermissionSelectorRow's preferred size is smaller than the width of the Page Info Bubble, so when a permission changes, resizing to the preferred size means that the row shrinks smaller than the other rows and the dropdown jumps around. Instead, simply call Layout() to do a fresh layout of the row. The parent()->SizeToPreferredSize() call is no longer necessary because WebsiteSettingsPopupView calls SizeToContents() when a permission is changed. Note that bug 655880 may want to reintroduce the PermissionSelectorRow::ChildPreferredSizeChanged override and propagate the change to WebsiteSettingsPopupView that way instead of via OnPermissionChanged, but it's not needed now -- and I'm guessing that, for that bug, PermissionSelectorRow::ChildPreferredSizeChanged may want to call parent()->PreferredSizeChanged(), rather than calling SizeToPreferredSize() (which assumes that the parent ought to be at its preferred size). BUG=657286 TEST=On Windows/Linux, visit https://google.com (or any other site) and open Page Info by clicking on the security indicator in the omnibox. Change a permission, change it again. Observe that the dropdown does not jump to the left of where it started. Review-Url: https://codereview.chromium.org/2647633002 Cr-Commit-Position: refs/heads/master@{#445017} --- .../ui/views/website_settings/permission_selector_row.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/chrome/browser/ui/views/website_settings/permission_selector_row.cc b/chrome/browser/ui/views/website_settings/permission_selector_row.cc index 00f49fbcfed7..6ba6b2270d3b 100644 --- a/chrome/browser/ui/views/website_settings/permission_selector_row.cc +++ b/chrome/browser/ui/views/website_settings/permission_selector_row.cc @@ -293,12 +293,7 @@ void PermissionSelectorRow::AddObserver( } void PermissionSelectorRow::ChildPreferredSizeChanged(View* child) { - SizeToPreferredSize(); - // FIXME: The parent is only a plain |View| that is used as a - // container/box/panel. The SizeToPreferredSize method of the parent is - // called here directly in order not to implement a custom |View| class with - // its own implementation of the ChildPreferredSizeChanged method. - parent()->SizeToPreferredSize(); + Layout(); } PermissionSelectorRow::~PermissionSelectorRow() {