Commit e1de0d7e authored by Sidney San Martín's avatar Sidney San Martín Committed by Commit Bot

[Mac] Fix overlapping controls when menu bar is visible in fullscreen.

When the mouse is at the top of the screen in fullscreen and the toolbar
is visible, the toolbar slides down to make room for the menu bar. The
offset was calculated in GetBoundsForTabStrip(), which only affects some
of of layout. This change moves it to GetTopInset().

Bug: 865901
Change-Id: I5de02ac951f8347aeadc4af7238ea8f9172edc68
Reviewed-on: https://chromium-review.googlesource.com/1147477Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Sidney San Martín <sdy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577503}
parent 6ca63653
...@@ -73,6 +73,18 @@ gfx::Rect BrowserNonClientFrameViewMac::GetBoundsForTabStrip( ...@@ -73,6 +73,18 @@ gfx::Rect BrowserNonClientFrameViewMac::GetBoundsForTabStrip(
// calling through private APIs. // calling through private APIs.
DCHECK(tabstrip); DCHECK(tabstrip);
const bool restored = !frame()->IsMaximized() && !frame()->IsFullscreen();
gfx::Rect bounds = gfx::Rect(0, GetTopInset(restored), width(),
tabstrip->GetPreferredSize().height());
bounds.Inset(GetTabStripLeftInset(), 0,
GetAfterTabstripItemWidth() + GetTabstripPadding(), 0);
return bounds;
}
int BrowserNonClientFrameViewMac::GetTopInset(bool restored) const {
if (!browser_view()->IsTabStripVisible())
return 0;
// Calculate the y offset for the tab strip because in fullscreen mode the tab // Calculate the y offset for the tab strip because in fullscreen mode the tab
// strip may need to move under the slide down menu bar. // strip may need to move under the slide down menu bar.
CGFloat y_offset = kTabstripTopInset; CGFloat y_offset = kTabstripTopInset;
...@@ -99,15 +111,7 @@ gfx::Rect BrowserNonClientFrameViewMac::GetBoundsForTabStrip( ...@@ -99,15 +111,7 @@ gfx::Rect BrowserNonClientFrameViewMac::GetBoundsForTabStrip(
} }
} }
gfx::Rect bounds = return y_offset;
gfx::Rect(0, y_offset, width(), tabstrip->GetPreferredSize().height());
bounds.Inset(GetTabStripLeftInset(), 0,
GetAfterTabstripItemWidth() + GetTabstripPadding(), 0);
return bounds;
}
int BrowserNonClientFrameViewMac::GetTopInset(bool restored) const {
return browser_view()->IsTabStripVisible() ? kTabstripTopInset : 0;
} }
int BrowserNonClientFrameViewMac::GetAfterTabstripItemWidth() const { int BrowserNonClientFrameViewMac::GetAfterTabstripItemWidth() const {
......
...@@ -323,15 +323,7 @@ void BrowserViewLayout::Layout(views::View* browser_view) { ...@@ -323,15 +323,7 @@ void BrowserViewLayout::Layout(views::View* browser_view) {
vertical_layout_rect_ = browser_view->GetLocalBounds(); vertical_layout_rect_ = browser_view->GetLocalBounds();
int top_inset = delegate_->GetTopInsetInBrowserView(false); int top_inset = delegate_->GetTopInsetInBrowserView(false);
int top = LayoutTabStripRegion(top_inset); int top = LayoutTabStripRegion(top_inset);
int possible_fullscreen_tab_strip_offset = 0;
if (delegate_->IsTabStripVisible()) { if (delegate_->IsTabStripVisible()) {
#if defined(OS_MACOSX)
// Tab strip should always start from the top inset unless it is under the
// system menu bar during full screen mode on Mac. In this case, the tab
// strip and other top UI will move under the menu bar while the content
// should stay put.
possible_fullscreen_tab_strip_offset = tab_strip_->bounds().y() - top_inset;
#endif
// By passing true to GetTopInsetInBrowserView(), we position the tab // By passing true to GetTopInsetInBrowserView(), we position the tab
// background to vertically align with the frame background image of a // background to vertically align with the frame background image of a
// restored-mode frame, even in a maximized window. Then in the frame code, // restored-mode frame, even in a maximized window. Then in the frame code,
...@@ -354,7 +346,6 @@ void BrowserViewLayout::Layout(views::View* browser_view) { ...@@ -354,7 +346,6 @@ void BrowserViewLayout::Layout(views::View* browser_view) {
UpdateTopContainerBounds(); UpdateTopContainerBounds();
int bottom = LayoutDownloadShelf(browser_view->height()); int bottom = LayoutDownloadShelf(browser_view->height());
top -= possible_fullscreen_tab_strip_offset;
// Treat a detached bookmark bar as if the web contents container is shifted // Treat a detached bookmark bar as if the web contents container is shifted
// upwards and overlaps it. // upwards and overlaps it.
int active_top_margin = GetContentsOffsetForBookmarkBar(); int active_top_margin = GetContentsOffsetForBookmarkBar();
......
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