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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 795933009: [AiS] for desktop, two lines and font sytles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Positive/Negative font change Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index fe061f65a9c0175152fd9e6d013d990b650f4663..ec4cd90d8871ba4d76b81023326da10b10330770 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
+#include "components/omnibox/omnibox_field_trial.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
@@ -384,22 +385,34 @@ int OmniboxPopupContentsView::CalculatePopupHeight() {
i < model_->result().size(); ++i)
popup_height += child_at(i)->GetPreferredSize().height();
- // Add enough space on the top and bottom so it looks like there is the same
- // amount of space between the text and the popup border as there is in the
- // interior between each row of text.
- //
- // Discovering the exact amount of leading and padding around the font is
- // a bit tricky and platform-specific, but this computation seems to work in
- // practice.
- OmniboxResultView* result_view = result_view_at(0);
- outside_vertical_padding_ =
- (result_view->GetPreferredSize().height() -
- result_view->GetTextHeight());
-
- return popup_height +
- views::NonClientFrameView::kClientEdgeThickness + // Top border.
- outside_vertical_padding_ * 2 + // Padding.
- bottom_shadow_->height() - kBorderInterior; // Bottom border.
+ if (OmniboxFieldTrial::EnableAnswersInSuggest()) {
+ // In the current mockup, the cell heights for the result views can
Peter Kasting 2015/03/12 09:45:59 Nit: Remove "In the current mockup"
dschuyler 2015/03/13 06:01:20 Done.
+ // vary cell to cell. They may vary by the number of lines used for the
+ // result or by the fonts used. Because of this, we're not able to use the
+ // <preferred size height minus text height> method used below.
+ outside_vertical_padding_ =
+ result_view_at(0)->get_minimum_text_vertical_padding();
Peter Kasting 2015/03/12 09:45:59 So, in practice, what does this end up computing t
dschuyler 2015/03/13 06:01:20 The padding was 3 pixels. In the other case it may
+ return popup_height +
+ views::NonClientFrameView::kClientEdgeThickness + // Top border.
+ outside_vertical_padding_ * 2 + // Padding.
+ bottom_shadow_->height() - kBorderInterior; // Bottom border.
Peter Kasting 2015/03/12 09:45:59 This return statement is a duplicate of the one be
dschuyler 2015/03/13 06:01:20 Done.
+ } else {
+ // Add enough space on the top and bottom so it looks like there is the same
+ // amount of space between the text and the popup border as there is in the
+ // interior between each row of text.
+ //
+ // Discovering the exact amount of leading and padding around the font is
+ // a bit tricky and platform-specific, but this computation seems to work in
+ // practice.
+ OmniboxResultView* result_view = result_view_at(0);
+ outside_vertical_padding_ = (result_view->GetPreferredSize().height() -
+ result_view->GetTextHeight());
+
+ return popup_height +
+ views::NonClientFrameView::kClientEdgeThickness + // Top border.
+ outside_vertical_padding_ * 2 + // Padding.
+ bottom_shadow_->height() - kBorderInterior; // Bottom border.
+ }
}
OmniboxResultView* OmniboxPopupContentsView::CreateResultView(

Powered by Google App Engine
This is Rietveld 408576698