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

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

Issue 2874593002: Omnibox UI Experiments: Clean up naming for Vertical Margin (Closed)
Patch Set: fix 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 description_rendertext_->GetStringSize(); 720 description_rendertext_->GetStringSize();
721 return GetAnswerFont().GetHeight() * description_rendertext_->GetNumLines(); 721 return GetAnswerFont().GetHeight() * description_rendertext_->GetNumLines();
722 } 722 }
723 723
724 int OmniboxResultView::GetVerticalMargin() const { 724 int OmniboxResultView::GetVerticalMargin() const {
725 // Regardless of the text size, we ensure a minimum size for the content line 725 // Regardless of the text size, we ensure a minimum size for the content line
726 // here. This minimum is larger for hybrid mouse/touch devices to ensure an 726 // here. This minimum is larger for hybrid mouse/touch devices to ensure an
727 // adequately sized touch target. 727 // adequately sized touch target.
728 using Md = ui::MaterialDesignController; 728 using Md = ui::MaterialDesignController;
729 const int kIconVerticalPad = base::GetFieldTrialParamByFeatureAsInt( 729 const int kIconVerticalPad = base::GetFieldTrialParamByFeatureAsInt(
730 omnibox::kUIExperiments, 730 omnibox::kUIExperimentVerticalMargin,
731 OmniboxFieldTrial::kUIExperimentsVerticalMarginParam, 731 OmniboxFieldTrial::kUIVerticalMarginParam,
732 Md::GetMode() == Md::MATERIAL_HYBRID ? 8 : 4); 732 Md::GetMode() == Md::MATERIAL_HYBRID ? 8 : 4);
733 const int min_height = LocationBarView::kIconWidth + 2 * kIconVerticalPad; 733 const int min_height = LocationBarView::kIconWidth + 2 * kIconVerticalPad;
734 734
735 return std::max(kVerticalPadding, (min_height - GetTextHeight()) / 2); 735 return std::max(kVerticalPadding, (min_height - GetTextHeight()) / 2);
736 } 736 }
737 737
738 std::unique_ptr<gfx::RenderText> OmniboxResultView::CreateAnswerText( 738 std::unique_ptr<gfx::RenderText> OmniboxResultView::CreateAnswerText(
739 const SuggestionAnswer::ImageLine& line, 739 const SuggestionAnswer::ImageLine& line,
740 const gfx::FontList& font_list) const { 740 const gfx::FontList& font_list) const {
741 std::unique_ptr<gfx::RenderText> destination = 741 std::unique_ptr<gfx::RenderText> destination =
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698