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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 void ImageLoader::updateFromElement() | 142 void ImageLoader::updateFromElement() |
143 { | 143 { |
144 // If we're not making renderers for the page, then don't load images. We d
on't want to slow | 144 // If we're not making renderers for the page, then don't load images. We d
on't want to slow |
145 // down the raw HTML parsing case by loading images we don't intend to displ
ay. | 145 // down the raw HTML parsing case by loading images we don't intend to displ
ay. |
146 Document* document = m_element->document(); | 146 Document* document = m_element->document(); |
147 if (!document->renderer()) | 147 if (!document->renderer()) |
148 return; | 148 return; |
149 | 149 |
150 AtomicString attr = m_element->imageSourceURL(); | 150 AtomicString attr = m_element->imageSourceURL(); |
151 | 151 |
152 if (attr == m_failedLoadURL) | 152 if (!m_failedLoadURL.isEmpty() && attr == m_failedLoadURL) |
153 return; | 153 return; |
154 | 154 |
155 // Do not load any image if the 'src' attribute is missing or if it is | 155 // Do not load any image if the 'src' attribute is missing or if it is |
156 // an empty string. | 156 // an empty string. |
157 ResourcePtr<CachedImage> newImage = 0; | 157 ResourcePtr<CachedImage> newImage = 0; |
158 if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) { | 158 if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) { |
159 FetchRequest request(ResourceRequest(document->completeURL(sourceURI(att
r))), element()->localName()); | 159 FetchRequest request(ResourceRequest(document->completeURL(sourceURI(att
r))), element()->localName()); |
160 | 160 |
161 String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossori
ginAttr); | 161 String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossori
ginAttr); |
162 if (!crossOriginMode.isNull()) { | 162 if (!crossOriginMode.isNull()) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 dispatchPendingBeforeLoadEvent(); | 222 dispatchPendingBeforeLoadEvent(); |
223 else | 223 else |
224 beforeLoadEventSender().dispatchEventSoon(this); | 224 beforeLoadEventSender().dispatchEventSoon(this); |
225 } else | 225 } else |
226 updateRenderer(); | 226 updateRenderer(); |
227 | 227 |
228 // If newImage is cached, addClient() will result in the load event | 228 // If newImage is cached, addClient() will result in the load event |
229 // being queued to fire. Ensure this happens after beforeload is | 229 // being queued to fire. Ensure this happens after beforeload is |
230 // dispatched. | 230 // dispatched. |
231 newImage->addClient(this); | 231 newImage->addClient(this); |
| 232 } else { |
| 233 updateRenderer(); |
232 } | 234 } |
| 235 |
233 if (oldImage) | 236 if (oldImage) |
234 oldImage->removeClient(this); | 237 oldImage->removeClient(this); |
235 } | 238 } |
236 | 239 |
237 if (RenderImageResource* imageResource = renderImageResource()) | 240 if (RenderImageResource* imageResource = renderImageResource()) |
238 imageResource->resetAnimation(); | 241 imageResource->resetAnimation(); |
239 | 242 |
240 // Only consider updating the protection ref-count of the Element immediatel
y before returning | 243 // Only consider updating the protection ref-count of the Element immediatel
y before returning |
241 // from this function as doing so might result in the destruction of this Im
ageLoader. | 244 // from this function as doing so might result in the destruction of this Im
ageLoader. |
242 updatedHasPendingEvent(); | 245 updatedHasPendingEvent(); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 clearFailedLoadURL(); | 446 clearFailedLoadURL(); |
444 setImage(0); | 447 setImage(0); |
445 } | 448 } |
446 | 449 |
447 inline void ImageLoader::clearFailedLoadURL() | 450 inline void ImageLoader::clearFailedLoadURL() |
448 { | 451 { |
449 m_failedLoadURL = AtomicString(); | 452 m_failedLoadURL = AtomicString(); |
450 } | 453 } |
451 | 454 |
452 } | 455 } |
OLD | NEW |