Commit 9d69ec10 authored by Fabio Tirelo's avatar Fabio Tirelo Committed by Commit Bot

[af] Fix footer height and horizontal margins for the new dropdown

This addresses the following feedback provided during UI review:
 - Footer item height should be 40 = 36 (suggestion height) +
   4 (compensation for corner radius); in the current implementation,
   this is 44 (36 + 2 * 4).
 - All footer items should have the same value; in the current
   implementation, the last one is taller than the others.
 - Left and right padding should also compensate for the corner
   radius; it's 8 today, should be 8 + 4.

Bug: 851009
Change-Id: I0dad1c8bbbe97dce9341900d25af44df9efbde11
Reviewed-on: https://chromium-review.googlesource.com/1091158Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566943}
parent 992979a6
...@@ -120,21 +120,21 @@ class AutofillPopupItemView : public AutofillPopupRowView { ...@@ -120,21 +120,21 @@ class AutofillPopupItemView : public AutofillPopupRowView {
protected: protected:
AutofillPopupItemView(AutofillPopupController* controller, AutofillPopupItemView(AutofillPopupController* controller,
int line_number, int line_number,
int extra_bottom_padding = 0) int extra_height = 0)
: AutofillPopupRowView(controller, line_number), : AutofillPopupRowView(controller, line_number),
extra_bottom_padding_(extra_bottom_padding) {} extra_height_(extra_height) {}
// AutofillPopupRowView: // AutofillPopupRowView:
void CreateContent() override { void CreateContent() override {
auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kHorizontal, views::BoxLayout::kHorizontal,
gfx::Insets(extra_bottom_padding_, gfx::Insets(0, views::MenuConfig::instance().item_horizontal_padding +
views::MenuConfig::instance().item_horizontal_padding))); GetCornerRadius())));
layout->set_cross_axis_alignment( layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::CROSS_AXIS_ALIGNMENT_CENTER); views::BoxLayout::CrossAxisAlignment::CROSS_AXIS_ALIGNMENT_CENTER);
layout->set_minimum_cross_axis_size( layout->set_minimum_cross_axis_size(
views::MenuConfig::instance().touchable_menu_height); views::MenuConfig::instance().touchable_menu_height + extra_height_);
// TODO(crbug.com/831603): Remove elision responsibilities from controller. // TODO(crbug.com/831603): Remove elision responsibilities from controller.
text_label_ = new views::Label( text_label_ = new views::Label(
...@@ -202,7 +202,7 @@ class AutofillPopupItemView : public AutofillPopupRowView { ...@@ -202,7 +202,7 @@ class AutofillPopupItemView : public AutofillPopupRowView {
layout->SetFlexForView(spacer, /*flex=*/resize ? 1 : 0); layout->SetFlexForView(spacer, /*flex=*/resize ? 1 : 0);
} }
const int extra_bottom_padding_; const int extra_height_;
views::Label* text_label_ = nullptr; views::Label* text_label_ = nullptr;
views::Label* subtext_label_ = nullptr; views::Label* subtext_label_ = nullptr;
...@@ -244,10 +244,9 @@ class AutofillPopupFooterView : public AutofillPopupItemView { ...@@ -244,10 +244,9 @@ class AutofillPopupFooterView : public AutofillPopupItemView {
~AutofillPopupFooterView() override = default; ~AutofillPopupFooterView() override = default;
static AutofillPopupFooterView* Create(AutofillPopupController* controller, static AutofillPopupFooterView* Create(AutofillPopupController* controller,
int line_number, int line_number) {
int extra_bottom_padding) { AutofillPopupFooterView* result =
AutofillPopupFooterView* result = new AutofillPopupFooterView( new AutofillPopupFooterView(controller, line_number);
controller, line_number, extra_bottom_padding);
result->Init(); result->Init();
return result; return result;
} }
...@@ -270,10 +269,8 @@ class AutofillPopupFooterView : public AutofillPopupItemView { ...@@ -270,10 +269,8 @@ class AutofillPopupFooterView : public AutofillPopupItemView {
} }
private: private:
AutofillPopupFooterView(AutofillPopupController* controller, AutofillPopupFooterView(AutofillPopupController* controller, int line_number)
int line_number, : AutofillPopupItemView(controller, line_number, GetCornerRadius()) {
int extra_bottom_padding)
: AutofillPopupItemView(controller, line_number, extra_bottom_padding) {
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ALWAYS);
} }
...@@ -527,10 +524,8 @@ void AutofillPopupViewNativeViews::CreateChildViews() { ...@@ -527,10 +524,8 @@ void AutofillPopupViewNativeViews::CreateChildViews() {
views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
while (line_number < controller_->GetLineCount()) { while (line_number < controller_->GetLineCount()) {
rows_.push_back(AutofillPopupFooterView::Create( rows_.push_back(
controller_, line_number, AutofillPopupFooterView::Create(controller_, line_number));
line_number == controller_->GetLineCount() - 1 ? GetCornerRadius()
: 0));
footer_container->AddChildView(rows_.back()); footer_container->AddChildView(rows_.back());
line_number++; line_number++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment