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

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

Issue 1399253005: Fix layout of omnibox rows for material design (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 #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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 } 715 }
716 716
717 void OmniboxResultView::AnimationProgressed(const gfx::Animation* animation) { 717 void OmniboxResultView::AnimationProgressed(const gfx::Animation* animation) {
718 Layout(); 718 Layout();
719 SchedulePaint(); 719 SchedulePaint();
720 } 720 }
721 721
722 int OmniboxResultView::GetAnswerLineHeight() const { 722 int OmniboxResultView::GetAnswerLineHeight() const {
723 // GetTextStyle(1) is the largest font used and so defines the boundary that 723 // GetTextStyle(1) is the largest font used and so defines the boundary that
724 // all the other answer styles fit within. 724 // all the other answer styles fit within.
725 return ui::ResourceBundle::GetSharedInstance() 725 int font_height =
726 ui::ResourceBundle::GetSharedInstance()
726 .GetFontList(GetTextStyle(1).font) 727 .GetFontList(GetTextStyle(1).font)
727 .GetHeight(); 728 .GetHeight();
729 if (!ui::MaterialDesignController::IsModeMaterial())
730 return font_height;
731
732 // Answer lines should be at least as tall as content lines in
733 // material design.
734 return std::max(font_height, GetContentLineHeight());
Peter Kasting 2015/10/13 19:21:17 Where in the specs is this requirement? I don't u
728 } 735 }
729 736
730 int OmniboxResultView::GetContentLineHeight() const { 737 int OmniboxResultView::GetContentLineHeight() const {
731 return std::max( 738 return std::max(
732 default_icon_size_ + GetLayoutInsets(OMNIBOX_DROPDOWN_ICON).height(), 739 default_icon_size_ + GetLayoutInsets(OMNIBOX_DROPDOWN_ICON).height(),
733 GetTextHeight() + GetLayoutInsets(OMNIBOX_DROPDOWN_TEXT).height()); 740 GetTextHeight() + GetLayoutInsets(OMNIBOX_DROPDOWN_TEXT).height());
734 } 741 }
735 742
736 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateAnswerLine( 743 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateAnswerLine(
737 const SuggestionAnswer::ImageLine& line, 744 const SuggestionAnswer::ImageLine& line,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 810
804 int OmniboxResultView::StartMargin() const { 811 int OmniboxResultView::StartMargin() const {
805 return ui::MaterialDesignController::IsModeMaterial() ? 812 return ui::MaterialDesignController::IsModeMaterial() ?
806 model_->start_margin() : 0; 813 model_->start_margin() : 0;
807 } 814 }
808 815
809 int OmniboxResultView::EndMargin() const { 816 int OmniboxResultView::EndMargin() const {
810 return ui::MaterialDesignController::IsModeMaterial() ? 817 return ui::MaterialDesignController::IsModeMaterial() ?
811 model_->end_margin() : 0; 818 model_->end_margin() : 0;
812 } 819 }
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