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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.cc

Issue 2854423002: [omnibox] Use suggestion instead of input for base text (Closed)
Patch Set: Rename Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // For WinDDK ATL compatibility, these ATL headers must come first. 5 // For WinDDK ATL compatibility, these ATL headers must come first.
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <atlbase.h> // NOLINT 9 #include <atlbase.h> // NOLINT
10 #include <atlwin.h> // NOLINT 10 #include <atlwin.h> // NOLINT
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // TODO(skanuj): This is probably identical across all OmniboxResultView rows in 539 // TODO(skanuj): This is probably identical across all OmniboxResultView rows in
540 // the omnibox dropdown. Consider sharing the result. 540 // the omnibox dropdown. Consider sharing the result.
541 int OmniboxResultView::GetDisplayOffset( 541 int OmniboxResultView::GetDisplayOffset(
542 const AutocompleteMatch& match, 542 const AutocompleteMatch& match,
543 bool is_ui_rtl, 543 bool is_ui_rtl,
544 bool is_match_contents_rtl) const { 544 bool is_match_contents_rtl) const {
545 if (match.type != AutocompleteMatchType::SEARCH_SUGGEST_TAIL) 545 if (match.type != AutocompleteMatchType::SEARCH_SUGGEST_TAIL)
546 return 0; 546 return 0;
547 547
548 const base::string16& input_text = 548 const base::string16& input_text =
549 base::UTF8ToUTF16(match.GetAdditionalInfo(kACMatchPropertyInputText)); 549 base::UTF8ToUTF16(match.GetAdditionalInfo(kACMatchPropertyContentsText));
550 int contents_start_index = 0; 550 int contents_start_index = 0;
551 base::StringToInt(match.GetAdditionalInfo(kACMatchPropertyContentsStartIndex), 551 base::StringToInt(match.GetAdditionalInfo(kACMatchPropertyContentsStartIndex),
552 &contents_start_index); 552 &contents_start_index);
553 553
554 std::unique_ptr<gfx::RenderText> input_render_text( 554 std::unique_ptr<gfx::RenderText> input_render_text(
555 CreateRenderText(input_text)); 555 CreateRenderText(input_text));
556 const gfx::Range& glyph_bounds = 556 const gfx::Range& glyph_bounds =
557 input_render_text->GetGlyphBounds(contents_start_index); 557 input_render_text->GetGlyphBounds(contents_start_index);
558 const int start_padding = is_match_contents_rtl ? 558 const int start_padding = is_match_contents_rtl ?
559 std::max(glyph_bounds.start(), glyph_bounds.end()) : 559 std::max(glyph_bounds.start(), glyph_bounds.end()) :
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 destination->AppendText(text); 802 destination->AppendText(text);
803 const TextStyle& text_style = GetTextStyle(text_type); 803 const TextStyle& text_style = GetTextStyle(text_type);
804 // TODO(dschuyler): follow up on the problem of different font sizes within 804 // TODO(dschuyler): follow up on the problem of different font sizes within
805 // one RenderText. Maybe with destination->SetFontList(...). 805 // one RenderText. Maybe with destination->SetFontList(...).
806 destination->ApplyWeight( 806 destination->ApplyWeight(
807 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range); 807 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range);
808 destination->ApplyColor( 808 destination->ApplyColor(
809 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); 809 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range);
810 destination->ApplyBaselineStyle(text_style.baseline, range); 810 destination->ApplyBaselineStyle(text_style.baseline, range);
811 } 811 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698