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

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

Issue 1023993003: [AiS] Added option to put a space between answer values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed default param Created 5 years, 9 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 911c26a55a8830909ee01af95c301f1be2a05462..3edf0fbb6ae2194715761cfa1db2b3f9d03fa1e8 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -701,11 +701,12 @@ void OmniboxResultView::OnPaint(gfx::Canvas* canvas) {
description_rendertext_ = CreateRenderText(text);
for (const SuggestionAnswer::TextField& textfield :
match_.answer->second_line().text_fields())
- AppendAnswerText(textfield);
+ AppendAnswerText(textfield, false);
if (match_.answer->second_line().additional_text())
- AppendAnswerText(*match_.answer->second_line().additional_text());
+ AppendAnswerText(*match_.answer->second_line().additional_text(),
+ true);
Peter Kasting 2015/03/23 20:19:21 I think it would be easier to just manually prepen
dschuyler 2015/03/24 00:52:41 Done.
if (match_.answer->second_line().status_text())
- AppendAnswerText(*match_.answer->second_line().status_text());
+ AppendAnswerText(*match_.answer->second_line().status_text(), true);
} else if (!match_.description.empty()) {
description_rendertext_ = CreateClassifiedRenderText(
match_.description, match_.description_class, true);
@@ -756,10 +757,14 @@ int OmniboxResultView::GetContentLineHeight() const {
}
void OmniboxResultView::AppendAnswerText(
- const SuggestionAnswer::TextField& text_field) {
+ const SuggestionAnswer::TextField& text_field,
+ bool prefix_space) {
+ base::string16 text = text_field.text();
+ if (prefix_space)
+ text.insert(0, base::UTF8ToUTF16(" "));
Peter Kasting 2015/03/23 20:19:21 Use ASCIIToUTF16(), it's cheaper.
dschuyler 2015/03/24 00:52:41 Done.
int offset = description_rendertext_->text().length();
- gfx::Range range(offset, offset + text_field.text().length());
- description_rendertext_->AppendText(text_field.text());
+ gfx::Range range(offset, offset + text.length());
+ description_rendertext_->AppendText(text);
const TextStyle& text_style = GetTextStyle(text_field.type());
// TODO(dschuyler): follow up on the problem of different font sizes within
// one RenderText.

Powered by Google App Engine
This is Rietveld 408576698