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 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "core/loader/ImageLoader.h" | 23 #include "core/loader/ImageLoader.h" |
24 | 24 |
25 #include "core/dom/Document.h" | 25 #include "core/dom/Document.h" |
26 #include "core/dom/Element.h" | 26 #include "core/dom/Element.h" |
27 #include "core/events/Event.h" | 27 #include "core/events/Event.h" |
28 #include "core/events/EventSender.h" | 28 #include "core/events/EventSender.h" |
29 #include "core/fetch/CrossOriginAccessControl.h" | 29 #include "core/fetch/CrossOriginAccessControl.h" |
30 #include "core/fetch/FetchRequest.h" | 30 #include "core/fetch/FetchRequest.h" |
31 #include "core/fetch/MemoryCache.h" | |
31 #include "core/fetch/ResourceFetcher.h" | 32 #include "core/fetch/ResourceFetcher.h" |
32 #include "core/html/HTMLObjectElement.h" | 33 #include "core/html/HTMLObjectElement.h" |
33 #include "core/html/parser/HTMLParserIdioms.h" | 34 #include "core/html/parser/HTMLParserIdioms.h" |
34 #include "core/rendering/RenderImage.h" | 35 #include "core/rendering/RenderImage.h" |
35 #include "core/rendering/RenderVideo.h" | 36 #include "core/rendering/RenderVideo.h" |
36 #include "core/rendering/svg/RenderSVGImage.h" | 37 #include "core/rendering/svg/RenderSVGImage.h" |
37 #include "platform/weborigin/SecurityOrigin.h" | 38 #include "platform/weborigin/SecurityOrigin.h" |
38 | 39 |
39 namespace WebCore { | 40 namespace WebCore { |
40 | 41 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 // from this function as doing so might result in the destruction of this Im ageLoader. | 217 // from this function as doing so might result in the destruction of this Im ageLoader. |
217 updatedHasPendingEvent(); | 218 updatedHasPendingEvent(); |
218 } | 219 } |
219 | 220 |
220 void ImageLoader::updateFromElementIgnoringPreviousError() | 221 void ImageLoader::updateFromElementIgnoringPreviousError() |
221 { | 222 { |
222 clearFailedLoadURL(); | 223 clearFailedLoadURL(); |
223 updateFromElement(); | 224 updateFromElement(); |
224 } | 225 } |
225 | 226 |
227 bool ImageLoader::shouldLoadImmediately() const | |
228 { | |
229 if (m_loadManually) | |
230 return true; | |
231 | |
232 AtomicString attr = m_element->imageSourceURL(); | |
233 if (attr.isNull() || stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) { | |
234 return true; | |
235 } | |
236 | |
237 KURL url = m_element->document().completeURL(sourceURI(attr)); | |
238 if (url.protocolIsData()) | |
239 return true; | |
abarth-chromium
2014/04/01 23:57:14
Why are data URLs special?
| |
240 if (memoryCache()->resourceForURL(url)) | |
241 return true; | |
242 return false; | |
243 } | |
244 | |
226 void ImageLoader::notifyFinished(Resource* resource) | 245 void ImageLoader::notifyFinished(Resource* resource) |
227 { | 246 { |
228 ASSERT(m_failedLoadURL.isEmpty()); | 247 ASSERT(m_failedLoadURL.isEmpty()); |
229 ASSERT(resource == m_image.get()); | 248 ASSERT(resource == m_image.get()); |
230 | 249 |
231 m_imageComplete = true; | 250 m_imageComplete = true; |
232 updateRenderer(); | 251 updateRenderer(); |
233 | 252 |
234 if (!m_hasPendingLoadEvent) | 253 if (!m_hasPendingLoadEvent) |
235 return; | 254 return; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 handle->notifyImageSourceChanged(); | 419 handle->notifyImageSourceChanged(); |
401 } | 420 } |
402 } | 421 } |
403 | 422 |
404 inline void ImageLoader::clearFailedLoadURL() | 423 inline void ImageLoader::clearFailedLoadURL() |
405 { | 424 { |
406 m_failedLoadURL = AtomicString(); | 425 m_failedLoadURL = AtomicString(); |
407 } | 426 } |
408 | 427 |
409 } | 428 } |
OLD | NEW |