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

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
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;
Finnur 2011/06/30 22:10:24 When is |view_width| 0?
jennb 2011/06/30 22:26:47 The view's width is zero the first 3 times Layout(
+
// 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());
« chrome/browser/ui/views/dropdown_bar_host_win.cc ('K') | « 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