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

Side by Side Diff: ash/common/system/tray/tray_details_view.cc

Issue 2500433002: Revert of Correct spacing in scroll contents of Ash MD detailed view. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/tray/tray_details_view.h" 5 #include "ash/common/system/tray/tray_details_view.h"
6 6
7 #include "ash/common/ash_view_ids.h" 7 #include "ash/common/ash_view_ids.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
10 #include "ash/common/system/tray/system_tray.h" 10 #include "ash/common/system/tray/system_tray.h"
(...skipping 25 matching lines...) Expand all
36 // the children as sticky header rows. The sticky header rows are not scrolled 36 // the children as sticky header rows. The sticky header rows are not scrolled
37 // above the top of the visible viewport until the next one "pushes" it up and 37 // above the top of the visible viewport until the next one "pushes" it up and
38 // are painted above other children. To indicate that a child is a sticky header 38 // are painted above other children. To indicate that a child is a sticky header
39 // row use set_id(VIEW_ID_STICKY_HEADER). 39 // row use set_id(VIEW_ID_STICKY_HEADER).
40 class ScrollContentsView : public views::View, 40 class ScrollContentsView : public views::View,
41 public views::ViewTargeterDelegate { 41 public views::ViewTargeterDelegate {
42 public: 42 public:
43 ScrollContentsView() { 43 ScrollContentsView() {
44 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this)); 44 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this));
45 SetLayoutManager( 45 SetLayoutManager(
46 new views::BoxLayout(views::BoxLayout::kVertical, 0, 46 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
47 UseMd() ? kContentsVerticalSpacingMd : 0,
48 UseMd() ? 0 : kContentsBetweenChildSpacingNonMd));
49 } 47 }
50 ~ScrollContentsView() override {} 48 ~ScrollContentsView() override {}
51 49
52 protected: 50 protected:
53 // views::View: 51 // views::View:
54 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { 52 void OnBoundsChanged(const gfx::Rect& previous_bounds) override {
55 PositionHeaderRows(); 53 PositionHeaderRows();
56 } 54 }
57 55
58 void PaintChildren(const ui::PaintContext& context) override { 56 void PaintChildren(const ui::PaintContext& context) override {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return ViewTargeterDelegate::TargetForRect(view, local_to_header); 99 return ViewTargeterDelegate::TargetForRect(view, local_to_header);
102 } 100 }
103 return ViewTargeterDelegate::TargetForRect(root, rect); 101 return ViewTargeterDelegate::TargetForRect(root, rect);
104 } 102 }
105 103
106 private: 104 private:
107 const int kSeparatorThickness = 1; 105 const int kSeparatorThickness = 1;
108 const SkColor kSeparatorColor = SkColorSetA(SK_ColorBLACK, 0x1F); 106 const SkColor kSeparatorColor = SkColorSetA(SK_ColorBLACK, 0x1F);
109 const int kShadowOffsetY = 2; 107 const int kShadowOffsetY = 2;
110 const int kShadowBlur = 2; 108 const int kShadowBlur = 2;
111 const int kContentsVerticalSpacingMd = 4;
112 // TODO(fukino): Remove this constant once we stop maintaining pre-MD design.
113 // crbug.com/614453.
114 const int kContentsBetweenChildSpacingNonMd = 1;
115 109
116 // A structure that keeps the original offset of each header between the 110 // A structure that keeps the original offset of each header between the
117 // calls to Layout() to allow keeping track of which view should be sticky. 111 // calls to Layout() to allow keeping track of which view should be sticky.
118 struct Header { 112 struct Header {
119 explicit Header(views::View* view) 113 explicit Header(views::View* view)
120 : view(view), natural_offset(view->y()) {} 114 : view(view), natural_offset(view->y()) {}
121 115
122 // A header View that can be decorated as sticky. 116 // A header View that can be decorated as sticky.
123 views::View* view; 117 views::View* view;
124 118
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 if (index < child_count() - 1 && child_at(index + 1) != title_row_) 456 if (index < child_count() - 1 && child_at(index + 1) != title_row_)
463 scroll_border_->set_visible(true); 457 scroll_border_->set_visible(true);
464 else 458 else
465 scroll_border_->set_visible(false); 459 scroll_border_->set_visible(false);
466 } 460 }
467 461
468 views::View::OnPaintBorder(canvas); 462 views::View::OnPaintBorder(canvas);
469 } 463 }
470 464
471 } // namespace ash 465 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698