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

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

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Delete AXNodeData::Init() and clear bitfields in AXNodeData() instead. Created 3 years, 7 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/button/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/accessibility/ax_node_data.h" 7 #include "ui/accessibility/ax_node_data.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // (since disabled buttons may still be able to be dragged). 349 // (since disabled buttons may still be able to be dragged).
350 if (state_ != STATE_DISABLED) 350 if (state_ != STATE_DISABLED)
351 SetState(STATE_NORMAL); 351 SetState(STATE_NORMAL);
352 AnimateInkDrop(InkDropState::HIDDEN, nullptr /* event */); 352 AnimateInkDrop(InkDropState::HIDDEN, nullptr /* event */);
353 } 353 }
354 354
355 void CustomButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { 355 void CustomButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
356 Button::GetAccessibleNodeData(node_data); 356 Button::GetAccessibleNodeData(node_data);
357 switch (state_) { 357 switch (state_) {
358 case STATE_HOVERED: 358 case STATE_HOVERED:
359 node_data->AddStateFlag(ui::AX_STATE_HOVERED); 359 node_data->AddState(ui::AX_STATE_HOVERED);
360 break; 360 break;
361 case STATE_PRESSED: 361 case STATE_PRESSED:
362 node_data->AddStateFlag(ui::AX_STATE_PRESSED); 362 node_data->AddState(ui::AX_STATE_PRESSED);
363 break; 363 break;
364 case STATE_DISABLED: 364 case STATE_DISABLED:
365 node_data->AddStateFlag(ui::AX_STATE_DISABLED); 365 node_data->AddState(ui::AX_STATE_DISABLED);
366 break; 366 break;
367 case STATE_NORMAL: 367 case STATE_NORMAL:
368 case STATE_COUNT: 368 case STATE_COUNT:
369 // No additional accessibility node_data set for this button node_data. 369 // No additional accessibility node_data set for this button node_data.
370 break; 370 break;
371 } 371 }
372 if (enabled()) { 372 if (enabled()) {
373 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, 373 node_data->AddIntAttribute(ui::AX_ATTR_ACTION,
374 ui::AX_SUPPORTED_ACTION_PRESS); 374 ui::AX_SUPPORTED_ACTION_PRESS);
375 } 375 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 views::InkDropState::ACTION_PENDING || 491 views::InkDropState::ACTION_PENDING ||
492 GetInkDrop()->GetTargetInkDropState() == 492 GetInkDrop()->GetTargetInkDropState() ==
493 views::InkDropState::ALTERNATE_ACTION_PENDING) { 493 views::InkDropState::ALTERNATE_ACTION_PENDING) {
494 AnimateInkDrop(views::InkDropState::HIDDEN, 494 AnimateInkDrop(views::InkDropState::HIDDEN,
495 ui::LocatedEvent::FromIfValid(&event)); 495 ui::LocatedEvent::FromIfValid(&event));
496 } 496 }
497 Button::OnClickCanceled(event); 497 Button::OnClickCanceled(event);
498 } 498 }
499 499
500 } // namespace views 500 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698