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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc

Issue 2065653002: Vertically align text on empty bookmarks bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed descend/ascent calculations and alignment code from GetPreferredSize() Created 4 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/bookmarks/bookmark_bar_instructions_view.h ('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/bookmarks/bookmark_bar_instructions_view.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc
index 5a0223518b3e73464623bf0115fac160cf59f7c2..5fbdc4927cea88e57e9a3165a614f5f6d419fce7 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc
@@ -40,7 +40,6 @@ BookmarkBarInstructionsView::BookmarkBarInstructionsView(
: delegate_(delegate),
instructions_(NULL),
import_link_(NULL),
- baseline_(-1),
updated_colors_(false) {
instructions_ = new views::Label(
l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS));
@@ -62,22 +61,14 @@ BookmarkBarInstructionsView::BookmarkBarInstructionsView(
}
gfx::Size BookmarkBarInstructionsView::GetPreferredSize() const {
- int ascent = 0, descent = 0, height = 0, width = 0;
+ int height = 0, width = 0;
for (int i = 0; i < child_count(); ++i) {
const views::View* view = child_at(i);
gfx::Size pref = view->GetPreferredSize();
- int baseline = view->GetBaseline();
- if (baseline != -1) {
- ascent = std::max(ascent, baseline);
- descent = std::max(descent, pref.height() - baseline);
- } else {
- height = std::max(pref.height(), height);
- }
+ height = std::max(pref.height(), height);
width += pref.width();
}
width += (child_count() - 1) * GetViewPadding();
- if (ascent != 0)
- height = std::max(ascent + descent, height);
return gfx::Size(width, height);
}
@@ -87,14 +78,8 @@ void BookmarkBarInstructionsView::Layout() {
for (int i = 0; i < child_count(); ++i) {
views::View* view = child_at(i);
gfx::Size pref = view->GetPreferredSize();
- int baseline = view->GetBaseline();
- int y;
- if (baseline != -1 && baseline_ != -1)
- y = baseline_ - baseline;
- else
- y = (height() - pref.height()) / 2;
int view_width = std::min(remaining_width, pref.width());
- view->SetBounds(x, y, view_width, pref.height());
+ view->SetBounds(x, 0, view_width, height());
x += view_width + GetViewPadding();
remaining_width = std::max(0, width() - x);
}
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698