Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(973)

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 12594015: Alternate NTP Mac: Push down overlay in presentation mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 180d4fcf53cd3f87aeec1cee4515041bbd764545..7b9dfa06e4d86631e940e613e54a5c4b7022982e 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -243,17 +243,25 @@ willPositionSheet:(NSWindow*)sheet
if (placeBookmarkBarBelowInfoBar)
maxY = [self layoutBookmarkBarAtMinX:minX maxY:maxY width:width];
- // In presentation mode the content area takes up all the remaining space
- // (from the bottom of the infobar down). In normal mode the content area
- // takes up the space between the bottom of the toolbar down.
- CGFloat contentAreaTop = 0;
+ int contentAreaTop = 0;
if (inPresentationMode) {
- toolbarToWebContentsOffset_ = 0;
+ // The tabContentaArea starts at the bottom of the info bar (or top of the
+ // screen if there's no infobar).
contentAreaTop = maxY;
+ CGFloat floatingBarHeight =
+ NSHeight(floatingBarBackingRect) * [self floatingBarShownFraction];
+ // When an instant overlay is shown this is the amount it needs to be pushed
+ // down by so that it doesn't get covered by the floating toolbar.
dhollowa 2013/03/25 16:28:18 "pushed down so"
sail 2013/03/26 00:16:43 Done.
+ toolbarToWebContentsOffset_ =
+ floatingBarHeight - (NSMaxY(contentBounds) - maxY);
} else {
+ // The tabContentArea view starts below the omnibox.
CGFloat minToolbarHeight = [toolbarController_
desiredHeightForCompression:bookmarks::kBookmarkBarOverlap];
contentAreaTop = toolbarTopY - minToolbarHeight;
+ // This is the space between the bottom of the omnibox and the bottom of the
+ // infobar (or bookmark bar if there's no infobar). This is used to push
dhollowa 2013/03/25 16:28:18 What if there's both the bookmark bar and the info
sail 2013/03/26 00:16:43 contentAreaTop is the Y coordinate of the bottom m
+ // the tab web content down when no instant overlay is shown.
toolbarToWebContentsOffset_ = contentAreaTop - maxY;
}
[self updateContentOffsets];
@@ -863,25 +871,53 @@ willPositionSheet:(NSWindow*)sheet
}
- (void)updateContentOffsets {
- // Normally the tab contents sits below the bookmark bar. This is achieved by
- // setting the offset to the height of the bookmark bar. The only exception
- // is on the search results page where the Instant results are shown inside
- // the page and not in the overlay contents as usual.
- CGFloat tabContentsOffset = toolbarToWebContentsOffset_;
- if ([self currentInstantUIState] ==
- browser_window_controller::kInstantUIFullPageResults) {
- tabContentsOffset = 0;
- }
- [overlayableContentsController_ setActiveContainerOffset:tabContentsOffset];
-
- // Prevent the fast resize view from drawing white over the bookmark bar.
- [[self tabContentArea] setContentOffset:toolbarToWebContentsOffset_];
+ if ([self inPresentationMode]) {
+ // In presentation mode the tabContentArea starts at the bottom of the info
+ // bar (or top of the screen if there's no infobar).
+ if ([self currentInstantUIState] !=
+ browser_window_controller::kInstantUIFullPageResults) {
+ // Normal mode, keep the tab web contents at the top (below the info bar).
dhollowa 2013/03/25 16:28:18 nit: "infobar"
sail 2013/03/26 00:16:43 Actually, we always make this two words. Updated m
+ [overlayableContentsController_ setActiveContainerOffset:0];
+ } else {
+ // Instant suggestions are displayed in the main tab contents so push that
+ // down so that the floating toolbar doesn't obscure it.
+ [overlayableContentsController_
+ setActiveContainerOffset:toolbarToWebContentsOffset_];
+ }
+ // Floating overlay (if any) should also be below the floating toolbar.
+ [overlayableContentsController_
+ setOverlayContentsOffset:toolbarToWebContentsOffset_];
- // Prevent the dev tools splitter from overlapping the bookmark bar.
- if ([self currentInstantUIState] != browser_window_controller::kInstantUINone)
+ [[self tabContentArea] setContentOffset:0];
[devToolsController_ setTopContentOffset:0];
- else
- [devToolsController_ setTopContentOffset:toolbarToWebContentsOffset_];
+ } else {
+ // In normal mode the tabContentArea starts just below the omnibox and the
+ // bookmark bar and info bar overlap it.
+ if ([self currentInstantUIState] !=
+ browser_window_controller::kInstantUIFullPageResults) {
+ // Normal mode, push the tab web contents down so that it doesn't obscure
+ // the bookmark bar and info bar.
+ [overlayableContentsController_
+ setActiveContainerOffset:toolbarToWebContentsOffset_];
+ } else {
+ // Instant suggestions are displayed in the main tab contents so don't
+ // push it down (keep it next to the omnibox).
+ [overlayableContentsController_ setActiveContainerOffset:0];
+ }
+ // Floating overlay (if any) should also be at the top (next to the
+ // omnibox).
+ [overlayableContentsController_ setOverlayContentsOffset:0];
+
+ // Prevent the fast resize view from drawing white over the bookmark bar.
+ [[self tabContentArea] setContentOffset:toolbarToWebContentsOffset_];
+ // Prevent the dev tools splitter from overlapping the bookmark bar.
+ if ([self currentInstantUIState] !=
+ browser_window_controller::kInstantUINone) {
+ [devToolsController_ setTopContentOffset:0];
+ } else {
+ [devToolsController_ setTopContentOffset:toolbarToWebContentsOffset_];
+ }
+ }
}
- (void)updateSubviewZOrder:(BOOL)inPresentationMode {

Powered by Google App Engine
This is Rietveld 408576698