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

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

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: Fixed Mac compilation issue. 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 /* 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 AccessibilityRole AXListBox::determineAccessibilityRole() 57 AccessibilityRole AXListBox::determineAccessibilityRole()
58 { 58 {
59 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) 59 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
60 return m_ariaRole; 60 return m_ariaRole;
61 61
62 return ListBoxRole; 62 return ListBoxRole;
63 } 63 }
64 64
65 AXObject* AXListBox::activeDescendant() const 65 AXObject* AXListBox::activeDescendant()
66 { 66 {
67 if (!isHTMLSelectElement(getNode())) 67 if (!isHTMLSelectElement(getNode()))
68 return nullptr; 68 return nullptr;
69 69
70 HTMLSelectElement* select = toHTMLSelectElement(getNode()); 70 HTMLSelectElement* select = toHTMLSelectElement(getNode());
71 int activeIndex = select->activeSelectionEndListIndex(); 71 int activeIndex = select->activeSelectionEndListIndex();
72 if (activeIndex >= 0 && activeIndex < static_cast<int>(select->length())) { 72 if (activeIndex >= 0 && activeIndex < static_cast<int>(select->length())) {
73 HTMLOptionElement* option = select->item(m_activeIndex); 73 HTMLOptionElement* option = select->item(m_activeIndex);
74 return axObjectCache().get(option); 74 return axObjectCache().get(option);
75 } 75 }
76 76
77 return nullptr; 77 return nullptr;
78 } 78 }
79 79
80 void AXListBox::activeIndexChanged() 80 void AXListBox::activeIndexChanged()
81 { 81 {
82 if (!isHTMLSelectElement(getNode())) 82 if (!isHTMLSelectElement(getNode()))
83 return; 83 return;
84 84
85 HTMLSelectElement* select = toHTMLSelectElement(getNode()); 85 HTMLSelectElement* select = toHTMLSelectElement(getNode());
86 int activeIndex = select->activeSelectionEndListIndex(); 86 int activeIndex = select->activeSelectionEndListIndex();
87 if (activeIndex == m_activeIndex) 87 if (activeIndex == m_activeIndex)
88 return; 88 return;
89 89
90 m_activeIndex = activeIndex; 90 m_activeIndex = activeIndex;
91 if (!select->focused()) 91 if (!select->focused())
92 return; 92 return;
93 93
94 if (m_activeIndex >= 0 && m_activeIndex < static_cast<int>(select->length()) ) { 94 axObjectCache().postNotification(this, AXObjectCacheImpl::AXActiveDescendant Changed);
95 HTMLOptionElement* option = select->item(m_activeIndex);
96 axObjectCache().postNotification(option, AXObjectCacheImpl::AXFocusedUIE lementChanged);
97 } else {
98 axObjectCache().postNotification(this, AXObjectCacheImpl::AXFocusedUIEle mentChanged);
99 }
100 } 95 }
101 96
102 } // namespace blink 97 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698