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

Side by Side Diff: ui/views/controls/focusable_border.cc

Issue 2395033002: Harmony - Don't paint focus ring on unless border requests it. (Closed)
Patch Set: Created 4 years, 2 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
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/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"
(...skipping 24 matching lines...) Expand all
35 35
36 void FocusableBorder::SetColor(SkColor color) { 36 void FocusableBorder::SetColor(SkColor color) {
37 override_color_ = color; 37 override_color_ = color;
38 use_default_color_ = false; 38 use_default_color_ = false;
39 } 39 }
40 40
41 void FocusableBorder::UseDefaultColor() { 41 void FocusableBorder::UseDefaultColor() {
42 use_default_color_ = true; 42 use_default_color_ = true;
43 } 43 }
44 44
45 bool FocusableBorder::ShouldAddFocusRing() const {
46 return true;
47 }
48
45 void FocusableBorder::Paint(const View& view, gfx::Canvas* canvas) { 49 void FocusableBorder::Paint(const View& view, gfx::Canvas* canvas) {
46 // In harmony, the focus indicator is a FocusRing. 50 // In harmony, the focus indicator is a FocusRing.
47 if (ui::MaterialDesignController::IsSecondaryUiMaterial() && view.HasFocus()) 51 if (ui::MaterialDesignController::IsSecondaryUiMaterial() && view.HasFocus())
48 return; 52 return;
49 53
50 SkPaint paint; 54 SkPaint paint;
51 paint.setStyle(SkPaint::kStroke_Style); 55 paint.setStyle(SkPaint::kStroke_Style);
52 paint.setColor(GetCurrentColor(view)); 56 paint.setColor(GetCurrentColor(view));
53 57
54 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { 58 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (ui::MaterialDesignController::IsSecondaryUiMaterial() && 100 if (ui::MaterialDesignController::IsSecondaryUiMaterial() &&
97 !view.enabled()) { 101 !view.enabled()) {
98 return color_utils::BlendTowardOppositeLuma(color, 102 return color_utils::BlendTowardOppositeLuma(color,
99 gfx::kDisabledControlAlpha); 103 gfx::kDisabledControlAlpha);
100 } 104 }
101 105
102 return color; 106 return color;
103 } 107 }
104 108
105 } // namespace views 109 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698