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

Unified Diff: chrome/browser/ui/views/find_bar_view.cc

Issue 7285005: Make Windows FindBar stay within window bounds for narrow windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
« no previous file with comments | « chrome/browser/ui/views/find_bar_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/find_bar_view.cc
===================================================================
--- chrome/browser/ui/views/find_bar_view.cc (revision 90713)
+++ chrome/browser/ui/views/find_bar_view.cc (working copy)
@@ -258,11 +258,16 @@
}
void FindBarView::Layout() {
- gfx::Size panel_size = GetPreferredSize();
+ int panel_width = GetPreferredSize().width();
+ // Stay within view bounds.
+ int view_width = width();
+ if (view_width && view_width < panel_width)
+ panel_width = view_width;
+
// First we draw the close button on the far right.
gfx::Size sz = close_button_->GetPreferredSize();
- close_button_->SetBounds(panel_size.width() - sz.width() -
+ close_button_->SetBounds(panel_width - sz.width() -
kMarginRightOfCloseButton,
(height() - sz.height()) / 2,
sz.width(),
@@ -310,8 +315,9 @@
// And whatever space is left in between, gets filled up by the find edit box.
sz = find_text_->GetPreferredSize();
- sz.set_width(match_count_x - kMarginLeftOfFindTextfield);
- find_text_->SetBounds(match_count_x - sz.width(),
+ sz.set_width(std::max(0, match_count_x - kMarginLeftOfFindTextfield));
+ int find_text_x = std::max(0, match_count_x - sz.width());
+ find_text_->SetBounds(find_text_x,
(height() - sz.height()) / 2 + 1,
sz.width(),
sz.height());
« no previous file with comments | « chrome/browser/ui/views/find_bar_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698