Commit 8713c084 authored by Fabio Tirelo's avatar Fabio Tirelo Committed by Commit Bot

[AF] Use vertical padding from the layout provider in the AF dropdown

The new value is consistent across platforms and is according to
MD2 spec.

Bug: 860273
Change-Id: I4b1f28a8f063f08fe99865580f5ac7085d8c27d6
Reviewed-on: https://chromium-review.googlesource.com/1131680
Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574166}
parent f455e576
...@@ -58,6 +58,11 @@ int GetCornerRadius() { ...@@ -58,6 +58,11 @@ int GetCornerRadius() {
views::EMPHASIS_MEDIUM); views::EMPHASIS_MEDIUM);
} }
int GetContentsVerticalPadding() {
return ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_CONTENT_LIST_VERTICAL_MULTI);
}
} // namespace } // namespace
namespace autofill { namespace autofill {
...@@ -157,7 +162,6 @@ class AutofillPopupSeparatorView : public AutofillPopupRowView { ...@@ -157,7 +162,6 @@ class AutofillPopupSeparatorView : public AutofillPopupRowView {
void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void OnMouseEntered(const ui::MouseEvent& event) override {} void OnMouseEntered(const ui::MouseEvent& event) override {}
void OnMouseReleased(const ui::MouseEvent& event) override {} void OnMouseReleased(const ui::MouseEvent& event) override {}
void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
protected: protected:
// AutofillPopupRowView: // AutofillPopupRowView:
...@@ -367,11 +371,6 @@ void AutofillPopupSeparatorView::GetAccessibleNodeData( ...@@ -367,11 +371,6 @@ void AutofillPopupSeparatorView::GetAccessibleNodeData(
node_data->role = ax::mojom::Role::kSplitter; node_data->role = ax::mojom::Role::kSplitter;
} }
void AutofillPopupSeparatorView::OnNativeThemeChanged(
const ui::NativeTheme* theme) {
RefreshStyle();
}
void AutofillPopupSeparatorView::CreateContent() { void AutofillPopupSeparatorView::CreateContent() {
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
...@@ -379,18 +378,17 @@ void AutofillPopupSeparatorView::CreateContent() { ...@@ -379,18 +378,17 @@ void AutofillPopupSeparatorView::CreateContent() {
// view which matches the width of the parent (by using full flex) and has a // view which matches the width of the parent (by using full flex) and has a
// height equal to the desired padding, then paint a border on the bottom. // height equal to the desired padding, then paint a border on the bottom.
empty_ = new views::View(); empty_ = new views::View();
empty_->SetPreferredSize( empty_->SetPreferredSize(gfx::Size(1, GetContentsVerticalPadding()));
gfx::Size(1, views::MenuConfig::instance().menu_vertical_border_size));
AddChildView(empty_);
}
void AutofillPopupSeparatorView::RefreshStyle() {
empty_->SetBorder(views::CreateSolidSidedBorder( empty_->SetBorder(views::CreateSolidSidedBorder(
/*top=*/0, /*top=*/0,
/*left=*/0, /*left=*/0,
/*bottom=*/views::MenuConfig::instance().separator_thickness, /*bottom=*/views::MenuConfig::instance().separator_thickness,
/*right=*/0, /*right=*/0,
/*color=*/kAutofillPopupSeparatorColor)); /*color=*/kAutofillPopupSeparatorColor));
AddChildView(empty_);
}
void AutofillPopupSeparatorView::RefreshStyle() {
SchedulePaint(); SchedulePaint();
} }
...@@ -511,8 +509,7 @@ void AutofillPopupViewNativeViews::CreateChildViews() { ...@@ -511,8 +509,7 @@ void AutofillPopupViewNativeViews::CreateChildViews() {
views::BoxLayout* body_layout = views::BoxLayout* body_layout =
body_container->SetLayoutManager(std::make_unique<views::BoxLayout>( body_container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kVertical, views::BoxLayout::kVertical,
gfx::Insets(views::MenuConfig::instance().menu_vertical_border_size, gfx::Insets(GetContentsVerticalPadding(), 0)));
0)));
body_layout->set_main_axis_alignment( body_layout->set_main_axis_alignment(
views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
......
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