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

Unified Diff: ui/views/bubble/bubble_frame_view.cc

Issue 1950863002: [Views] Center bubble title text vertically when title icon is tall. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/bubble/bubble_frame_view.cc
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc
index dbc4704b8029159c0e2285312c3e268d02e2c839..a0aed8bcb83ab686839600fee7de2cc1bac19379 100644
--- a/ui/views/bubble/bubble_frame_view.cc
+++ b/ui/views/bubble/bubble_frame_view.cc
@@ -302,6 +302,7 @@ void BubbleFrameView::Layout() {
gfx::Size title_icon_pref_size(title_icon_->GetPreferredSize());
int padding = 0;
+ int title_height = title_icon_pref_size.height();
if (title_->visible() && !title_->text().empty()) {
if (title_icon_pref_size.width() > 0)
@@ -310,11 +311,11 @@ void BubbleFrameView::Layout() {
const int title_label_x =
bounds.x() + title_icon_pref_size.width() + padding;
title_->SizeToFit(std::max(1, close_->x() - title_label_x));
- title_->SetPosition(gfx::Point(title_label_x, bounds.y()));
+ title_height = std::max(title_height, title_->height());
+ title_->SetPosition(gfx::Point(
+ title_label_x, bounds.y() + (title_height - title_->height()) / 2));
}
- const int title_height =
- std::max(title_icon_pref_size.height(), title_->height());
title_icon_->SetBounds(bounds.x(), bounds.y(), title_icon_pref_size.width(),
title_height);
bounds.set_width(title_->bounds().right() - bounds.x());

Powered by Google App Engine
This is Rietveld 408576698