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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_layout.cc

Issue 13974003: alternate ntp: fix content origin when overlay shrinks to shorter than top bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed scott's comment Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/browser_view_layout.h" 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
6 6
7 #include "base/observer_list.h" 7 #include "base/observer_list.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/find_bar/find_bar.h" 10 #include "chrome/browser/ui/find_bar/find_bar.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 int bottom = LayoutDownloadShelf(browser_view_->height()); 333 int bottom = LayoutDownloadShelf(browser_view_->height());
334 int active_top_margin = GetTopMarginForActiveContent(); 334 int active_top_margin = GetTopMarginForActiveContent();
335 top -= active_top_margin; 335 top -= active_top_margin;
336 contents_container_->SetActiveTopMargin(active_top_margin); 336 contents_container_->SetActiveTopMargin(active_top_margin);
337 LayoutTabContents(top, bottom); 337 LayoutTabContents(top, bottom);
338 338
339 // Now set the contents to display at their previous origin if we just hid the 339 // Now set the contents to display at their previous origin if we just hid the
340 // bookmark and/or infobars. 340 // bookmark and/or infobars.
341 if (active_top_margin == 0 && !old_contents_origin.IsOrigin()) { 341 if (active_top_margin == 0 && !old_contents_origin.IsOrigin()) {
342 // Retrieve the overlay height again since it may have changed in layouts
343 // triggered in LayoutTabContents().
344 overlay_height = contents_container_->overlay_height();
345 // Get the new origin of contents.
342 gfx::Point new_contents_origin(contents->bounds().origin()); 346 gfx::Point new_contents_origin(contents->bounds().origin());
343 views::View::ConvertPointToTarget(contents->parent(), browser_view_, 347 views::View::ConvertPointToTarget(contents->parent(), browser_view_,
344 &new_contents_origin); 348 &new_contents_origin);
345 active_top_margin = old_contents_origin.y() - new_contents_origin.y(); 349 active_top_margin = old_contents_origin.y() - new_contents_origin.y();
346 // Special case: While normally the suggestions appear to "cover" any 350 // Special case: While normally the suggestions appear to "cover" any
347 // bookmark/infobars, if the suggestions are very short, they might not 351 // bookmark/infobars, if the suggestions are very short, they might not
348 // fully cover that gap, and leaving the contents at their original height 352 // fully cover that gap, and leaving the contents at their original height
349 // would leave an odd-looking blank space. In this case, we allow the 353 // would leave an odd-looking blank space. In this case, we allow the
350 // contents to go ahead and shift upward. 354 // contents to go ahead and shift upward.
351 if (active_top_margin > 0 && active_top_margin < overlay_height) 355 if (active_top_margin > 0 && active_top_margin < overlay_height)
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 586 }
583 return bottom; 587 return bottom;
584 } 588 }
585 589
586 bool BrowserViewLayout::InfobarVisible() const { 590 bool BrowserViewLayout::InfobarVisible() const {
587 views::View* infobar_container = browser_view_->infobar_container_; 591 views::View* infobar_container = browser_view_->infobar_container_;
588 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 592 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
589 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 593 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
590 (infobar_container->GetPreferredSize().height() != 0); 594 (infobar_container->GetPreferredSize().height() != 0);
591 } 595 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/frame/contents_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698