Skip to content

Commit

Permalink
Do not size PermissionSelectorRow to preferred size
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
estark authored and Commit bot committed Jan 20, 2017
1 parent 18491e4 commit f24aa8a
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f24aa8a

Please sign in to comment.