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

Unified Diff: ui/app_list/views/search_result_separator.cc

Issue 2949413002: Show separator in SearchResultTileItemListView (Closed)
Patch Set: Created 3 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: ui/app_list/views/search_result_separator.cc
diff --git a/ui/app_list/views/search_result_separator.cc b/ui/app_list/views/search_result_separator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..97a4df2d609fa09169fb0919578926de9a015b87
--- /dev/null
+++ b/ui/app_list/views/search_result_separator.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/app_list/views/search_result_separator.h"
+
+#include "ui/gfx/canvas.h"
+#include "ui/views/border.h"
+
+namespace {
+
+constexpr int kSeparatorLeftRightPadding = 4;
+constexpr int kSeparatorHeight = 36;
+constexpr SkColor kSeparatorColor = SkColorSetARGBMacro(0x1F, 0x00, 0x00, 0x00);
+
+} // namespace
+
+namespace app_list {
+
+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
+ SetBorder(views::CreateEmptyBorder(0, kSeparatorLeftRightPadding, 0,
+ kSeparatorLeftRightPadding));
+}
+
+SearchResultSeparator::~SearchResultSeparator() {}
+
+void SearchResultSeparator::OnPaint(gfx::Canvas* canvas) {
+ gfx::Rect contents_bound = GetContentsBounds();
+ contents_bound.set_height(kSeparatorHeight);
+
+ float dsf = canvas->UndoDeviceScaleFactor();
+ gfx::RectF contents = gfx::ScaleRect(gfx::RectF(contents_bound), dsf);
+ canvas->FillRect(gfx::ToEnclosedRect(contents), kSeparatorColor);
+
+ View::OnPaint(canvas);
+}
+
+} // namespace app_list

Powered by Google App Engine
This is Rietveld 408576698