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

Unified Diff: ash/system/status_area_widget_delegate.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/system/status_area_widget_delegate.cc
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc
index 08c580e4254b32802b701bbd0d9d408edcfaf97d..54d7ec537396dd55f4b06178dcb7a4a583b2371e 100644
--- a/ash/system/status_area_widget_delegate.cc
+++ b/ash/system/status_area_widget_delegate.cc
@@ -7,7 +7,6 @@
#include "ash/ash_export.h"
#include "ash/common/ash_switches.h"
#include "ash/common/focus_cycler.h"
-#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/wm_shelf_util.h"
#include "ash/common/shell_window_ids.h"
@@ -111,16 +110,6 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
- // Update tray border based on layout.
- bool is_child_on_edge = true;
- for (int c = 0; c < child_count(); ++c) {
- views::View* child = child_at(c);
- if (!child->visible())
- continue;
- SetBorderOnChild(child, is_child_on_edge);
- is_child_on_edge = false;
- }
-
views::ColumnSet* columns = layout->AddColumnSet(0);
if (IsHorizontalAlignment(alignment_)) {
@@ -181,51 +170,4 @@ void StatusAreaWidgetDelegate::UpdateWidgetSize() {
GetWidget()->SetSize(GetPreferredSize());
}
-void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child,
- bool extend_border_to_edge) {
- const int shelf_size = GetShelfConstant(SHELF_SIZE);
- const int item_height = GetTrayConstant(TRAY_ITEM_HEIGHT_LEGACY);
- int top_edge, left_edge, bottom_edge, right_edge;
-
- // Tray views are laid out right-to-left or bottom-to-top.
- if (MaterialDesignController::IsShelfMaterial()) {
- const bool horizontal_alignment = IsHorizontalAlignment(alignment_);
- const int padding = (shelf_size - item_height) / 2;
- const int extended_padding =
- GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF);
-
- top_edge = horizontal_alignment ? padding : 0;
- left_edge = horizontal_alignment ? 0 : padding;
- bottom_edge = horizontal_alignment
- ? padding
- : (extend_border_to_edge ? extended_padding : 0);
- right_edge = horizontal_alignment
- ? (extend_border_to_edge ? extended_padding : 0)
- : padding;
- } else {
- bool on_edge = (child == child_at(0));
- if (IsHorizontalAlignment(alignment_)) {
- top_edge = kShelfItemInset;
- left_edge = 0;
- bottom_edge = shelf_size - kShelfItemInset - item_height;
- right_edge =
- on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0;
- } else if (alignment_ == SHELF_ALIGNMENT_LEFT) {
- top_edge = 0;
- left_edge = shelf_size - kShelfItemInset - item_height;
- bottom_edge =
- on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0;
- right_edge = kShelfItemInset;
- } else { // SHELF_ALIGNMENT_RIGHT
- top_edge = 0;
- left_edge = kShelfItemInset;
- bottom_edge =
- on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0;
- right_edge = shelf_size - kShelfItemInset - item_height;
- }
- }
- child->SetBorder(views::Border::CreateEmptyBorder(top_edge, left_edge,
- bottom_edge, right_edge));
-}
-
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698