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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 bool AXMenuList::CanSetFocusAttribute() const { | 112 bool AXMenuList::CanSetFocusAttribute() const { |
113 if (!GetNode()) | 113 if (!GetNode()) |
114 return false; | 114 return false; |
115 | 115 |
116 return !ToElement(GetNode())->IsDisabledFormControl(); | 116 return !ToElement(GetNode())->IsDisabledFormControl(); |
117 } | 117 } |
118 | 118 |
119 void AXMenuList::DidUpdateActiveOption(int option_index) { | 119 void AXMenuList::DidUpdateActiveOption(int option_index) { |
| 120 bool suppress_notifications = |
| 121 (GetNode() && !GetNode()->IsFinishedParsingChildren()); |
120 const auto& child_objects = Children(); | 122 const auto& child_objects = Children(); |
121 if (!child_objects.IsEmpty()) { | 123 if (!child_objects.IsEmpty()) { |
122 DCHECK(child_objects.size() == 1); | 124 DCHECK(child_objects.size() == 1); |
123 DCHECK(child_objects[0]->IsMenuListPopup()); | 125 DCHECK(child_objects[0]->IsMenuListPopup()); |
124 | 126 |
125 if (child_objects[0]->IsMenuListPopup()) { | 127 if (child_objects[0]->IsMenuListPopup()) { |
126 if (AXMenuListPopup* popup = ToAXMenuListPopup(child_objects[0].Get())) | 128 if (AXMenuListPopup* popup = ToAXMenuListPopup(child_objects[0].Get())) |
127 popup->DidUpdateActiveOption(option_index); | 129 popup->DidUpdateActiveOption(option_index, !suppress_notifications); |
128 } | 130 } |
129 } | 131 } |
130 | 132 |
131 AxObjectCache().PostNotification(this, | 133 AxObjectCache().PostNotification(this, |
132 AXObjectCacheImpl::kAXMenuListValueChanged); | 134 AXObjectCacheImpl::kAXMenuListValueChanged); |
133 } | 135 } |
134 | 136 |
135 void AXMenuList::DidShowPopup() { | 137 void AXMenuList::DidShowPopup() { |
136 if (Children().size() != 1) | 138 if (Children().size() != 1) |
137 return; | 139 return; |
138 | 140 |
139 AXMenuListPopup* popup = ToAXMenuListPopup(Children()[0].Get()); | 141 AXMenuListPopup* popup = ToAXMenuListPopup(Children()[0].Get()); |
140 popup->DidShow(); | 142 popup->DidShow(); |
141 } | 143 } |
142 | 144 |
143 void AXMenuList::DidHidePopup() { | 145 void AXMenuList::DidHidePopup() { |
144 if (Children().size() != 1) | 146 if (Children().size() != 1) |
145 return; | 147 return; |
146 | 148 |
147 AXMenuListPopup* popup = ToAXMenuListPopup(Children()[0].Get()); | 149 AXMenuListPopup* popup = ToAXMenuListPopup(Children()[0].Get()); |
148 popup->DidHide(); | 150 popup->DidHide(); |
149 | 151 |
150 if (GetNode() && GetNode()->IsFocused()) | 152 if (GetNode() && GetNode()->IsFocused()) |
151 AxObjectCache().PostNotification( | 153 AxObjectCache().PostNotification( |
152 this, AXObjectCacheImpl::kAXFocusedUIElementChanged); | 154 this, AXObjectCacheImpl::kAXFocusedUIElementChanged); |
153 } | 155 } |
154 | 156 |
155 } // namespace blink | 157 } // namespace blink |
OLD | NEW |