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

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 1899823002: Uses the activedescendant_changed event received from Blink to fire the right focus event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extraneous focus events. Created 4 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 "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 3501 matching lines...) Expand 10 before | Expand all | Expand 10 after
3512 // Fire an event if the name, description, help, or value changes. 3512 // Fire an event if the name, description, help, or value changes.
3513 if (name() != old_win_attributes_->name) 3513 if (name() != old_win_attributes_->name)
3514 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, this); 3514 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, this);
3515 if (description() != old_win_attributes_->description) 3515 if (description() != old_win_attributes_->description)
3516 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_DESCRIPTIONCHANGE, this); 3516 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_DESCRIPTIONCHANGE, this);
3517 if (value() != old_win_attributes_->value) 3517 if (value() != old_win_attributes_->value)
3518 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_VALUECHANGE, this); 3518 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_VALUECHANGE, this);
3519 if (ia_state() != old_win_attributes_->ia_state) 3519 if (ia_state() != old_win_attributes_->ia_state)
3520 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_STATECHANGE, this); 3520 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_STATECHANGE, this);
3521 3521
3522 // Normally focus events are handled elsewhere, however
dmazzoni 2016/04/26 20:24:24 Are you sure this isn't needed anymore? Do both NV
3523 // focus for managed descendants is platform-specific.
3524 // Fire a focus event if the focused descendant in a multi-select
3525 // list box changes.
3526 if (GetRole() == ui::AX_ROLE_LIST_BOX_OPTION &&
3527 (ia_state() & STATE_SYSTEM_FOCUSABLE) &&
3528 (ia_state() & STATE_SYSTEM_SELECTABLE) &&
3529 (ia_state() & STATE_SYSTEM_FOCUSED) &&
3530 !(old_win_attributes_->ia_state & STATE_SYSTEM_FOCUSED)) {
3531 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, this);
3532 }
3533
3534 // Handle selection being added or removed. 3522 // Handle selection being added or removed.
3535 bool is_selected_now = (ia_state() & STATE_SYSTEM_SELECTED) != 0; 3523 bool is_selected_now = (ia_state() & STATE_SYSTEM_SELECTED) != 0;
3536 bool was_selected_before = 3524 bool was_selected_before =
3537 (old_win_attributes_->ia_state & STATE_SYSTEM_SELECTED) != 0; 3525 (old_win_attributes_->ia_state & STATE_SYSTEM_SELECTED) != 0;
3538 if (is_selected_now || was_selected_before) { 3526 if (is_selected_now || was_selected_before) {
3539 bool multiselect = false; 3527 bool multiselect = false;
3540 if (GetParent() && GetParent()->HasState(ui::AX_STATE_MULTISELECTABLE)) 3528 if (GetParent() && GetParent()->HasState(ui::AX_STATE_MULTISELECTABLE))
3541 multiselect = true; 3529 multiselect = true;
3542 3530
3543 if (multiselect) { 3531 if (multiselect) {
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
4954 return static_cast<BrowserAccessibilityWin*>(obj); 4942 return static_cast<BrowserAccessibilityWin*>(obj);
4955 } 4943 }
4956 4944
4957 const BrowserAccessibilityWin* 4945 const BrowserAccessibilityWin*
4958 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { 4946 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) {
4959 DCHECK(!obj || obj->IsNative()); 4947 DCHECK(!obj || obj->IsNative());
4960 return static_cast<const BrowserAccessibilityWin*>(obj); 4948 return static_cast<const BrowserAccessibilityWin*>(obj);
4961 } 4949 }
4962 4950
4963 } // namespace content 4951 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698