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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 ImageLoader::ImageLoader(Element* element) | 114 ImageLoader::ImageLoader(Element* element) |
115 : m_element(element) | 115 : m_element(element) |
116 , m_image(0) | 116 , m_image(0) |
117 , m_derefElementTimer(this, &ImageLoader::timerFired) | 117 , m_derefElementTimer(this, &ImageLoader::timerFired) |
118 , m_hasPendingLoadEvent(false) | 118 , m_hasPendingLoadEvent(false) |
119 , m_hasPendingErrorEvent(false) | 119 , m_hasPendingErrorEvent(false) |
120 , m_imageComplete(true) | 120 , m_imageComplete(true) |
121 , m_loadingImageDocument(false) | 121 , m_loadingImageDocument(false) |
122 , m_elementIsProtected(false) | 122 , m_elementIsProtected(false) |
| 123 , m_suppressErrorEvents(false) |
123 , m_highPriorityClientCount(0) | 124 , m_highPriorityClientCount(0) |
124 { | 125 { |
125 WTF_LOG(Timers, "new ImageLoader %p", this); | 126 WTF_LOG(Timers, "new ImageLoader %p", this); |
126 } | 127 } |
127 | 128 |
128 ImageLoader::~ImageLoader() | 129 ImageLoader::~ImageLoader() |
129 { | 130 { |
130 WTF_LOG(Timers, "~ImageLoader %p; m_hasPendingLoadEvent=%d, m_hasPendingErro
rEvent=%d", | 131 WTF_LOG(Timers, "~ImageLoader %p; m_hasPendingLoadEvent=%d, m_hasPendingErro
rEvent=%d", |
131 this, m_hasPendingLoadEvent, m_hasPendingErrorEvent); | 132 this, m_hasPendingLoadEvent, m_hasPendingErrorEvent); |
132 | 133 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 imageResource->resetAnimation(); | 313 imageResource->resetAnimation(); |
313 | 314 |
314 // Only consider updating the protection ref-count of the Element immediatel
y before returning | 315 // Only consider updating the protection ref-count of the Element immediatel
y before returning |
315 // from this function as doing so might result in the destruction of this Im
ageLoader. | 316 // from this function as doing so might result in the destruction of this Im
ageLoader. |
316 updatedHasPendingEvent(); | 317 updatedHasPendingEvent(); |
317 } | 318 } |
318 | 319 |
319 void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, Lo
adType loadType) | 320 void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, Lo
adType loadType) |
320 { | 321 { |
321 AtomicString imageSourceURL = m_element->imageSourceURL(); | 322 AtomicString imageSourceURL = m_element->imageSourceURL(); |
| 323 m_suppressErrorEvents = (updateBehavior == UpdateSizeChanged); |
322 | 324 |
323 if (updateBehavior == UpdateIgnorePreviousError) | 325 if (updateBehavior == UpdateIgnorePreviousError) |
324 clearFailedLoadURL(); | 326 clearFailedLoadURL(); |
325 | 327 |
326 if (!m_failedLoadURL.isEmpty() && imageSourceURL == m_failedLoadURL) | 328 if (!m_failedLoadURL.isEmpty() && imageSourceURL == m_failedLoadURL) |
327 return; | 329 return; |
328 | 330 |
329 // If we have a pending task, we have to clear it -- either we're | 331 // If we have a pending task, we have to clear it -- either we're |
330 // now loading immediately, or we need to reset the task's state. | 332 // now loading immediately, or we need to reset the task's state. |
331 if (m_pendingTask) { | 333 if (m_pendingTask) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 m_imageComplete = true; | 381 m_imageComplete = true; |
380 updateRenderer(); | 382 updateRenderer(); |
381 | 383 |
382 if (!m_hasPendingLoadEvent) | 384 if (!m_hasPendingLoadEvent) |
383 return; | 385 return; |
384 | 386 |
385 if (resource->errorOccurred()) { | 387 if (resource->errorOccurred()) { |
386 loadEventSender().cancelEvent(this); | 388 loadEventSender().cancelEvent(this); |
387 m_hasPendingLoadEvent = false; | 389 m_hasPendingLoadEvent = false; |
388 | 390 |
389 m_hasPendingErrorEvent = true; | 391 // The error event should not fire if the image data update is a result
of environment change. |
390 errorEventSender().dispatchEventSoon(this); | 392 // https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-
element:the-img-element-55 |
| 393 if (!m_suppressErrorEvents) { |
| 394 m_hasPendingErrorEvent = true; |
| 395 errorEventSender().dispatchEventSoon(this); |
| 396 } |
391 | 397 |
392 // Only consider updating the protection ref-count of the Element immedi
ately before returning | 398 // Only consider updating the protection ref-count of the Element immedi
ately before returning |
393 // from this function as doing so might result in the destruction of thi
s ImageLoader. | 399 // from this function as doing so might result in the destruction of thi
s ImageLoader. |
394 updatedHasPendingEvent(); | 400 updatedHasPendingEvent(); |
395 return; | 401 return; |
396 } | 402 } |
397 if (resource->wasCanceled()) { | 403 if (resource->wasCanceled()) { |
398 m_hasPendingLoadEvent = false; | 404 m_hasPendingLoadEvent = false; |
399 // Only consider updating the protection ref-count of the Element immedi
ately before returning | 405 // Only consider updating the protection ref-count of the Element immedi
ately before returning |
400 // from this function as doing so might result in the destruction of thi
s ImageLoader. | 406 // from this function as doing so might result in the destruction of thi
s ImageLoader. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 } | 577 } |
572 | 578 |
573 #if ENABLE(OILPAN) | 579 #if ENABLE(OILPAN) |
574 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() | 580 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() |
575 { | 581 { |
576 m_loader.willRemoveClient(m_client); | 582 m_loader.willRemoveClient(m_client); |
577 } | 583 } |
578 #endif | 584 #endif |
579 | 585 |
580 } | 586 } |
OLD | NEW |