From 5f4a84b43df2c3598d1ab882965f55ba58d47259 Mon Sep 17 00:00:00 2001 From: tapted Date: Fri, 17 Jul 2015 16:23:34 -0700 Subject: [PATCH] Repair the widget size of the fullscreen permission request bubble This regressed in r338796 which avoided adding borders to buttons that would immediately be replaced when the NativeTheme was set. However, ExclusiveAccessBubbleViews is not a WidgetDelegate[View] or a BubbleDelegate[View], so has custom preferred-sizing code. It also removes its layout manager during construction, preventing the usual auto-layout from being triggered when the NativeTheme is set. This means that it performs a single layout at construction time to determine a preferred size. Since it was doing this before adding the view to the widget, the size was being calculated without taking into account the NativeTheme-styled buttons. Before r338796 it would size based on Chrome-OS style buttons before replacing with (on Linux) GTK style buttons, which worked OK. After r338796 this changed to a layout based on no borders. To fix, add the view to the widget before calculating the preferred size. BUG=510724 Review URL: https://codereview.chromium.org/1235983005 Cr-Commit-Position: refs/heads/master@{#339351} --- chrome/browser/ui/views/exclusive_access_bubble_views.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/browser/ui/views/exclusive_access_bubble_views.cc b/chrome/browser/ui/views/exclusive_access_bubble_views.cc index 98fa06135a4f02..466355d0ae325a 100644 --- a/chrome/browser/ui/views/exclusive_access_bubble_views.cc +++ b/chrome/browser/ui/views/exclusive_access_bubble_views.cc @@ -287,10 +287,10 @@ ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews( params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.parent = bubble_view_context_->GetBubbleAssociatedWidget()->GetNativeView(); - params.bounds = GetPopupRect(false); popup_->Init(params); - gfx::Size size = GetPopupRect(true).size(); popup_->SetContentsView(view_); + gfx::Size size = GetPopupRect(true).size(); + popup_->SetBounds(GetPopupRect(false)); // We set layout manager to nullptr to prevent the widget from sizing its // contents to the same size as itself. This prevents the widget contents from // shrinking while we animate the height of the popup to give the impression