| 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <atlbase.h> // NOLINT | 8 #include <atlbase.h> // NOLINT |
| 9 #include <atlwin.h> // NOLINT | 9 #include <atlwin.h> // NOLINT |
| 10 #endif | 10 #endif |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 InitContentsRenderTextIfNecessary(); | 696 InitContentsRenderTextIfNecessary(); |
| 697 | 697 |
| 698 if (!description_rendertext_) { | 698 if (!description_rendertext_) { |
| 699 if (match_.answer) { | 699 if (match_.answer) { |
| 700 base::string16 text; | 700 base::string16 text; |
| 701 description_rendertext_ = CreateRenderText(text); | 701 description_rendertext_ = CreateRenderText(text); |
| 702 for (const SuggestionAnswer::TextField& textfield : | 702 for (const SuggestionAnswer::TextField& textfield : |
| 703 match_.answer->second_line().text_fields()) | 703 match_.answer->second_line().text_fields()) |
| 704 AppendAnswerText(textfield); | 704 AppendAnswerText(textfield); |
| 705 if (match_.answer->second_line().additional_text()) | 705 if (match_.answer->second_line().additional_text()) |
| 706 AppendAnswerText(*match_.answer->second_line().additional_text()); | 706 AppendAnswerText(*match_.answer->second_line().additional_text(), |
| 707 true); |
| 707 if (match_.answer->second_line().status_text()) | 708 if (match_.answer->second_line().status_text()) |
| 708 AppendAnswerText(*match_.answer->second_line().status_text()); | 709 AppendAnswerText(*match_.answer->second_line().status_text(), true); |
| 709 } else if (!match_.description.empty()) { | 710 } else if (!match_.description.empty()) { |
| 710 description_rendertext_ = CreateClassifiedRenderText( | 711 description_rendertext_ = CreateClassifiedRenderText( |
| 711 match_.description, match_.description_class, true); | 712 match_.description, match_.description_class, true); |
| 712 } | 713 } |
| 713 } | 714 } |
| 714 PaintMatch(match_, contents_rendertext_.get(), | 715 PaintMatch(match_, contents_rendertext_.get(), |
| 715 description_rendertext_.get(), canvas, x); | 716 description_rendertext_.get(), canvas, x); |
| 716 } | 717 } |
| 717 | 718 |
| 718 AutocompleteMatch* keyword_match = match_.associated_keyword.get(); | 719 AutocompleteMatch* keyword_match = match_.associated_keyword.get(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 749 .GetFontList(GetTextStyle(1).font) | 750 .GetFontList(GetTextStyle(1).font) |
| 750 .GetHeight(); | 751 .GetHeight(); |
| 751 } | 752 } |
| 752 | 753 |
| 753 int OmniboxResultView::GetContentLineHeight() const { | 754 int OmniboxResultView::GetContentLineHeight() const { |
| 754 return std::max(default_icon_size_ + (kMinimumIconVerticalPadding * 2), | 755 return std::max(default_icon_size_ + (kMinimumIconVerticalPadding * 2), |
| 755 GetTextHeight() + (kMinimumTextVerticalPadding * 2)); | 756 GetTextHeight() + (kMinimumTextVerticalPadding * 2)); |
| 756 } | 757 } |
| 757 | 758 |
| 758 void OmniboxResultView::AppendAnswerText( | 759 void OmniboxResultView::AppendAnswerText( |
| 759 const SuggestionAnswer::TextField& text_field) { | 760 const SuggestionAnswer::TextField& text_field, |
| 761 bool prefix_space) { |
| 762 base::string16 text = text_field.text(); |
| 763 if (prefix_space) |
| 764 text.insert(0, base::UTF8ToUTF16(" ")); |
| 760 int offset = description_rendertext_->text().length(); | 765 int offset = description_rendertext_->text().length(); |
| 761 gfx::Range range(offset, offset + text_field.text().length()); | 766 gfx::Range range(offset, offset + text.length()); |
| 762 description_rendertext_->AppendText(text_field.text()); | 767 description_rendertext_->AppendText(text); |
| 763 const TextStyle& text_style = GetTextStyle(text_field.type()); | 768 const TextStyle& text_style = GetTextStyle(text_field.type()); |
| 764 // TODO(dschuyler): follow up on the problem of different font sizes within | 769 // TODO(dschuyler): follow up on the problem of different font sizes within |
| 765 // one RenderText. | 770 // one RenderText. |
| 766 description_rendertext_->SetFontList( | 771 description_rendertext_->SetFontList( |
| 767 ui::ResourceBundle::GetSharedInstance().GetFontList(text_style.font)); | 772 ui::ResourceBundle::GetSharedInstance().GetFontList(text_style.font)); |
| 768 description_rendertext_->ApplyColor( | 773 description_rendertext_->ApplyColor( |
| 769 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); | 774 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); |
| 770 description_rendertext_->ApplyBaselineStyle(text_style.baseline, range); | 775 description_rendertext_->ApplyBaselineStyle(text_style.baseline, range); |
| 771 } | 776 } |
| OLD | NEW |