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

Unified Diff: ash/common/system/tray/tray_background_view.cc

Issue 2103113003: Fix shelf layout when switching from left-aligned shelf to right-aligned shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 6 months 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
Index: ash/common/system/tray/tray_background_view.cc
diff --git a/ash/common/system/tray/tray_background_view.cc b/ash/common/system/tray/tray_background_view.cc
index 2192034abaa42599a181c45050136a256754490b..740dacacf67ab4645da8adc0b450788c3cfdf91f 100644
--- a/ash/common/system/tray/tray_background_view.cc
+++ b/ash/common/system/tray/tray_background_view.cc
@@ -251,8 +251,9 @@ TrayBackgroundView::~TrayBackgroundView() {
StopObservingImplicitAnimations();
}
-void TrayBackgroundView::Initialize() {
+void TrayBackgroundView::Initialize(const gfx::Insets& insets) {
GetWidget()->AddObserver(widget_observer_.get());
+ SetTrayBorder(insets);
}
// static
@@ -375,11 +376,18 @@ void TrayBackgroundView::SetContentsBackground() {
tray_container_->set_background(background_);
}
-void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
+void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment,
+ const gfx::Insets& insets) {
shelf_alignment_ = alignment;
+ SetTrayBorder(insets);
James Cook 2016/06/29 19:34:14 This should pull the insets from somewhere, rather
tray_container_->SetAlignment(alignment);
}
+void TrayBackgroundView::SetTrayBorder(const gfx::Insets& insets) {
+ SetBorder(views::Border::CreateEmptyBorder(insets.top(), insets.left(),
+ insets.bottom(), insets.right()));
+}
+
void TrayBackgroundView::OnImplicitAnimationsCompleted() {
// If there is another animation in the queue, the reverse animation was
// triggered before the completion of animating to invisible. Do not turn off

Powered by Google App Engine
This is Rietveld 408576698