| Index: ui/views/cocoa/bridged_native_widget.mm
|
| diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
|
| index 107896f931f200368571f936db5dd58cc4eebeb7..7947a2e8b6cf215196d87dad8e8e80ca9e3bb723 100644
|
| --- a/ui/views/cocoa/bridged_native_widget.mm
|
| +++ b/ui/views/cocoa/bridged_native_widget.mm
|
| @@ -388,8 +388,12 @@ void BridgedNativeWidget::OnFullscreenTransitionStart(
|
| void BridgedNativeWidget::OnFullscreenTransitionComplete(
|
| bool actual_fullscreen_state) {
|
| in_fullscreen_transition_ = false;
|
| - if (target_fullscreen_state_ == actual_fullscreen_state)
|
| +
|
| + if (target_fullscreen_state_ == actual_fullscreen_state) {
|
| + // Ensure constraints are re-applied when completing a transition.
|
| + OnSizeConstraintsChanged();
|
| return;
|
| + }
|
|
|
| // First update to reflect reality so that OnTargetFullscreenStateChanged()
|
| // expects the change.
|
| @@ -432,13 +436,13 @@ void BridgedNativeWidget::ToggleDesiredFullscreenState() {
|
| return; // TODO(tapted): Implement this for Snow Leopard.
|
| }
|
|
|
| - // Since fullscreen requests are ignored if the collection behavior does not
|
| - // allow it, save the collection behavior and restore it after.
|
| - NSWindowCollectionBehavior behavior = [window_ collectionBehavior];
|
| - [window_ setCollectionBehavior:behavior |
|
| - NSWindowCollectionBehaviorFullScreenPrimary];
|
| + // Enable fullscreen collection behavior because:
|
| + // 1: -[NSWindow toggleFullscreen:] would otherwise be ignored,
|
| + // 2: the fullscreen button must be enabled so the user can leave fullscreen.
|
| + // This will be reset when a transition out of fullscreen completes.
|
| + gfx::SetNSWindowCanFullscreen(window_, true);
|
| +
|
| [window_ toggleFullScreen:nil];
|
| - [window_ setCollectionBehavior:behavior];
|
| }
|
|
|
| void BridgedNativeWidget::OnSizeChanged() {
|
| @@ -523,7 +527,12 @@ void BridgedNativeWidget::OnWindowKeyStatusChangedTo(bool is_key) {
|
| }
|
|
|
| void BridgedNativeWidget::OnSizeConstraintsChanged() {
|
| - NSWindow* window = ns_window();
|
| + // Don't modify the size constraints or fullscreen collection behavior while
|
| + // in fullscreen or during a transition. OnFullscreenTransitionComplete will
|
| + // reset these after leaving fullscreen.
|
| + if (target_fullscreen_state_ || in_fullscreen_transition_)
|
| + return;
|
| +
|
| Widget* widget = native_widget_mac()->GetWidget();
|
| gfx::Size min_size = widget->GetMinimumSize();
|
| gfx::Size max_size = widget->GetMaximumSize();
|
| @@ -533,7 +542,7 @@ void BridgedNativeWidget::OnSizeConstraintsChanged() {
|
| bool shows_fullscreen_controls =
|
| is_resizable && widget->widget_delegate()->CanMaximize();
|
|
|
| - gfx::ApplyNSWindowSizeConstraints(window, min_size, max_size,
|
| + gfx::ApplyNSWindowSizeConstraints(window_, min_size, max_size,
|
| shows_resize_controls,
|
| shows_fullscreen_controls);
|
| }
|
|
|