OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
8 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) | 8 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const EventListenerOptions& options, | 131 const EventListenerOptions& options, |
132 size_t* indexOfRemovedListener, | 132 size_t* indexOfRemovedListener, |
133 RegisteredEventListener* registeredListener) { | 133 RegisteredEventListener* registeredListener) { |
134 const auto begin = listenerVector->data(); | 134 const auto begin = listenerVector->data(); |
135 const auto end = begin + listenerVector->size(); | 135 const auto end = begin + listenerVector->size(); |
136 | 136 |
137 // Do a manual search for the matching RegisteredEventListener. It is not | 137 // Do a manual search for the matching RegisteredEventListener. It is not |
138 // possible to create a RegisteredEventListener on the stack because of the | 138 // possible to create a RegisteredEventListener on the stack because of the |
139 // const on |listener|. | 139 // const on |listener|. |
140 const auto it = std::find_if( | 140 const auto it = std::find_if( |
141 begin, end, [listener, options]( | 141 begin, end, |
142 const RegisteredEventListener& eventListener) -> bool { | 142 [listener, options](const RegisteredEventListener& eventListener) |
143 return eventListener.matches(listener, options); | 143 -> bool { return eventListener.matches(listener, options); }); |
144 }); | |
145 | 144 |
146 if (it == end) { | 145 if (it == end) { |
147 *indexOfRemovedListener = kNotFound; | 146 *indexOfRemovedListener = kNotFound; |
148 return false; | 147 return false; |
149 } | 148 } |
150 *registeredListener = *it; | 149 *registeredListener = *it; |
151 *indexOfRemovedListener = it - begin; | 150 *indexOfRemovedListener = it - begin; |
152 listenerVector->remove(*indexOfRemovedListener); | 151 listenerVector->remove(*indexOfRemovedListener); |
153 return true; | 152 return true; |
154 } | 153 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 EventListenerVector& listeners = *m_map->m_entries[m_entryIndex].second; | 223 EventListenerVector& listeners = *m_map->m_entries[m_entryIndex].second; |
225 if (m_index < listeners.size()) | 224 if (m_index < listeners.size()) |
226 return listeners[m_index++].listener(); | 225 return listeners[m_index++].listener(); |
227 m_index = 0; | 226 m_index = 0; |
228 } | 227 } |
229 | 228 |
230 return nullptr; | 229 return nullptr; |
231 } | 230 } |
232 | 231 |
233 } // namespace blink | 232 } // namespace blink |
OLD | NEW |