0

Apply padding to UiElementContainer.

Previously, rendered cards had margins so no padding needed to be
applied by the embedding view. Internal margins have been removed from
cards so it is now up to the embedding view to apply padding if needed.

See before/after in bug.

Bug: b:79214709
Change-Id: Ia173c97a955f7391d71e84fcd1859fea5d5f2cb1
Reviewed-on: https://chromium-review.googlesource.com/1043450
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#556097}
This commit is contained in:
David Black
2018-05-04 17:31:26 +00:00
committed by Commit Bot
parent 61b2c8b852
commit 58923711a3

@ -16,7 +16,6 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/render_text.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
@ -232,8 +231,6 @@ class UiElementContainer : public views::View {
views::View* text_container = new views::View();
text_container->SetBackground(std::make_unique<RoundRectBackground>(
kTextBackgroundColor, kTextCornerRadiusDip));
text_container->SetBorder(
views::CreateEmptyBorder(0, kPaddingDip, 0, kPaddingDip));
text_container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal,
gfx::Insets(kTextPaddingVerticalDip, kTextPaddingHorizontalDip)));
@ -271,8 +268,8 @@ class UiElementContainer : public views::View {
void InitLayout() {
views::BoxLayout* layout =
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(),
kSpacingDip));
views::BoxLayout::Orientation::kVertical,
gfx::Insets(0, kPaddingDip), kSpacingDip));
layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::CROSS_AXIS_ALIGNMENT_START);