Commit 95b77af2 authored by bruthig's avatar bruthig Committed by Commit bot

[ash-md] Changed the system info row height to 40 (instead of 48).

BUG=671816
TEST=TriView.SetMinHeight

Review-Url: https://codereview.chromium.org/2605513002
Cr-Commit-Position: refs/heads/master@{#441411}
parent 25da6356
...@@ -155,15 +155,6 @@ void PowerStatusView::ChildPreferredSizeChanged(views::View* child) { ...@@ -155,15 +155,6 @@ void PowerStatusView::ChildPreferredSizeChanged(views::View* child) {
PreferredSizeChanged(); PreferredSizeChanged();
} }
gfx::Size PowerStatusView::GetPreferredSize() const {
gfx::Size size = views::View::GetPreferredSize();
return gfx::Size(size.width(), GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT));
}
int PowerStatusView::GetHeightForWidth(int width) const {
return GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT);
}
void PowerStatusView::Layout() { void PowerStatusView::Layout() {
views::View::Layout(); views::View::Layout();
......
...@@ -25,8 +25,6 @@ class ASH_EXPORT PowerStatusView : public views::View, ...@@ -25,8 +25,6 @@ class ASH_EXPORT PowerStatusView : public views::View,
~PowerStatusView() override; ~PowerStatusView() override;
// views::View: // views::View:
gfx::Size GetPreferredSize() const override;
int GetHeightForWidth(int width) const override;
void Layout() override; void Layout() override;
void OnNativeThemeChanged(const ui::NativeTheme* theme) override; void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
......
...@@ -173,8 +173,6 @@ DateView::DateView(SystemTrayItem* owner) ...@@ -173,8 +173,6 @@ DateView::DateView(SystemTrayItem* owner)
views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
box_layout->set_cross_axis_alignment( box_layout->set_cross_axis_alignment(
views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
box_layout->set_minimum_cross_axis_size(
GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT));
SetLayoutManager(box_layout); SetLayoutManager(box_layout);
} else { } else {
SetLayoutManager( SetLayoutManager(
......
...@@ -29,6 +29,7 @@ SystemInfoDefaultView::SystemInfoDefaultView(SystemTrayItem* owner, ...@@ -29,6 +29,7 @@ SystemInfoDefaultView::SystemInfoDefaultView(SystemTrayItem* owner,
LoginStatus login) LoginStatus login)
: date_view_(nullptr), : date_view_(nullptr),
tri_view_(TrayPopupUtils::CreateMultiTargetRowView()) { tri_view_(TrayPopupUtils::CreateMultiTargetRowView()) {
tri_view_->SetMinHeight(kTrayPopupSystemInfoRowHeight);
AddChildView(tri_view_); AddChildView(tri_view_);
SetLayoutManager(new views::FillLayout); SetLayoutManager(new views::FillLayout);
......
...@@ -107,6 +107,8 @@ const float kTrayPopupInkDropHighlightOpacity = 0.08f; ...@@ -107,6 +107,8 @@ const float kTrayPopupInkDropHighlightOpacity = 0.08f;
const int kTrayPopupInkDropInset = 4; const int kTrayPopupInkDropInset = 4;
const int kTrayPopupInkDropCornerRadius = 2; const int kTrayPopupInkDropCornerRadius = 2;
const int kTrayPopupSystemInfoRowHeight = 40;
int GetTrayConstant(TrayConstant constant) { int GetTrayConstant(TrayConstant constant) {
const int kTrayItemHeightLegacy[] = {38, kTrayItemSize, kTrayItemSize}; const int kTrayItemHeightLegacy[] = {38, kTrayItemSize, kTrayItemSize};
const int kTraySpacing[] = {4, 0, 0}; const int kTraySpacing[] = {4, 0, 0};
......
...@@ -140,6 +140,9 @@ extern const int kTrayPopupInkDropInset; ...@@ -140,6 +140,9 @@ extern const int kTrayPopupInkDropInset;
// The radius used to draw the corners of the rounded rect style ink drops. // The radius used to draw the corners of the rounded rect style ink drops.
extern const int kTrayPopupInkDropCornerRadius; extern const int kTrayPopupInkDropCornerRadius;
// The height of the system info row.
extern const int kTrayPopupSystemInfoRowHeight;
enum TrayConstant { enum TrayConstant {
// A legacy height value used in non-MD calculations for applying additional // A legacy height value used in non-MD calculations for applying additional
// borders on tray items. // borders on tray items.
......
...@@ -78,6 +78,22 @@ TriView::~TriView() { ...@@ -78,6 +78,22 @@ TriView::~TriView() {
enable_hierarchy_changed_dcheck_ = false; enable_hierarchy_changed_dcheck_ = false;
} }
void TriView::SetMinHeight(int height) {
gfx::Size min_size;
min_size = GetMinSize(TriView::Container::START);
min_size.set_height(height);
SetMinSize(TriView::Container::START, min_size);
min_size = GetMinSize(TriView::Container::CENTER);
min_size.set_height(height);
SetMinSize(TriView::Container::CENTER, min_size);
min_size = GetMinSize(TriView::Container::END);
min_size.set_height(height);
SetMinSize(TriView::Container::END, min_size);
}
void TriView::SetMinSize(Container container, const gfx::Size& size) { void TriView::SetMinSize(Container container, const gfx::Size& size) {
GetLayoutManager(container)->SetMinSize(size); GetLayoutManager(container)->SetMinSize(size);
} }
......
...@@ -70,6 +70,9 @@ class ASH_EXPORT TriView : public views::View { ...@@ -70,6 +70,9 @@ class ASH_EXPORT TriView : public views::View {
~TriView() override; ~TriView() override;
// Set the minimum height for all containers to |height|.
void SetMinHeight(int height);
// Set the minimum size for the given |container|. // Set the minimum size for the given |container|.
void SetMinSize(Container container, const gfx::Size& size); void SetMinSize(Container container, const gfx::Size& size);
......
...@@ -34,6 +34,9 @@ class TriViewTest : public testing::Test { ...@@ -34,6 +34,9 @@ class TriViewTest : public testing::Test {
TriViewTest(); TriViewTest();
protected: protected:
// Convenience function to get the minimum height of |container|.
int GetMinHeight(TriView::Container container) const;
// Returns the bounds of |child| in the coordinate space of // Returns the bounds of |child| in the coordinate space of
// |tri_view_|. // |tri_view_|.
gfx::Rect GetBoundsInHost(const views::View* child) const; gfx::Rect GetBoundsInHost(const views::View* child) const;
...@@ -50,6 +53,10 @@ class TriViewTest : public testing::Test { ...@@ -50,6 +53,10 @@ class TriViewTest : public testing::Test {
TriViewTest::TriViewTest() : tri_view_(base::MakeUnique<TriView>()) {} TriViewTest::TriViewTest() : tri_view_(base::MakeUnique<TriView>()) {}
int TriViewTest::GetMinHeight(TriView::Container container) const {
return tri_view_->GetMinSize(container).height();
}
gfx::Rect TriViewTest::GetBoundsInHost(const views::View* child) const { gfx::Rect TriViewTest::GetBoundsInHost(const views::View* child) const {
gfx::RectF rect_f(child->bounds()); gfx::RectF rect_f(child->bounds());
views::View::ConvertRectToTarget(child, tri_view_.get(), &rect_f); views::View::ConvertRectToTarget(child, tri_view_.get(), &rect_f);
...@@ -356,4 +363,18 @@ TEST_F(TriViewTest, ChildViewsPreferredSizeChanged) { ...@@ -356,4 +363,18 @@ TEST_F(TriViewTest, ChildViewsPreferredSizeChanged) {
EXPECT_EQ(child_view->GetPreferredSize(), child_view->size()); EXPECT_EQ(child_view->GetPreferredSize(), child_view->size());
} }
TEST_F(TriViewTest, SetMinHeight) {
const int kMinHeight = 10;
EXPECT_NE(kMinHeight, GetMinHeight(TriView::Container::START));
EXPECT_NE(kMinHeight, GetMinHeight(TriView::Container::CENTER));
EXPECT_NE(kMinHeight, GetMinHeight(TriView::Container::END));
tri_view_->SetMinHeight(kMinHeight);
EXPECT_EQ(kMinHeight, GetMinHeight(TriView::Container::START));
EXPECT_EQ(kMinHeight, GetMinHeight(TriView::Container::CENTER));
EXPECT_EQ(kMinHeight, GetMinHeight(TriView::Container::END));
}
} // namespace ash } // namespace ash
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