Chromium Code Reviews| Index: ui/views/controls/table/table_header.cc |
| diff --git a/ui/views/controls/table/table_header.cc b/ui/views/controls/table/table_header.cc |
| index 073611d89b97a322f4e6eff82b76690bba72814f..ade8fc752b4b23758a88fb2dc9bb63df4ad957f1 100644 |
| --- a/ui/views/controls/table/table_header.cc |
| +++ b/ui/views/controls/table/table_header.cc |
| @@ -33,11 +33,6 @@ const int kResizePadding = 5; |
| // Amount of space above/below the separator. |
| const int kSeparatorPadding = 4; |
| -const SkColor kTextColor = SK_ColorBLACK; |
| -const SkColor kBackgroundColor1 = SkColorSetRGB(0xF9, 0xF9, 0xF9); |
| -const SkColor kBackgroundColor2 = SkColorSetRGB(0xE8, 0xE8, 0xE8); |
| -const SkColor kSeparatorColor = SkColorSetRGB(0xAA, 0xAA, 0xAA); |
| - |
| // Size of the sort indicator (doesn't include padding). |
| const int kSortIndicatorSize = 8; |
| @@ -53,10 +48,7 @@ const int TableHeader::kSortIndicatorWidth = kSortIndicatorSize + |
| typedef std::vector<TableView::VisibleColumn> Columns; |
| -TableHeader::TableHeader(TableView* table) : table_(table) { |
| - set_background(Background::CreateVerticalGradientBackground( |
| - kBackgroundColor1, kBackgroundColor2)); |
| -} |
| +TableHeader::TableHeader(TableView* table) : table_(table) {} |
| TableHeader::~TableHeader() { |
| } |
| @@ -66,11 +58,18 @@ void TableHeader::Layout() { |
| } |
| void TableHeader::OnPaint(gfx::Canvas* canvas) { |
| + auto* theme = GetNativeTheme(); |
|
Elliot Glaysher
2017/01/18 00:01:55
ui::NativeTheme is short enough that you should pr
Tom (Use chromium acct)
2017/01/18 23:55:27
Done.
|
| + set_background(Background::CreateSolidBackground( |
|
sky
2017/01/18 16:21:16
Why do you need to set the background on every pai
Tom (Use chromium acct)
2017/01/18 23:55:27
Done.
|
| + theme->GetSystemColor(ui::NativeTheme::kColorId_TableHeaderBackground))); |
| + const SkColor text_color = |
| + theme->GetSystemColor(ui::NativeTheme::kColorId_TableHeaderText); |
| + const SkColor separator_color = |
| + theme->GetSystemColor(ui::NativeTheme::kColorId_TableHeaderSeparator); |
| // Paint the background and a separator at the bottom. The separator color |
| // matches that of the border around the scrollview. |
| OnPaintBackground(canvas); |
| - SkColor border_color = GetNativeTheme()->GetSystemColor( |
| - ui::NativeTheme::kColorId_UnfocusedBorderColor); |
| + SkColor border_color = |
| + theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor); |
| canvas->DrawLine(gfx::Point(0, height() - 1), |
| gfx::Point(width(), height() - 1), border_color); |
| @@ -83,7 +82,7 @@ void TableHeader::OnPaint(gfx::Canvas* canvas) { |
| columns[i].x + columns[i].width - 1); |
| canvas->DrawLine(gfx::Point(separator_x, kSeparatorPadding), |
| gfx::Point(separator_x, height() - kSeparatorPadding), |
| - kSeparatorColor); |
| + separator_color); |
| } |
| const int x = columns[i].x + kHorizontalPadding; |
| @@ -103,14 +102,14 @@ void TableHeader::OnPaint(gfx::Canvas* canvas) { |
| } |
| canvas->DrawStringRectWithFlags( |
| - columns[i].column.title, font_list_, kTextColor, |
| + columns[i].column.title, font_list_, text_color, |
| gfx::Rect(GetMirroredXWithWidthInView(x, width), kVerticalPadding, |
| width, height() - kVerticalPadding * 2), |
| TableColumnAlignmentToCanvasAlignment(columns[i].column.alignment)); |
| if (paint_sort_indicator) { |
| SkPaint paint; |
| - paint.setColor(kTextColor); |
| + paint.setColor(text_color); |
| paint.setStyle(SkPaint::kFill_Style); |
| paint.setAntiAlias(true); |