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

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

Issue 2384273007: reflow comments in core/html/*.{cpp,h},core/html/imports (Closed)
Patch Set: comments Created 4 years, 2 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
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 24 matching lines...) Expand all
35 35
36 using namespace HTMLNames; 36 using namespace HTMLNames;
37 37
38 HTMLImageLoader::HTMLImageLoader(Element* element) : ImageLoader(element) {} 38 HTMLImageLoader::HTMLImageLoader(Element* element) : ImageLoader(element) {}
39 39
40 HTMLImageLoader::~HTMLImageLoader() {} 40 HTMLImageLoader::~HTMLImageLoader() {}
41 41
42 void HTMLImageLoader::dispatchLoadEvent() { 42 void HTMLImageLoader::dispatchLoadEvent() {
43 RESOURCE_LOADING_DVLOG(1) << "HTMLImageLoader::dispatchLoadEvent " << this; 43 RESOURCE_LOADING_DVLOG(1) << "HTMLImageLoader::dispatchLoadEvent " << this;
44 44
45 // HTMLVideoElement uses this class to load the poster image, but it should no t fire events for loading or failure. 45 // HTMLVideoElement uses this class to load the poster image, but it should
46 // not fire events for loading or failure.
46 if (isHTMLVideoElement(*element())) 47 if (isHTMLVideoElement(*element()))
47 return; 48 return;
48 49
49 bool errorOccurred = image()->errorOccurred(); 50 bool errorOccurred = image()->errorOccurred();
50 if (isHTMLObjectElement(*element()) && !errorOccurred) 51 if (isHTMLObjectElement(*element()) && !errorOccurred) {
51 errorOccurred = 52 // An <object> considers a 404 to be an error and should fire onerror.
52 (image()->response().httpStatusCode() >= 53 errorOccurred = (image()->response().httpStatusCode() >= 400);
53 400); // An <object> considers a 404 to be an error and should fire on error. 54 }
54 element()->dispatchEvent(Event::create(errorOccurred ? EventTypeNames::error 55 element()->dispatchEvent(Event::create(errorOccurred ? EventTypeNames::error
55 : EventTypeNames::load)); 56 : EventTypeNames::load));
56 } 57 }
57 58
58 static void loadFallbackContentForElement(Element* element) { 59 static void loadFallbackContentForElement(Element* element) {
59 if (isHTMLImageElement(element)) 60 if (isHTMLImageElement(element))
60 toHTMLImageElement(element)->ensureFallbackContent(); 61 toHTMLImageElement(element)->ensureFallbackContent();
61 else if (isHTMLInputElement(element)) 62 else if (isHTMLInputElement(element))
62 toHTMLInputElement(element)->ensureFallbackContent(); 63 toHTMLInputElement(element)->ensureFallbackContent();
63 } 64 }
64 65
65 void HTMLImageLoader::noImageResourceToLoad() { 66 void HTMLImageLoader::noImageResourceToLoad() {
66 // FIXME: Use fallback content even when there is no alt-text. The only blocke r is the large amount of rebaselining it requires. 67 // FIXME: Use fallback content even when there is no alt-text. The only
68 // blocker is the large amount of rebaselining it requires.
67 if (!toHTMLElement(element())->altText().isEmpty()) 69 if (!toHTMLElement(element())->altText().isEmpty())
68 loadFallbackContentForElement(element()); 70 loadFallbackContentForElement(element());
69 } 71 }
70 72
71 void HTMLImageLoader::imageNotifyFinished(ImageResource*) { 73 void HTMLImageLoader::imageNotifyFinished(ImageResource*) {
72 ImageResource* cachedImage = image(); 74 ImageResource* cachedImage = image();
73 Element* element = this->element(); 75 Element* element = this->element();
74 ImageLoader::imageNotifyFinished(cachedImage); 76 ImageLoader::imageNotifyFinished(cachedImage);
75 77
76 bool loadError = cachedImage->errorOccurred(); 78 bool loadError = cachedImage->errorOccurred();
(...skipping 14 matching lines...) Expand all
91 if ((loadError || cachedImage->response().httpStatusCode() >= 400) && 93 if ((loadError || cachedImage->response().httpStatusCode() >= 400) &&
92 isHTMLObjectElement(*element)) 94 isHTMLObjectElement(*element))
93 toHTMLObjectElement(element)->renderFallbackContent(); 95 toHTMLObjectElement(element)->renderFallbackContent();
94 } 96 }
95 97
96 void HTMLImageLoader::ensureFallbackContent() { 98 void HTMLImageLoader::ensureFallbackContent() {
97 loadFallbackContentForElement(element()); 99 loadFallbackContentForElement(element());
98 } 100 }
99 101
100 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698