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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.cc

Issue 25039002: Always aligns text at vertically center (Textfield, Label). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 7 years, 2 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/omnibox/omnibox_result_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
index 85d9f3fb10e1f26eff5292fabbdda9c8e6348cd6..72da38483953bbf1fe64c53e87a86bce3b5a8282 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -471,9 +471,8 @@ int OmniboxResultView::DrawString(
const gfx::Size size = (*j)->GetStringSize();
// Align the text runs to a common baseline.
const gfx::Rect rect(
- mirroring_context_->mirrored_left_coord(x, x + size.width()),
- y + font_list_.GetBaseline() - (*j)->GetBaseline(),
- size.width(), size.height());
+ mirroring_context_->mirrored_left_coord(x, x + size.width()), y,
+ size.width(), height());
(*j)->SetDisplayRect(rect);
(*j)->Draw(canvas);
x += size.width();
@@ -574,8 +573,7 @@ void OmniboxResultView::Layout() {
(height() - icon.height()) / 2, icon.width(), icon.height());
int text_x = edge_item_padding_ + default_icon_size_ + item_padding_;
- int text_height = GetTextHeight();
- int text_width;
+ int text_width = width() - text_x - edge_item_padding_;
if (match_.associated_keyword.get()) {
const int kw_collapsed_size =
@@ -586,16 +584,14 @@ void OmniboxResultView::Layout() {
const int kw_text_x = kw_x + keyword_icon_->width() + item_padding_;
text_width = kw_x - text_x - item_padding_;
- keyword_text_bounds_.SetRect(kw_text_x, 0,
- std::max(width() - kw_text_x - edge_item_padding_, 0), text_height);
- keyword_icon_->SetPosition(gfx::Point(kw_x,
- (height() - keyword_icon_->height()) / 2));
- } else {
- text_width = width() - text_x - edge_item_padding_;
+ keyword_text_bounds_.SetRect(
+ kw_text_x, 0,
+ std::max(width() - kw_text_x - edge_item_padding_, 0), height());
+ keyword_icon_->SetPosition(
+ gfx::Point(kw_x, (height() - keyword_icon_->height()) / 2));
}
- text_bounds_.SetRect(text_x, std::max(0, (height() - text_height) / 2),
- std::max(text_width, 0), text_height);
+ text_bounds_.SetRect(text_x, 0, std::max(text_width, 0), height());
}
void OmniboxResultView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
« no previous file with comments | « chrome/browser/ui/views/location_bar/selected_keyword_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698