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

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

Issue 1399253005: Fix layout of omnibox rows for material design (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new approach Created 5 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 9a640a68870fe6839295d5fb33e32bd69f3674c5..44c9a1ff428b8706096e5d7e37f9a50551f0cd5f 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -359,8 +359,8 @@ void OmniboxResultView::PaintMatch(const AutocompleteMatch& match,
&contents_max_width,
&description_max_width);
- int after_contents_x =
- DrawRenderText(match, contents, true, canvas, x, y, contents_max_width);
+ int after_contents_x = DrawRenderText(match, contents, CONTENTS, canvas,
+ x, y, contents_max_width);
if (description_max_width != 0) {
if (match.answer) {
@@ -376,11 +376,11 @@ void OmniboxResultView::PaintMatch(const AutocompleteMatch& match,
GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING);
}
} else {
- x = DrawRenderText(match, separator_rendertext_.get(), false, canvas,
+ x = DrawRenderText(match, separator_rendertext_.get(), SEPARATOR, canvas,
after_contents_x, y, separator_width_);
}
- DrawRenderText(match, description, false, canvas, x, y,
+ DrawRenderText(match, description, DESCRIPTION, canvas, x, y,
description_max_width);
}
}
@@ -388,7 +388,7 @@ void OmniboxResultView::PaintMatch(const AutocompleteMatch& match,
int OmniboxResultView::DrawRenderText(
const AutocompleteMatch& match,
gfx::RenderText* render_text,
- bool contents,
+ RenderTextType render_text_type,
gfx::Canvas* canvas,
int x,
int y,
@@ -400,8 +400,8 @@ int OmniboxResultView::DrawRenderText(
// Infinite suggestions should appear with the leading ellipses vertically
// stacked.
- if (contents &&
- (match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL)) {
+ if (render_text_type == CONTENTS &&
+ match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) {
// When the directionality of suggestion doesn't match the UI, we try to
// vertically stack the ellipsis by restricting the end edge (right_x).
const bool is_ui_rtl = base::i18n::IsRTL();
@@ -455,10 +455,13 @@ int OmniboxResultView::DrawRenderText(
prefix_render_text->Draw(canvas);
}
+ int height = (render_text_type == DESCRIPTION && match.answer) ?
Peter Kasting 2015/10/19 20:47:11 Nit: const I'd probably also place this line just
tdanderson 2015/10/20 14:20:15 Done.
+ GetAnswerLineHeight() : GetContentLineHeight();
+
// Set the display rect to trigger eliding.
render_text->SetDisplayRect(
gfx::Rect(mirroring_context_->mirrored_left_coord(x, right_x), y,
- right_x - x, GetContentLineHeight()));
+ right_x - x, height));
Peter Kasting 2015/10/19 20:47:11 Wow, wouldn't this have made the non-MD answer con
tdanderson 2015/10/20 14:20:15 Yes, without MD GetContentsLineHeight() was return
render_text->Draw(canvas);
return right_x;
}

Powered by Google App Engine
This is Rietveld 408576698