| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 if (eventType == eventNames().errorEvent) | 370 if (eventType == eventNames().errorEvent) |
| 371 dispatchPendingErrorEvent(); | 371 dispatchPendingErrorEvent(); |
| 372 } | 372 } |
| 373 | 373 |
| 374 void ImageLoader::dispatchPendingBeforeLoadEvent() | 374 void ImageLoader::dispatchPendingBeforeLoadEvent() |
| 375 { | 375 { |
| 376 if (!m_hasPendingBeforeLoadEvent) | 376 if (!m_hasPendingBeforeLoadEvent) |
| 377 return; | 377 return; |
| 378 if (!m_image) | 378 if (!m_image) |
| 379 return; | 379 return; |
| 380 if (!m_element->document().attached()) | 380 if (!m_element->document().confusingAndOftenMisusedAttached()) |
| 381 return; | 381 return; |
| 382 m_hasPendingBeforeLoadEvent = false; | 382 m_hasPendingBeforeLoadEvent = false; |
| 383 if (m_element->dispatchBeforeLoadEvent(m_image->url().string())) { | 383 if (m_element->dispatchBeforeLoadEvent(m_image->url().string())) { |
| 384 updateRenderer(); | 384 updateRenderer(); |
| 385 return; | 385 return; |
| 386 } | 386 } |
| 387 if (m_image) { | 387 if (m_image) { |
| 388 m_image->removeClient(this); | 388 m_image->removeClient(this); |
| 389 m_image = 0; | 389 m_image = 0; |
| 390 } | 390 } |
| 391 | 391 |
| 392 loadEventSender().cancelEvent(this); | 392 loadEventSender().cancelEvent(this); |
| 393 m_hasPendingLoadEvent = false; | 393 m_hasPendingLoadEvent = false; |
| 394 | 394 |
| 395 if (m_element->hasTagName(HTMLNames::objectTag)) | 395 if (m_element->hasTagName(HTMLNames::objectTag)) |
| 396 toHTMLObjectElement(m_element)->renderFallbackContent(); | 396 toHTMLObjectElement(m_element)->renderFallbackContent(); |
| 397 | 397 |
| 398 // Only consider updating the protection ref-count of the Element immediatel
y before returning | 398 // Only consider updating the protection ref-count of the Element immediatel
y before returning |
| 399 // from this function as doing so might result in the destruction of this Im
ageLoader. | 399 // from this function as doing so might result in the destruction of this Im
ageLoader. |
| 400 updatedHasPendingEvent(); | 400 updatedHasPendingEvent(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void ImageLoader::dispatchPendingLoadEvent() | 403 void ImageLoader::dispatchPendingLoadEvent() |
| 404 { | 404 { |
| 405 if (!m_hasPendingLoadEvent) | 405 if (!m_hasPendingLoadEvent) |
| 406 return; | 406 return; |
| 407 if (!m_image) | 407 if (!m_image) |
| 408 return; | 408 return; |
| 409 m_hasPendingLoadEvent = false; | 409 m_hasPendingLoadEvent = false; |
| 410 if (element()->document().attached()) | 410 if (element()->document().confusingAndOftenMisusedAttached()) |
| 411 dispatchLoadEvent(); | 411 dispatchLoadEvent(); |
| 412 | 412 |
| 413 // Only consider updating the protection ref-count of the Element immediatel
y before returning | 413 // Only consider updating the protection ref-count of the Element immediatel
y before returning |
| 414 // from this function as doing so might result in the destruction of this Im
ageLoader. | 414 // from this function as doing so might result in the destruction of this Im
ageLoader. |
| 415 updatedHasPendingEvent(); | 415 updatedHasPendingEvent(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 void ImageLoader::dispatchPendingErrorEvent() | 418 void ImageLoader::dispatchPendingErrorEvent() |
| 419 { | 419 { |
| 420 if (!m_hasPendingErrorEvent) | 420 if (!m_hasPendingErrorEvent) |
| 421 return; | 421 return; |
| 422 m_hasPendingErrorEvent = false; | 422 m_hasPendingErrorEvent = false; |
| 423 if (element()->document().attached()) | 423 if (element()->document().confusingAndOftenMisusedAttached()) |
| 424 element()->dispatchEvent(Event::create(eventNames().errorEvent)); | 424 element()->dispatchEvent(Event::create(eventNames().errorEvent)); |
| 425 | 425 |
| 426 // Only consider updating the protection ref-count of the Element immediatel
y before returning | 426 // Only consider updating the protection ref-count of the Element immediatel
y before returning |
| 427 // from this function as doing so might result in the destruction of this Im
ageLoader. | 427 // from this function as doing so might result in the destruction of this Im
ageLoader. |
| 428 updatedHasPendingEvent(); | 428 updatedHasPendingEvent(); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void ImageLoader::addClient(ImageLoaderClient* client) | 431 void ImageLoader::addClient(ImageLoaderClient* client) |
| 432 { | 432 { |
| 433 if (client->requestsHighLiveResourceCachePriority()) { | 433 if (client->requestsHighLiveResourceCachePriority()) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 handle->notifyImageSourceChanged(); | 476 handle->notifyImageSourceChanged(); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 | 479 |
| 480 inline void ImageLoader::clearFailedLoadURL() | 480 inline void ImageLoader::clearFailedLoadURL() |
| 481 { | 481 { |
| 482 m_failedLoadURL = AtomicString(); | 482 m_failedLoadURL = AtomicString(); |
| 483 } | 483 } |
| 484 | 484 |
| 485 } | 485 } |
| OLD | NEW |