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 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Only consider updating the protection ref-count of the Element immediatel
y before returning | 108 // Only consider updating the protection ref-count of the Element immediatel
y before returning |
109 // from this function as doing so might result in the destruction of this Im
ageLoader. | 109 // from this function as doing so might result in the destruction of this Im
ageLoader. |
110 updatedHasPendingEvent(); | 110 updatedHasPendingEvent(); |
111 } | 111 } |
112 | 112 |
113 void ImageLoader::setImageWithoutConsideringPendingLoadEvent(CachedImage* newIma
ge) | 113 void ImageLoader::setImageWithoutConsideringPendingLoadEvent(CachedImage* newIma
ge) |
114 { | 114 { |
115 ASSERT(m_failedLoadURL.isEmpty()); | 115 ASSERT(m_failedLoadURL.isEmpty()); |
116 CachedImage* oldImage = m_image.get(); | 116 CachedImage* oldImage = m_image.get(); |
117 if (newImage != oldImage) { | 117 if (newImage != oldImage) { |
| 118 sourceImageChanged(); |
118 m_image = newImage; | 119 m_image = newImage; |
119 if (m_hasPendingBeforeLoadEvent) { | 120 if (m_hasPendingBeforeLoadEvent) { |
120 beforeLoadEventSender().cancelEvent(this); | 121 beforeLoadEventSender().cancelEvent(this); |
121 m_hasPendingBeforeLoadEvent = false; | 122 m_hasPendingBeforeLoadEvent = false; |
122 } | 123 } |
123 if (m_hasPendingLoadEvent) { | 124 if (m_hasPendingLoadEvent) { |
124 loadEventSender().cancelEvent(this); | 125 loadEventSender().cancelEvent(this); |
125 m_hasPendingLoadEvent = false; | 126 m_hasPendingLoadEvent = false; |
126 } | 127 } |
127 if (m_hasPendingErrorEvent) { | 128 if (m_hasPendingErrorEvent) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 m_failedLoadURL = attr; | 184 m_failedLoadURL = attr; |
184 m_hasPendingErrorEvent = true; | 185 m_hasPendingErrorEvent = true; |
185 errorEventSender().dispatchEventSoon(this); | 186 errorEventSender().dispatchEventSoon(this); |
186 } else | 187 } else |
187 clearFailedLoadURL(); | 188 clearFailedLoadURL(); |
188 } else if (!attr.isNull()) { | 189 } else if (!attr.isNull()) { |
189 // Fire an error event if the url is empty. | 190 // Fire an error event if the url is empty. |
190 m_hasPendingErrorEvent = true; | 191 m_hasPendingErrorEvent = true; |
191 errorEventSender().dispatchEventSoon(this); | 192 errorEventSender().dispatchEventSoon(this); |
192 } | 193 } |
193 | 194 |
194 CachedImage* oldImage = m_image.get(); | 195 CachedImage* oldImage = m_image.get(); |
195 if (newImage != oldImage) { | 196 if (newImage != oldImage) { |
| 197 sourceImageChanged(); |
| 198 |
196 if (m_hasPendingBeforeLoadEvent) { | 199 if (m_hasPendingBeforeLoadEvent) { |
197 beforeLoadEventSender().cancelEvent(this); | 200 beforeLoadEventSender().cancelEvent(this); |
198 m_hasPendingBeforeLoadEvent = false; | 201 m_hasPendingBeforeLoadEvent = false; |
199 } | 202 } |
200 if (m_hasPendingLoadEvent) { | 203 if (m_hasPendingLoadEvent) { |
201 loadEventSender().cancelEvent(this); | 204 loadEventSender().cancelEvent(this); |
202 m_hasPendingLoadEvent = false; | 205 m_hasPendingLoadEvent = false; |
203 } | 206 } |
204 | 207 |
205 // Cancel error events that belong to the previous load, which is now ca
ncelled by changing the src attribute. | 208 // Cancel error events that belong to the previous load, which is now ca
ncelled by changing the src attribute. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 { | 440 { |
438 errorEventSender().dispatchPendingEvents(); | 441 errorEventSender().dispatchPendingEvents(); |
439 } | 442 } |
440 | 443 |
441 void ImageLoader::elementDidMoveToNewDocument() | 444 void ImageLoader::elementDidMoveToNewDocument() |
442 { | 445 { |
443 clearFailedLoadURL(); | 446 clearFailedLoadURL(); |
444 setImage(0); | 447 setImage(0); |
445 } | 448 } |
446 | 449 |
| 450 void ImageLoader::sourceImageChanged() |
| 451 { |
| 452 HashSet<ImageLoaderClient*>::iterator end = m_clients.end(); |
| 453 for (HashSet<ImageLoaderClient*>::iterator it = m_clients.begin(); it != end
; ++it) { |
| 454 ImageLoaderClient* handle = *it; |
| 455 handle->notifyImageSourceChanged(); |
| 456 } |
| 457 } |
| 458 |
447 inline void ImageLoader::clearFailedLoadURL() | 459 inline void ImageLoader::clearFailedLoadURL() |
448 { | 460 { |
449 m_failedLoadURL = AtomicString(); | 461 m_failedLoadURL = AtomicString(); |
450 } | 462 } |
451 | 463 |
452 } | 464 } |
OLD | NEW |