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

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: changed change list parent 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..4c54192f3d37b9ca7e9c783bff8d6ec474e9afd5 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -703,9 +703,10 @@ void OmniboxResultView::OnPaint(gfx::Canvas* canvas) {
match_.answer->second_line().text_fields())
AppendAnswerText(textfield);
if (match_.answer->second_line().additional_text())
- AppendAnswerText(*match_.answer->second_line().additional_text());
+ AppendAnswerText(*match_.answer->second_line().additional_text(),
+ true);
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(" "));
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