Commit e86cff1a authored by spqchan's avatar spqchan Committed by Commit bot

[Mac] Fullscreen Toolbar Fixes

- Fixed the layout issues with the fullscreen toolbar
- Fixed the hiding animation

BUG=689115

Review-Url: https://codereview.chromium.org/2738043002
Cr-Commit-Position: refs/heads/master@{#456117}
parent 38c1f949
...@@ -1033,11 +1033,7 @@ bool IsTabDetachingInFullscreenEnabled() { ...@@ -1033,11 +1033,7 @@ bool IsTabDetachingInFullscreenEnabled() {
manager->DisplayPendingRequests(); manager->DisplayPendingRequests();
} }
// If the web contents want to focus on the location bar, do not call the if ([self isInAnyFullscreenMode])
// animation since the location bar will drop down when it's focused.
bool willFocusLocationBar =
newContents && newContents->FocusLocationBarByDefault();
if ([self isInAnyFullscreenMode] && !willFocusLocationBar)
[[self fullscreenToolbarController] revealToolbarForTabStripChanges]; [[self fullscreenToolbarController] revealToolbarForTabStripChanges];
} }
...@@ -1478,10 +1474,8 @@ bool IsTabDetachingInFullscreenEnabled() { ...@@ -1478,10 +1474,8 @@ bool IsTabDetachingInFullscreenEnabled() {
} }
- (void)onTabInsertedInForeground:(BOOL)inForeground { - (void)onTabInsertedInForeground:(BOOL)inForeground {
if ([self isInAnyFullscreenMode] && !inForeground && if ([self isInAnyFullscreenMode] && !inForeground)
![toolbarController_ isLocationBarFocused]) {
[[self fullscreenToolbarController] revealToolbarForTabStripChanges]; [[self fullscreenToolbarController] revealToolbarForTabStripChanges];
}
} }
- (void)userChangedTheme { - (void)userChangedTheme {
......
...@@ -778,14 +778,12 @@ IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ...@@ -778,14 +778,12 @@ IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
// Insert a NTP new tab in the foreground. // Insert a NTP new tab in the foreground.
AddTabAtIndex(0, GURL("about:blank"), ui::PAGE_TRANSITION_LINK); AddTabAtIndex(0, GURL("about:blank"), ui::PAGE_TRANSITION_LINK);
ASSERT_TRUE([[controller() toolbarController] isLocationBarFocused]); ASSERT_TRUE([[controller() toolbarController] isLocationBarFocused]);
EXPECT_FALSE([fullscreenToolbarController isRevealingToolbarForTabstrip]); EXPECT_TRUE([fullscreenToolbarController isRevealingToolbarForTabstrip]);
[fullscreenToolbarController resetToolbarFlag]; [fullscreenToolbarController resetToolbarFlag];
// Insert a new tab in the background. The animation should not be triggered
// since the location bar should still be focused.
AddTabAtBackground(1, GURL("http://google.com")); AddTabAtBackground(1, GURL("http://google.com"));
ASSERT_TRUE([[controller() toolbarController] isLocationBarFocused]); ASSERT_TRUE([[controller() toolbarController] isLocationBarFocused]);
EXPECT_FALSE([fullscreenToolbarController isRevealingToolbarForTabstrip]); EXPECT_TRUE([fullscreenToolbarController isRevealingToolbarForTabstrip]);
[fullscreenToolbarController resetToolbarFlag]; [fullscreenToolbarController resetToolbarFlag];
// Switch to a non-NTP tab. // Switch to a non-NTP tab.
......
...@@ -970,19 +970,11 @@ willPositionSheet:(NSWindow*)sheet ...@@ -970,19 +970,11 @@ willPositionSheet:(NSWindow*)sheet
- (void)updateSubviewZOrderFullscreen { - (void)updateSubviewZOrderFullscreen {
base::scoped_nsobject<NSMutableArray> subviews([[NSMutableArray alloc] init]); base::scoped_nsobject<NSMutableArray> subviews([[NSMutableArray alloc] init]);
// The infobar should overlay the toolbar if the toolbar is fully shown.
FullscreenToolbarLayout layout = [fullscreenToolbarController_ computeLayout];
BOOL shouldInfoBarOverlayToolbar =
ui::IsCGFloatEqual(layout.toolbarFraction, 1.0);
if ([downloadShelfController_ view]) if ([downloadShelfController_ view])
[subviews addObject:[downloadShelfController_ view]]; [subviews addObject:[downloadShelfController_ view]];
if ([self tabContentArea]) if ([self tabContentArea])
[subviews addObject:[self tabContentArea]]; [subviews addObject:[self tabContentArea]];
if (!shouldInfoBarOverlayToolbar && [infoBarContainerController_ view])
[subviews addObject:[infoBarContainerController_ view]];
if ([self placeBookmarkBarBelowInfoBar]) { if ([self placeBookmarkBarBelowInfoBar]) {
if ([bookmarkBarController_ view]) if ([bookmarkBarController_ view])
[subviews addObject:[bookmarkBarController_ view]]; [subviews addObject:[bookmarkBarController_ view]];
...@@ -998,7 +990,7 @@ willPositionSheet:(NSWindow*)sheet ...@@ -998,7 +990,7 @@ willPositionSheet:(NSWindow*)sheet
if ([toolbarController_ view]) if ([toolbarController_ view])
[subviews addObject:[toolbarController_ view]]; [subviews addObject:[toolbarController_ view]];
if (shouldInfoBarOverlayToolbar && [infoBarContainerController_ view]) if ([infoBarContainerController_ view])
[subviews addObject:[infoBarContainerController_ view]]; [subviews addObject:[infoBarContainerController_ view]];
if ([findBarCocoaController_ view]) if ([findBarCocoaController_ view])
......
...@@ -78,7 +78,7 @@ void FullscreenToolbarAnimationController::AnimateToolbarOutIfPossible() { ...@@ -78,7 +78,7 @@ void FullscreenToolbarAnimationController::AnimateToolbarOutIfPossible() {
if (animation_.IsClosing()) if (animation_.IsClosing())
return; return;
animation_.Reset(animation_start_value_); animation_.Stop();
animation_.Hide(); animation_.Hide();
} }
......
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