Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: Source/core/html/HTMLImageLoader.cpp

Issue 198553002: Use new is*Element() helper functions even more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLFrameSetElement.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFrameSetElement.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698