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

Side by Side Diff: ui/views/controls/table/table_header.cc

Issue 2689273002: Fix appearance of header row separators in table view at fractional (Closed)
Patch Set: pkasting review Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/canvas.cc ('k') | 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 "ui/views/controls/table/table_header.h" 5 #include "ui/views/controls/table/table_header.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/paint/paint_flags.h" 9 #include "cc/paint/paint_flags.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ui::NativeTheme* theme = GetNativeTheme(); 60 ui::NativeTheme* theme = GetNativeTheme();
61 const SkColor text_color = 61 const SkColor text_color =
62 theme->GetSystemColor(ui::NativeTheme::kColorId_TableHeaderText); 62 theme->GetSystemColor(ui::NativeTheme::kColorId_TableHeaderText);
63 const SkColor separator_color = 63 const SkColor separator_color =
64 theme->GetSystemColor(ui::NativeTheme::kColorId_TableHeaderSeparator); 64 theme->GetSystemColor(ui::NativeTheme::kColorId_TableHeaderSeparator);
65 // Paint the background and a separator at the bottom. The separator color 65 // Paint the background and a separator at the bottom. The separator color
66 // matches that of the border around the scrollview. 66 // matches that of the border around the scrollview.
67 OnPaintBackground(canvas); 67 OnPaintBackground(canvas);
68 SkColor border_color = 68 SkColor border_color =
69 theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor); 69 theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor);
70 canvas->DrawLine(gfx::Point(0, height() - 1), 70 canvas->DrawSharpLine(gfx::PointF(0, height() - 1),
71 gfx::Point(width(), height() - 1), border_color); 71 gfx::PointF(width(), height() - 1), border_color);
72 72
73 const Columns& columns = table_->visible_columns(); 73 const Columns& columns = table_->visible_columns();
74 const int sorted_column_id = table_->sort_descriptors().empty() ? -1 : 74 const int sorted_column_id = table_->sort_descriptors().empty() ? -1 :
75 table_->sort_descriptors()[0].column_id; 75 table_->sort_descriptors()[0].column_id;
76 for (size_t i = 0; i < columns.size(); ++i) { 76 for (size_t i = 0; i < columns.size(); ++i) {
77 if (columns[i].width >= 2) { 77 if (columns[i].width >= 2) {
78 const int separator_x = GetMirroredXInView( 78 const int separator_x = GetMirroredXInView(
79 columns[i].x + columns[i].width - 1); 79 columns[i].x + columns[i].width - 1);
80 canvas->DrawLine(gfx::Point(separator_x, kSeparatorPadding), 80 canvas->DrawSharpLine(
81 gfx::Point(separator_x, height() - kSeparatorPadding), 81 gfx::PointF(separator_x, kSeparatorPadding),
82 separator_color); 82 gfx::PointF(separator_x, height() - kSeparatorPadding),
83 separator_color);
83 } 84 }
84 85
85 const int x = columns[i].x + kHorizontalPadding; 86 const int x = columns[i].x + kHorizontalPadding;
86 int width = columns[i].width - kHorizontalPadding - kHorizontalPadding; 87 int width = columns[i].width - kHorizontalPadding - kHorizontalPadding;
87 if (width <= 0) 88 if (width <= 0)
88 continue; 89 continue;
89 90
90 const int title_width = 91 const int title_width =
91 gfx::GetStringWidth(columns[i].column.title, font_list_); 92 gfx::GetStringWidth(columns[i].column.title, font_list_);
92 const bool paint_sort_indicator = 93 const bool paint_sort_indicator =
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 if (index > 0 && x >= column.x - kResizePadding && 281 if (index > 0 && x >= column.x - kResizePadding &&
281 x <= column.x + kResizePadding) { 282 x <= column.x + kResizePadding) {
282 return index - 1; 283 return index - 1;
283 } 284 }
284 const int max_x = column.x + column.width; 285 const int max_x = column.x + column.width;
285 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ? 286 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ?
286 index : -1; 287 index : -1;
287 } 288 }
288 289
289 } // namespace views 290 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/canvas.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698