OLD | NEW |
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/focusable_border.h" | 5 #include "ui/views/controls/focusable_border.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkPaint.h" | 7 #include "third_party/skia/include/core/SkPaint.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
11 #include "ui/gfx/color_palette.h" | 11 #include "ui/gfx/color_palette.h" |
| 12 #include "ui/gfx/color_utils.h" |
12 #include "ui/gfx/geometry/insets.h" | 13 #include "ui/gfx/geometry/insets.h" |
13 #include "ui/gfx/scoped_canvas.h" | 14 #include "ui/gfx/scoped_canvas.h" |
14 #include "ui/gfx/skia_util.h" | 15 #include "ui/gfx/skia_util.h" |
15 #include "ui/native_theme/native_theme.h" | 16 #include "ui/native_theme/native_theme.h" |
16 #include "ui/views/controls/textfield/textfield.h" | 17 #include "ui/views/controls/textfield/textfield.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 const int kInsetSize = 1; | 21 const int kInsetSize = 1; |
21 | 22 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return gfx::Size(); | 79 return gfx::Size(); |
79 } | 80 } |
80 | 81 |
81 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) { | 82 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) { |
82 insets_.Set(top, left, bottom, right); | 83 insets_.Set(top, left, bottom, right); |
83 } | 84 } |
84 | 85 |
85 SkColor FocusableBorder::GetCurrentColor(const View& view) const { | 86 SkColor FocusableBorder::GetCurrentColor(const View& view) const { |
86 if (!use_default_color_) | 87 if (!use_default_color_) |
87 return override_color_; | 88 return override_color_; |
88 return view.GetNativeTheme()->GetSystemColor( | 89 SkColor color = view.GetNativeTheme()->GetSystemColor( |
89 view.HasFocus() ? ui::NativeTheme::kColorId_FocusedBorderColor : | 90 view.HasFocus() ? ui::NativeTheme::kColorId_FocusedBorderColor : |
90 ui::NativeTheme::kColorId_UnfocusedBorderColor); | 91 ui::NativeTheme::kColorId_UnfocusedBorderColor); |
| 92 if (ui::MaterialDesignController::IsSecondaryUiMaterial() && !view.enabled()) |
| 93 color = color_utils::BlendTowardOppositeLuma(color, 0x61); |
| 94 return color; |
91 } | 95 } |
92 | 96 |
93 } // namespace views | 97 } // namespace views |
OLD | NEW |