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

Side by Side Diff: ui/views/controls/button/checkbox.cc

Issue 2734273002: Remove dashed focus rect from Views checkboxes. (Closed)
Patch Set: Created 3 years, 9 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/views/controls/button/checkbox.h ('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/button/checkbox.h" 5 #include "ui/views/controls/button/checkbox.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void Checkbox::SetChecked(bool checked) { 97 void Checkbox::SetChecked(bool checked) {
98 checked_ = checked; 98 checked_ = checked;
99 UpdateImage(); 99 UpdateImage();
100 } 100 }
101 101
102 // static 102 // static
103 bool Checkbox::UseMd() { 103 bool Checkbox::UseMd() {
104 return ui::MaterialDesignController::IsSecondaryUiMaterial(); 104 return ui::MaterialDesignController::IsSecondaryUiMaterial();
105 } 105 }
106 106
107 void Checkbox::Layout() {
108 LabelButton::Layout();
109
110 if (!UseMd()) {
111 // Construct a focus painter that only surrounds the label area.
112 gfx::Rect rect = label()->GetMirroredBounds();
113 rect.Inset(-2, 3);
114 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets(gfx::Insets(
tapted 2017/03/08 00:26:43 The LabelButton constructor still sets a FocusPain
Evan Stade 2017/03/08 00:38:17 yes!
115 rect.y(), rect.x(), height() - rect.bottom(), width() - rect.right())));
116 }
117 }
118
119 const char* Checkbox::GetClassName() const { 107 const char* Checkbox::GetClassName() const {
120 return kViewClassName; 108 return kViewClassName;
121 } 109 }
122 110
123 void Checkbox::GetAccessibleNodeData(ui::AXNodeData* node_data) { 111 void Checkbox::GetAccessibleNodeData(ui::AXNodeData* node_data) {
124 LabelButton::GetAccessibleNodeData(node_data); 112 LabelButton::GetAccessibleNodeData(node_data);
125 node_data->role = ui::AX_ROLE_CHECK_BOX; 113 node_data->role = ui::AX_ROLE_CHECK_BOX;
126 if (checked()) 114 if (checked())
127 node_data->AddStateFlag(ui::AX_STATE_CHECKED); 115 node_data->AddStateFlag(ui::AX_STATE_CHECKED);
128 if (enabled()) { 116 if (enabled()) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 ui::NativeTheme::Part Checkbox::GetThemePart() const { 220 ui::NativeTheme::Part Checkbox::GetThemePart() const {
233 return ui::NativeTheme::kCheckbox; 221 return ui::NativeTheme::kCheckbox;
234 } 222 }
235 223
236 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { 224 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const {
237 LabelButton::GetExtraParams(params); 225 LabelButton::GetExtraParams(params);
238 params->button.checked = checked_; 226 params->button.checked = checked_;
239 } 227 }
240 228
241 } // namespace views 229 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/checkbox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698