OLD | NEW |
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 "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
6 | 6 |
7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 3586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 // Fire an event if the name, description, help, or value changes. | 3597 // Fire an event if the name, description, help, or value changes. |
3598 if (name() != old_win_attributes_->name) | 3598 if (name() != old_win_attributes_->name) |
3599 FireNativeEvent(EVENT_OBJECT_NAMECHANGE); | 3599 FireNativeEvent(EVENT_OBJECT_NAMECHANGE); |
3600 if (description() != old_win_attributes_->description) | 3600 if (description() != old_win_attributes_->description) |
3601 FireNativeEvent(EVENT_OBJECT_DESCRIPTIONCHANGE); | 3601 FireNativeEvent(EVENT_OBJECT_DESCRIPTIONCHANGE); |
3602 if (value() != old_win_attributes_->value) | 3602 if (value() != old_win_attributes_->value) |
3603 FireNativeEvent(EVENT_OBJECT_VALUECHANGE); | 3603 FireNativeEvent(EVENT_OBJECT_VALUECHANGE); |
3604 if (ia_state() != old_win_attributes_->ia_state) | 3604 if (ia_state() != old_win_attributes_->ia_state) |
3605 FireNativeEvent(EVENT_OBJECT_STATECHANGE); | 3605 FireNativeEvent(EVENT_OBJECT_STATECHANGE); |
3606 | 3606 |
3607 // Normally focus events are handled elsewhere, however | |
3608 // focus for managed descendants is platform-specific. | |
3609 // Fire a focus event if the focused descendant in a multi-select | |
3610 // list box changes. | |
3611 if (GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && | |
3612 (ia_state() & STATE_SYSTEM_FOCUSABLE) && | |
3613 (ia_state() & STATE_SYSTEM_SELECTABLE) && | |
3614 (ia_state() & STATE_SYSTEM_FOCUSED) && | |
3615 !(old_win_attributes_->ia_state & STATE_SYSTEM_FOCUSED)) { | |
3616 FireNativeEvent(EVENT_OBJECT_FOCUS); | |
3617 } | |
3618 | |
3619 // Handle selection being added or removed. | 3607 // Handle selection being added or removed. |
3620 bool is_selected_now = (ia_state() & STATE_SYSTEM_SELECTED) != 0; | 3608 bool is_selected_now = (ia_state() & STATE_SYSTEM_SELECTED) != 0; |
3621 bool was_selected_before = | 3609 bool was_selected_before = |
3622 (old_win_attributes_->ia_state & STATE_SYSTEM_SELECTED) != 0; | 3610 (old_win_attributes_->ia_state & STATE_SYSTEM_SELECTED) != 0; |
3623 if (is_selected_now || was_selected_before) { | 3611 if (is_selected_now || was_selected_before) { |
3624 bool multiselect = false; | 3612 bool multiselect = false; |
3625 if (GetParent() && GetParent()->HasState(ui::AX_STATE_MULTISELECTABLE)) | 3613 if (GetParent() && GetParent()->HasState(ui::AX_STATE_MULTISELECTABLE)) |
3626 multiselect = true; | 3614 multiselect = true; |
3627 | 3615 |
3628 if (multiselect) { | 3616 if (multiselect) { |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5098 return static_cast<BrowserAccessibilityWin*>(obj); | 5086 return static_cast<BrowserAccessibilityWin*>(obj); |
5099 } | 5087 } |
5100 | 5088 |
5101 const BrowserAccessibilityWin* | 5089 const BrowserAccessibilityWin* |
5102 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5090 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
5103 DCHECK(!obj || obj->IsNative()); | 5091 DCHECK(!obj || obj->IsNative()); |
5104 return static_cast<const BrowserAccessibilityWin*>(obj); | 5092 return static_cast<const BrowserAccessibilityWin*>(obj); |
5105 } | 5093 } |
5106 | 5094 |
5107 } // namespace content | 5095 } // namespace content |
OLD | NEW |