| OLD | NEW |
| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 540 |
| 541 // TODO(skanuj): This is probably identical across all OmniboxResultView rows in | 541 // TODO(skanuj): This is probably identical across all OmniboxResultView rows in |
| 542 // the omnibox dropdown. Consider sharing the result. | 542 // the omnibox dropdown. Consider sharing the result. |
| 543 int OmniboxResultView::GetDisplayOffset( | 543 int OmniboxResultView::GetDisplayOffset( |
| 544 const AutocompleteMatch& match, | 544 const AutocompleteMatch& match, |
| 545 bool is_ui_rtl, | 545 bool is_ui_rtl, |
| 546 bool is_match_contents_rtl) const { | 546 bool is_match_contents_rtl) const { |
| 547 if (match.type != AutocompleteMatchType::SEARCH_SUGGEST_TAIL) | 547 if (match.type != AutocompleteMatchType::SEARCH_SUGGEST_TAIL) |
| 548 return 0; | 548 return 0; |
| 549 | 549 |
| 550 const base::string16& input_text = | 550 const base::string16& input_text = base::UTF8ToUTF16( |
| 551 base::UTF8ToUTF16(match.GetAdditionalInfo(kACMatchPropertyInputText)); | 551 match.GetAdditionalInfo(kACMatchPropertySuggestionText)); |
| 552 int contents_start_index = 0; | 552 int contents_start_index = 0; |
| 553 base::StringToInt(match.GetAdditionalInfo(kACMatchPropertyContentsStartIndex), | 553 base::StringToInt(match.GetAdditionalInfo(kACMatchPropertyContentsStartIndex), |
| 554 &contents_start_index); | 554 &contents_start_index); |
| 555 | 555 |
| 556 std::unique_ptr<gfx::RenderText> input_render_text( | 556 std::unique_ptr<gfx::RenderText> input_render_text( |
| 557 CreateRenderText(input_text)); | 557 CreateRenderText(input_text)); |
| 558 const gfx::Range& glyph_bounds = | 558 const gfx::Range& glyph_bounds = |
| 559 input_render_text->GetGlyphBounds(contents_start_index); | 559 input_render_text->GetGlyphBounds(contents_start_index); |
| 560 const int start_padding = is_match_contents_rtl ? | 560 const int start_padding = is_match_contents_rtl ? |
| 561 std::max(glyph_bounds.start(), glyph_bounds.end()) : | 561 std::max(glyph_bounds.start(), glyph_bounds.end()) : |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 destination->AppendText(text); | 807 destination->AppendText(text); |
| 808 const TextStyle& text_style = GetTextStyle(text_type); | 808 const TextStyle& text_style = GetTextStyle(text_type); |
| 809 // TODO(dschuyler): follow up on the problem of different font sizes within | 809 // TODO(dschuyler): follow up on the problem of different font sizes within |
| 810 // one RenderText. Maybe with destination->SetFontList(...). | 810 // one RenderText. Maybe with destination->SetFontList(...). |
| 811 destination->ApplyWeight( | 811 destination->ApplyWeight( |
| 812 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range); | 812 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range); |
| 813 destination->ApplyColor( | 813 destination->ApplyColor( |
| 814 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); | 814 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); |
| 815 destination->ApplyBaselineStyle(text_style.baseline, range); | 815 destination->ApplyBaselineStyle(text_style.baseline, range); |
| 816 } | 816 } |
| OLD | NEW |