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, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. |
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 26 matching lines...) Expand all Loading... |
37 { | 37 { |
38 } | 38 } |
39 | 39 |
40 HTMLImageLoader::~HTMLImageLoader() | 40 HTMLImageLoader::~HTMLImageLoader() |
41 { | 41 { |
42 } | 42 } |
43 | 43 |
44 void HTMLImageLoader::dispatchLoadEvent() | 44 void HTMLImageLoader::dispatchLoadEvent() |
45 { | 45 { |
46 // HTMLVideoElement uses this class to load the poster image, but it should
not fire events for loading or failure. | 46 // HTMLVideoElement uses this class to load the poster image, but it should
not fire events for loading or failure. |
47 if (element()->hasTagName(HTMLNames::videoTag)) | 47 if (isHTMLVideoElement(*element())) |
48 return; | 48 return; |
49 | 49 |
50 bool errorOccurred = image()->errorOccurred(); | 50 bool errorOccurred = image()->errorOccurred(); |
51 if (!errorOccurred && image()->response().httpStatusCode() >= 400) | 51 if (!errorOccurred && image()->response().httpStatusCode() >= 400) |
52 errorOccurred = element()->hasTagName(HTMLNames::objectTag); // An <obje
ct> considers a 404 to be an error and should fire onerror. | 52 errorOccurred = isHTMLObjectElement(*element()); // An <object> consider
s a 404 to be an error and should fire onerror. |
53 element()->dispatchEvent(Event::create(errorOccurred ? EventTypeNames::error
: EventTypeNames::load)); | 53 element()->dispatchEvent(Event::create(errorOccurred ? EventTypeNames::error
: EventTypeNames::load)); |
54 } | 54 } |
55 | 55 |
56 String HTMLImageLoader::sourceURI(const AtomicString& attr) const | 56 String HTMLImageLoader::sourceURI(const AtomicString& attr) const |
57 { | 57 { |
58 return stripLeadingAndTrailingHTMLSpaces(attr); | 58 return stripLeadingAndTrailingHTMLSpaces(attr); |
59 } | 59 } |
60 | 60 |
61 void HTMLImageLoader::notifyFinished(Resource*) | 61 void HTMLImageLoader::notifyFinished(Resource*) |
62 { | 62 { |
63 ImageResource* cachedImage = image(); | 63 ImageResource* cachedImage = image(); |
64 | 64 |
65 RefPtr<Element> element = this->element(); | 65 RefPtr<Element> element = this->element(); |
66 ImageLoader::notifyFinished(cachedImage); | 66 ImageLoader::notifyFinished(cachedImage); |
67 | 67 |
68 bool loadError = cachedImage->errorOccurred() || cachedImage->response().htt
pStatusCode() >= 400; | 68 bool loadError = cachedImage->errorOccurred() || cachedImage->response().htt
pStatusCode() >= 400; |
69 | 69 |
70 if (loadError && element->hasTagName(HTMLNames::objectTag)) | 70 if (loadError && isHTMLObjectElement(*element)) |
71 toHTMLObjectElement(element)->renderFallbackContent(); | 71 toHTMLObjectElement(element)->renderFallbackContent(); |
72 } | 72 } |
73 | 73 |
74 } | 74 } |
OLD | NEW |