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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXListBox.cpp

Issue 2024053003: Revert of 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: Created 4 years, 6 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 AccessibilityRole AXListBox::determineAccessibilityRole() 56 AccessibilityRole AXListBox::determineAccessibilityRole()
57 { 57 {
58 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) 58 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
59 return m_ariaRole; 59 return m_ariaRole;
60 60
61 return ListBoxRole; 61 return ListBoxRole;
62 } 62 }
63 63
64 AXObject* AXListBox::activeDescendant() 64 AXObject* AXListBox::activeDescendant() const
65 { 65 {
66 if (!isHTMLSelectElement(getNode())) 66 if (!isHTMLSelectElement(getNode()))
67 return nullptr; 67 return nullptr;
68 68
69 HTMLSelectElement* select = toHTMLSelectElement(getNode()); 69 HTMLSelectElement* select = toHTMLSelectElement(getNode());
70 int activeIndex = select->activeSelectionEndListIndex(); 70 int activeIndex = select->activeSelectionEndListIndex();
71 if (activeIndex >= 0 && activeIndex < static_cast<int>(select->length())) { 71 if (activeIndex >= 0 && activeIndex < static_cast<int>(select->length())) {
72 HTMLOptionElement* option = select->item(m_activeIndex); 72 HTMLOptionElement* option = select->item(m_activeIndex);
73 return axObjectCache().get(option); 73 return axObjectCache().get(option);
74 } 74 }
75 75
76 return nullptr; 76 return nullptr;
77 } 77 }
78 78
79 void AXListBox::activeIndexChanged() 79 void AXListBox::activeIndexChanged()
80 { 80 {
81 if (!isHTMLSelectElement(getNode())) 81 if (!isHTMLSelectElement(getNode()))
82 return; 82 return;
83 83
84 HTMLSelectElement* select = toHTMLSelectElement(getNode()); 84 HTMLSelectElement* select = toHTMLSelectElement(getNode());
85 int activeIndex = select->activeSelectionEndListIndex(); 85 int activeIndex = select->activeSelectionEndListIndex();
86 if (activeIndex == m_activeIndex) 86 if (activeIndex == m_activeIndex)
87 return; 87 return;
88 88
89 m_activeIndex = activeIndex; 89 m_activeIndex = activeIndex;
90 if (!select->focused()) 90 if (!select->focused())
91 return; 91 return;
92 92
93 axObjectCache().postNotification(this, AXObjectCacheImpl::AXActiveDescendant Changed); 93 if (m_activeIndex >= 0 && m_activeIndex < static_cast<int>(select->length()) ) {
94 HTMLOptionElement* option = select->item(m_activeIndex);
95 axObjectCache().postNotification(option, AXObjectCacheImpl::AXFocusedUIE lementChanged);
96 } else {
97 axObjectCache().postNotification(this, AXObjectCacheImpl::AXFocusedUIEle mentChanged);
98 }
94 } 99 }
95 100
96 } // namespace blink 101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698