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

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

Issue 2943533002: Use the result view font list for the base answers font. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 732
733 const gfx::FontList& OmniboxResultView::GetAnswerFont() const { 733 const gfx::FontList& OmniboxResultView::GetAnswerFont() const {
734 // This assumes that the first text type in the second answer line can be used 734 // This assumes that the first text type in the second answer line can be used
735 // to specify the font for all the text fields in the line. For now this works 735 // to specify the font for all the text fields in the line. For now this works
736 // but eventually it will be necessary to get RenderText to support multiple 736 // but eventually it will be necessary to get RenderText to support multiple
737 // font sizes or use multiple RenderTexts. 737 // font sizes or use multiple RenderTexts.
738 int text_type = 738 int text_type =
739 match_.answer && !match_.answer->second_line().text_fields().empty() 739 match_.answer && !match_.answer->second_line().text_fields().empty()
740 ? match_.answer->second_line().text_fields()[0].type() 740 ? match_.answer->second_line().text_fields()[0].type()
741 : SuggestionAnswer::SUGGESTION; 741 : SuggestionAnswer::SUGGESTION;
742
743 // When BaseFont is specified, reuse font_list_, which may have had size
744 // adjustments from BaseFont before it was provided to this class.
Peter Kasting 2017/06/15 22:50:28 Hmm. It seems like if the font passed in has been
Justin Donnelly 2017/06/16 14:28:23 Yeah, it feels like that's the right thing to do.
Peter Kasting 2017/06/16 23:47:21 Hrm, I would worry about this, especially for user
Justin Donnelly 2017/06/21 21:13:49 I'm interested in how answers look with different
Peter Kasting 2017/06/21 21:20:23 On Win 7, try Control Panel > Appearance and Perso
Justin Donnelly 2017/06/21 21:32:07 Thanks! It's so obvious, why didn't I think of tha
745 if (GetTextStyle(text_type).font == ui::ResourceBundle::BaseFont)
Peter Kasting 2017/06/15 22:50:28 Nit: Use a temp for this subexpression that's repe
Justin Donnelly 2017/06/16 14:28:23 Done.
746 return font_list_;
747
742 return ui::ResourceBundle::GetSharedInstance().GetFontList( 748 return ui::ResourceBundle::GetSharedInstance().GetFontList(
743 GetTextStyle(text_type).font); 749 GetTextStyle(text_type).font);
744 } 750 }
745 751
746 int OmniboxResultView::GetAnswerHeight() const { 752 int OmniboxResultView::GetAnswerHeight() const {
747 // If the answer specifies a maximum of 1 line we can simply return the answer 753 // If the answer specifies a maximum of 1 line we can simply return the answer
748 // font height. 754 // font height.
749 if (match_.answer->second_line().num_text_lines() == 1) 755 if (match_.answer->second_line().num_text_lines() == 1)
750 return GetAnswerFont().GetHeight(); 756 return GetAnswerFont().GetHeight();
751 757
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 destination->AppendText(text); 852 destination->AppendText(text);
847 const TextStyle& text_style = GetTextStyle(text_type); 853 const TextStyle& text_style = GetTextStyle(text_type);
848 // TODO(dschuyler): follow up on the problem of different font sizes within 854 // TODO(dschuyler): follow up on the problem of different font sizes within
849 // one RenderText. Maybe with destination->SetFontList(...). 855 // one RenderText. Maybe with destination->SetFontList(...).
850 destination->ApplyWeight( 856 destination->ApplyWeight(
851 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range); 857 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range);
852 destination->ApplyColor( 858 destination->ApplyColor(
853 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); 859 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range);
854 destination->ApplyBaselineStyle(text_style.baseline, range); 860 destination->ApplyBaselineStyle(text_style.baseline, range);
855 } 861 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698