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

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

Issue 2694903010: AX checked state changes (Closed)
Patch Set: Test checkbox attribute in automation API, fix whitespace, remove change to third party code 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/toggle_button.h" 5 #include "ui/views/controls/button/toggle_button.h"
6 6
7 #include "cc/paint/paint_flags.h" 7 #include "cc/paint/paint_flags.h"
8 #include "third_party/skia/include/core/SkDrawLooper.h" 8 #include "third_party/skia/include/core/SkDrawLooper.h"
9 #include "ui/accessibility/ax_node_data.h" 9 #include "ui/accessibility/ax_node_data.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 227
228 void ToggleButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 228 void ToggleButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
229 SchedulePaint(); 229 SchedulePaint();
230 } 230 }
231 231
232 void ToggleButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { 232 void ToggleButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
233 CustomButton::GetAccessibleNodeData(node_data); 233 CustomButton::GetAccessibleNodeData(node_data);
234 234
235 node_data->role = ui::AX_ROLE_SWITCH; 235 node_data->role = ui::AX_ROLE_SWITCH;
236 if (is_on_) 236 const int checkedState =
dmazzoni 2017/03/09 19:33:41 checked_state
aleventhal 2017/03/09 21:40:49 Done.
237 node_data->AddStateFlag(ui::AX_STATE_CHECKED); 237 is_on_ ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE;
238 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checkedState);
238 } 239 }
239 240
240 void ToggleButton::NotifyClick(const ui::Event& event) { 241 void ToggleButton::NotifyClick(const ui::Event& event) {
241 SetIsOn(!is_on(), true); 242 SetIsOn(!is_on(), true);
242 CustomButton::NotifyClick(event); 243 CustomButton::NotifyClick(event);
243 } 244 }
244 245
245 void ToggleButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { 246 void ToggleButton::AddInkDropLayer(ui::Layer* ink_drop_layer) {
246 thumb_view_->AddInkDropLayer(ink_drop_layer); 247 thumb_view_->AddInkDropLayer(ink_drop_layer);
247 } 248 }
(...skipping 24 matching lines...) Expand all
272 // TODO(varkha, estade): The thumb is using its own view. Investigate if 273 // TODO(varkha, estade): The thumb is using its own view. Investigate if
273 // repainting in every animation step to update colors could be avoided. 274 // repainting in every animation step to update colors could be avoided.
274 UpdateThumb(); 275 UpdateThumb();
275 SchedulePaint(); 276 SchedulePaint();
276 return; 277 return;
277 } 278 }
278 CustomButton::AnimationProgressed(animation); 279 CustomButton::AnimationProgressed(animation);
279 } 280 }
280 281
281 } // namespace views 282 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698