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

Unified Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc

Issue 1522563002: Modernize autofill popup design (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_popup_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
index 1827dc7e61860f056916e42d9824cab8650e7448..05944892b1059abb40cc7d680556108d1273a933 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -18,6 +18,7 @@
#include "components/autofill/core/common/autofill_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "grit/components_scaled_resources.h"
+#include "ui/base/resource/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/event.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -36,6 +37,10 @@ const int kNoSelection = -1;
// The vertical height of each row in pixels.
const size_t kRowHeight = 24;
+const size_t kMaterialRowHeight = 36;
+
+// The vertical height of the option row in pixel.
+const size_t kMaterialOptionRowHeight = 44;
// The vertical height of a separator in pixels.
const size_t kSeparatorHeight = 1;
@@ -43,10 +48,12 @@ const size_t kSeparatorHeight = 1;
#if !defined(OS_ANDROID) || defined(USE_AURA)
// Size difference between name and label in pixels.
const int kLabelFontSizeDelta = -2;
+const int kMaterialLabelFontSizeDelta = -3;
const size_t kNamePadding = AutofillPopupView::kNamePadding;
const size_t kIconPadding = AutofillPopupView::kIconPadding;
const size_t kEndPadding = AutofillPopupView::kEndPadding;
+const size_t kMaterialEndPadding = AutofillPopupView::kMaterialEndPadding;
#endif
struct DataResource {
@@ -114,7 +121,10 @@ AutofillPopupControllerImpl::AutofillPopupControllerImpl(
base::Bind(&AutofillPopupControllerImpl::HandleKeyPressEvent,
base::Unretained(this)));
#if !defined(OS_ANDROID) || defined(USE_AURA)
- label_font_list_ = value_font_list_.DeriveWithSizeDelta(kLabelFontSizeDelta);
+ label_font_list_ = value_font_list_.DeriveWithSizeDelta(
+ ui::MaterialDesignController::IsModeMaterial()
Evan Stade 2015/12/14 21:37:44 please don't reuse this flag. I'm not sure we need
+ ? kMaterialLabelFontSizeDelta
+ : kLabelFontSizeDelta);
title_font_list_ = value_font_list_.DeriveWithStyle(gfx::Font::BOLD);
#if defined(OS_MACOSX)
// There is no italic version of the system font.
@@ -377,11 +387,9 @@ gfx::Rect AutofillPopupControllerImpl::GetRowBounds(size_t index) {
top += GetRowHeightFromId(suggestions_[i].frontend_id);
}
- return gfx::Rect(
- kPopupBorderThickness,
- top,
- popup_bounds_.width() - 2 * kPopupBorderThickness,
- GetRowHeightFromId(suggestions_[index].frontend_id));
+ return gfx::Rect(kPopupBorderThickness, top,
+ popup_bounds_.width() - 2 * kPopupBorderThickness,
+ GetRowHeightFromId(suggestions_[index].frontend_id));
}
void AutofillPopupControllerImpl::SetPopupBounds(const gfx::Rect& bounds) {
@@ -563,6 +571,13 @@ int AutofillPopupControllerImpl::GetRowHeightFromId(int identifier) const {
if (identifier == POPUP_ITEM_ID_SEPARATOR)
return kSeparatorHeight;
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ if (identifier == POPUP_ITEM_ID_AUTOFILL_OPTIONS)
Evan Stade 2015/12/14 21:37:44 ternary operator
+ return kMaterialOptionRowHeight;
+ else
+ return kMaterialRowHeight;
+ }
+
return kRowHeight;
}
@@ -629,7 +644,9 @@ int AutofillPopupControllerImpl::GetDesiredPopupHeight() const {
}
int AutofillPopupControllerImpl::RowWidthWithoutText(int row) const {
- int row_size = kEndPadding;
+ int row_size = ui::MaterialDesignController::IsModeMaterial()
+ ? kMaterialEndPadding
+ : kEndPadding;
if (!elided_labels_[row].empty())
row_size += kNamePadding;
@@ -643,7 +660,9 @@ int AutofillPopupControllerImpl::RowWidthWithoutText(int row) const {
}
// Add the padding at the end.
- row_size += kEndPadding;
+ row_size += ui::MaterialDesignController::IsModeMaterial()
+ ? kMaterialEndPadding
+ : kEndPadding;
// Add room for the popup border.
row_size += 2 * kPopupBorderThickness;
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_popup_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698