Index: chrome/browser/ui/panels/panel_resize_controller.cc |
diff --git a/chrome/browser/ui/panels/panel_resize_controller.cc b/chrome/browser/ui/panels/panel_resize_controller.cc |
index 2c0ee25fc741dd844923d434e0e258c92afa1ad3..92da0a9cde28c5fbf142910e2ea0ae29c0fc1259 100644 |
--- a/chrome/browser/ui/panels/panel_resize_controller.cc |
+++ b/chrome/browser/ui/panels/panel_resize_controller.cc |
@@ -88,10 +88,22 @@ void PanelResizeController::Resize(const gfx::Point& mouse_location) { |
mouse_location_at_start_.y() - mouse_location.y(), 0)); |
} |
- // Give the panel a chance to adjust the bounds before setting them. |
- gfx::Size size = bounds.size(); |
- resizing_panel_->ClampSize(&size); |
- bounds.set_size(size); |
+ // Update the max size of the panel so it's never smaller then the actual |
+ // panel's size. Note that even if the user resizes the panel smaller later, |
+ // the increased max size will still be in effect. Since it's not possible |
+ // currently to switch the panel back to autosizing from user-resizable, it |
+ // should not be a problem. |
+ gfx::Size max_panel_size = resizing_panel_->max_size(); |
+ if (max_panel_size.width() < bounds.width()) |
+ max_panel_size.set_width(bounds.width()); |
+ if (max_panel_size.height() < bounds.height()) |
+ max_panel_size.set_height(bounds.height()); |
+ |
+ resizing_panel_->SetSizeRange(resizing_panel_->min_size(), max_panel_size); |
+ |
+ // This effectively only clamps using the min size, since the max_size was |
+ // updated above. |
+ bounds.set_size(resizing_panel_->ClampSize(bounds.size())); |
if (ResizingLeft(sides_resized_)) { |
bounds.set_x(bounds_at_start_.x() - |