Commit b17510ab authored by andresantoso's avatar andresantoso Committed by Commit bot

Mac: Fix profile button overlaps fullscreen button on new windows.

This was recently broken by https://codereview.chromium.org/476313003/.
The problem is that when opening a new window, the fullscreen button was not
enabled yet by the time we layout the profile button.
We need to call layoutSubviews after the fullscreen button is enabled because
the avatar button's position depends on it. But with the old avatar button,
we need to call layoutSubviews first because the fullscreen button's position
depends on it.

BUG=412018

Review URL: https://codereview.chromium.org/567713002

Cr-Commit-Position: refs/heads/master@{#294450}
parent 07551559
...@@ -374,21 +374,31 @@ using content::WebContents; ...@@ -374,21 +374,31 @@ using content::WebContents;
// Allow bar visibility to be changed. // Allow bar visibility to be changed.
[self enableBarVisibilityUpdates]; [self enableBarVisibilityUpdates];
// Force a relayout of all the various bars.
[self layoutSubviews];
// Set the window to participate in Lion Fullscreen mode. Setting this flag // Set the window to participate in Lion Fullscreen mode. Setting this flag
// has no effect on Snow Leopard or earlier. Panels can share a fullscreen // has no effect on Snow Leopard or earlier. Panels can share a fullscreen
// space with a tabbed window, but they can not be primary fullscreen // space with a tabbed window, but they can not be primary fullscreen
// windows. Do this after |-layoutSubviews| so that the fullscreen button // windows.
// can be adjusted in FramedBrowserWindow.
NSUInteger collectionBehavior = [window collectionBehavior]; NSUInteger collectionBehavior = [window collectionBehavior];
collectionBehavior |= collectionBehavior |=
browser_->type() == Browser::TYPE_TABBED || browser_->type() == Browser::TYPE_TABBED ||
browser_->type() == Browser::TYPE_POPUP ? browser_->type() == Browser::TYPE_POPUP ?
NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenPrimary :
NSWindowCollectionBehaviorFullScreenAuxiliary; NSWindowCollectionBehaviorFullScreenAuxiliary;
[window setCollectionBehavior:collectionBehavior];
if ([self shouldUseNewAvatarButton]) {
// The new avatar button is to the left of the fullscreen button.
// We need to call layoutSubviews after the fullscreen button is enabled
// because the avatar button's position depends on it.
[window setCollectionBehavior:collectionBehavior];
[self layoutSubviews];
} else {
// The old avatar button is to the right of the fullscreen button.
// We need to call layoutSubviews first because the fullscreen button's
// position depends on it.
// See -[FramedBrowserWindow fullScreenButtonOriginAdjustment].
[self layoutSubviews];
[window setCollectionBehavior:collectionBehavior];
}
// For a popup window, |desiredContentRect| contains the desired height of // For a popup window, |desiredContentRect| contains the desired height of
// the content, not of the whole window. Now that all the views are laid // the content, not of the whole window. Now that all the views are laid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment