Chromium Code Reviews| Index: ui/views/controls/button/image_button.cc |
| diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc |
| index a9fda37f5b49ed642fbf086df347f75870b83ff8..483d971bbea836c6fceacbee82433f7dcf3704a6 100644 |
| --- a/ui/views/controls/button/image_button.cc |
| +++ b/ui/views/controls/button/image_button.cc |
| @@ -215,7 +215,7 @@ void ToggleImageButton::SetToggled(bool toggled) { |
| toggled_ = toggled; |
| SchedulePaint(); |
| - NotifyAccessibilityEvent(ui::AX_EVENT_VALUE_CHANGED, true); |
| + NotifyAccessibilityEvent(ui::AX_EVENT_ARIA_ATTRIBUTE_CHANGED, true); |
| } |
| void ToggleImageButton::SetToggledImage(ButtonState image_state, |
| @@ -270,6 +270,15 @@ bool ToggleImageButton::GetTooltipText(const gfx::Point& p, |
| void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { |
| ImageButton::GetAccessibleState(state); |
| GetTooltipText(gfx::Point(), &state->name); |
| + |
| + // Use the visual pressed image as a cue for making this control into an |
|
dmazzoni
2016/07/22 18:06:29
wrap? looks like more than 80 chars in Rietveld
David Tseng
2016/07/22 22:49:26
Hmm...strange, it's 73 characters.
|
| + // accessible toggle button. |
| + if ((toggled_ && !images_[ButtonState::STATE_NORMAL].isNull()) || |
| + (!toggled_ && !alternate_images_[ButtonState::STATE_NORMAL].isNull())) { |
| + state->role = ui::AX_ROLE_TOGGLE_BUTTON; |
| + if (toggled_) |
| + state->AddStateFlag(ui::AX_STATE_PRESSED); |
| + } |
| } |
| } // namespace views |