| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 updateChildrenIfNecessary(); | 140 updateChildrenIfNecessary(); |
| 141 | 141 |
| 142 AXObjectCacheImpl& cache = axObjectCache(); | 142 AXObjectCacheImpl& cache = axObjectCache(); |
| 143 if (m_activeIndex != optionIndex && m_activeIndex >= 0 && m_activeIndex < st
atic_cast<int>(m_children.size())) { | 143 if (m_activeIndex != optionIndex && m_activeIndex >= 0 && m_activeIndex < st
atic_cast<int>(m_children.size())) { |
| 144 AXObject* previousChild = m_children[m_activeIndex].get(); | 144 AXObject* previousChild = m_children[m_activeIndex].get(); |
| 145 cache.postNotification(previousChild, AXObjectCacheImpl::AXMenuListItemU
nselected); | 145 cache.postNotification(previousChild, AXObjectCacheImpl::AXMenuListItemU
nselected); |
| 146 } | 146 } |
| 147 | 147 |
| 148 if (optionIndex >= 0 && optionIndex < static_cast<int>(m_children.size())) { | 148 if (optionIndex >= 0 && optionIndex < static_cast<int>(m_children.size())) { |
| 149 AXObject* child = m_children[optionIndex].get(); | 149 AXObject* child = m_children[optionIndex].get(); |
| 150 cache.postNotification(child, AXObjectCacheImpl::AXFocusedUIElementChang
ed); | 150 cache.postNotification(this, AXObjectCacheImpl::AXActiveDescendantChange
d); |
| 151 cache.postNotification(child, AXObjectCacheImpl::AXMenuListItemSelected)
; | 151 cache.postNotification(child, AXObjectCacheImpl::AXMenuListItemSelected)
; |
| 152 } | 152 } |
| 153 | 153 |
| 154 m_activeIndex = optionIndex; | 154 m_activeIndex = optionIndex; |
| 155 } | 155 } |
| 156 | 156 |
| 157 void AXMenuListPopup::didHide() | 157 void AXMenuListPopup::didHide() |
| 158 { | 158 { |
| 159 AXObjectCacheImpl& cache = axObjectCache(); | 159 AXObjectCacheImpl& cache = axObjectCache(); |
| 160 cache.postNotification(this, AXObjectCacheImpl::AXHide); | 160 cache.postNotification(this, AXObjectCacheImpl::AXHide); |
| 161 if (activeChild()) | 161 if (activeDescendant()) |
| 162 cache.postNotification(activeChild(), AXObjectCacheImpl::AXMenuListItemU
nselected); | 162 cache.postNotification(activeDescendant(), AXObjectCacheImpl::AXMenuList
ItemUnselected); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void AXMenuListPopup::didShow() | 165 void AXMenuListPopup::didShow() |
| 166 { | 166 { |
| 167 if (!m_haveChildren) | 167 if (!m_haveChildren) |
| 168 addChildren(); | 168 addChildren(); |
| 169 | 169 |
| 170 AXObjectCacheImpl& cache = axObjectCache(); | 170 AXObjectCacheImpl& cache = axObjectCache(); |
| 171 cache.postNotification(this, AXObjectCacheImpl::AXShow); | 171 cache.postNotification(this, AXObjectCacheImpl::AXShow); |
| 172 int selectedIndex = getSelectedIndex(); | 172 int selectedIndex = getSelectedIndex(); |
| 173 if (selectedIndex >= 0 && selectedIndex < static_cast<int>(m_children.size()
)) | 173 if (selectedIndex >= 0 && selectedIndex < static_cast<int>(m_children.size()
)) |
| 174 didUpdateActiveOption(selectedIndex); | 174 didUpdateActiveOption(selectedIndex); |
| 175 else | 175 else |
| 176 cache.postNotification(m_parent, AXObjectCacheImpl::AXFocusedUIElementCh
anged); | 176 cache.postNotification(m_parent, AXObjectCacheImpl::AXFocusedUIElementCh
anged); |
| 177 } | 177 } |
| 178 | 178 |
| 179 AXObject* AXMenuListPopup::activeChild() | 179 AXObject* AXMenuListPopup::activeDescendant() |
| 180 { | 180 { |
| 181 if (m_activeIndex < 0 || m_activeIndex >= static_cast<int>(children().size()
)) | 181 if (m_activeIndex < 0 || m_activeIndex >= static_cast<int>(children().size()
)) |
| 182 return nullptr; | 182 return nullptr; |
| 183 | 183 |
| 184 return m_children[m_activeIndex].get(); | 184 return m_children[m_activeIndex].get(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |