| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 117 } | 117 } | 
| 118 | 118 | 
| 119 void AXMenuListPopup::UpdateChildrenIfNecessary() { | 119 void AXMenuListPopup::UpdateChildrenIfNecessary() { | 
| 120   if (have_children_ && parent_ && parent_->NeedsToUpdateChildren()) | 120   if (have_children_ && parent_ && parent_->NeedsToUpdateChildren()) | 
| 121     ClearChildren(); | 121     ClearChildren(); | 
| 122 | 122 | 
| 123   if (!have_children_) | 123   if (!have_children_) | 
| 124     AddChildren(); | 124     AddChildren(); | 
| 125 } | 125 } | 
| 126 | 126 | 
| 127 void AXMenuListPopup::DidUpdateActiveOption(int option_index) { | 127 void AXMenuListPopup::DidUpdateActiveOption(int option_index, | 
|  | 128                                             bool fire_notifications) { | 
| 128   UpdateChildrenIfNecessary(); | 129   UpdateChildrenIfNecessary(); | 
| 129 | 130 | 
|  | 131   int old_index = active_index_; | 
|  | 132   active_index_ = option_index; | 
|  | 133 | 
|  | 134   if (!fire_notifications) | 
|  | 135     return; | 
|  | 136 | 
| 130   AXObjectCacheImpl& cache = AxObjectCache(); | 137   AXObjectCacheImpl& cache = AxObjectCache(); | 
| 131   if (active_index_ != option_index && active_index_ >= 0 && | 138   if (old_index != option_index && old_index >= 0 && | 
| 132       active_index_ < static_cast<int>(children_.size())) { | 139       old_index < static_cast<int>(children_.size())) { | 
| 133     AXObjectImpl* previous_child = children_[active_index_].Get(); | 140     AXObjectImpl* previous_child = children_[old_index].Get(); | 
| 134     cache.PostNotification(previous_child, | 141     cache.PostNotification(previous_child, | 
| 135                            AXObjectCacheImpl::kAXMenuListItemUnselected); | 142                            AXObjectCacheImpl::kAXMenuListItemUnselected); | 
| 136   } | 143   } | 
| 137 | 144 | 
| 138   if (option_index >= 0 && option_index < static_cast<int>(children_.size())) { | 145   if (option_index >= 0 && option_index < static_cast<int>(children_.size())) { | 
| 139     AXObjectImpl* child = children_[option_index].Get(); | 146     AXObjectImpl* child = children_[option_index].Get(); | 
| 140     cache.PostNotification(this, AXObjectCacheImpl::kAXActiveDescendantChanged); | 147     cache.PostNotification(this, AXObjectCacheImpl::kAXActiveDescendantChanged); | 
| 141     cache.PostNotification(child, AXObjectCacheImpl::kAXMenuListItemSelected); | 148     cache.PostNotification(child, AXObjectCacheImpl::kAXMenuListItemSelected); | 
| 142   } | 149   } | 
| 143 |  | 
| 144   active_index_ = option_index; |  | 
| 145 } | 150 } | 
| 146 | 151 | 
| 147 void AXMenuListPopup::DidHide() { | 152 void AXMenuListPopup::DidHide() { | 
| 148   AXObjectCacheImpl& cache = AxObjectCache(); | 153   AXObjectCacheImpl& cache = AxObjectCache(); | 
| 149   cache.PostNotification(this, AXObjectCacheImpl::kAXHide); | 154   cache.PostNotification(this, AXObjectCacheImpl::kAXHide); | 
| 150   if (ActiveDescendant()) | 155   if (ActiveDescendant()) | 
| 151     cache.PostNotification(ActiveDescendant(), | 156     cache.PostNotification(ActiveDescendant(), | 
| 152                            AXObjectCacheImpl::kAXMenuListItemUnselected); | 157                            AXObjectCacheImpl::kAXMenuListItemUnselected); | 
| 153 } | 158 } | 
| 154 | 159 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 168 } | 173 } | 
| 169 | 174 | 
| 170 AXObjectImpl* AXMenuListPopup::ActiveDescendant() { | 175 AXObjectImpl* AXMenuListPopup::ActiveDescendant() { | 
| 171   if (active_index_ < 0 || active_index_ >= static_cast<int>(Children().size())) | 176   if (active_index_ < 0 || active_index_ >= static_cast<int>(Children().size())) | 
| 172     return nullptr; | 177     return nullptr; | 
| 173 | 178 | 
| 174   return children_[active_index_].Get(); | 179   return children_[active_index_].Get(); | 
| 175 } | 180 } | 
| 176 | 181 | 
| 177 }  // namespace blink | 182 }  // namespace blink | 
| OLD | NEW | 
|---|