OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/app_list/views/search_result_separator.h" | |
6 | |
7 #include "ui/gfx/canvas.h" | |
8 #include "ui/views/border.h" | |
9 | |
10 namespace { | |
11 | |
12 constexpr int kSeparatorLeftRightPadding = 4; | |
13 constexpr int kSeparatorHeight = 36; | |
14 constexpr SkColor kSeparatorColor = SkColorSetARGBMacro(0x1F, 0x00, 0x00, 0x00); | |
15 | |
16 } // namespace | |
17 | |
18 namespace app_list { | |
19 | |
20 SearchResultSeparator::SearchResultSeparator() { | |
xiyuan
2017/06/23 15:43:09
This class seems unnecessary. Can we achieve the s
weidongg
2017/06/23 18:32:20
Using Separator::SetPreferredHeight to set height
xiyuan
2017/06/23 20:09:01
Preferred height is just preferred and parent can
| |
21 SetBorder(views::CreateEmptyBorder(0, kSeparatorLeftRightPadding, 0, | |
22 kSeparatorLeftRightPadding)); | |
23 } | |
24 | |
25 SearchResultSeparator::~SearchResultSeparator() {} | |
26 | |
27 void SearchResultSeparator::OnPaint(gfx::Canvas* canvas) { | |
28 gfx::Rect contents_bound = GetContentsBounds(); | |
29 contents_bound.set_height(kSeparatorHeight); | |
30 | |
31 float dsf = canvas->UndoDeviceScaleFactor(); | |
32 gfx::RectF contents = gfx::ScaleRect(gfx::RectF(contents_bound), dsf); | |
33 canvas->FillRect(gfx::ToEnclosedRect(contents), kSeparatorColor); | |
34 | |
35 View::OnPaint(canvas); | |
36 } | |
37 | |
38 } // namespace app_list | |
OLD | NEW |