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

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

Issue 1833303002: [Not committed] Make image load completion async and remove EventSender from ImageLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Loader_asyncImageLoadEvent_1
Patch Set: Rebase. Created 4 years, 8 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 toHTMLInputElement(element)->ensureFallbackContent(); 66 toHTMLInputElement(element)->ensureFallbackContent();
67 } 67 }
68 68
69 void HTMLImageLoader::noImageResourceToLoad() 69 void HTMLImageLoader::noImageResourceToLoad()
70 { 70 {
71 // FIXME: Use fallback content even when there is no alt-text. The only bloc ker is the large amount of rebaselining it requires. 71 // FIXME: Use fallback content even when there is no alt-text. The only bloc ker is the large amount of rebaselining it requires.
72 if (!toHTMLElement(element())->altText().isEmpty()) 72 if (!toHTMLElement(element())->altText().isEmpty())
73 loadFallbackContentForElement(element()); 73 loadFallbackContentForElement(element());
74 } 74 }
75 75
76 void HTMLImageLoader::imageNotifyFinished(ImageResource*) 76 void HTMLImageLoader::finishInternal(ImageResource* imageResource)
77 { 77 {
78 ImageResource* cachedImage = image();
79 RawPtr<Element> element = this->element(); 78 RawPtr<Element> element = this->element();
80 ImageLoader::imageNotifyFinished(cachedImage);
81 79
82 bool loadError = cachedImage->errorOccurred(); 80 bool loadError = imageResource->errorOccurred();
83 if (isHTMLImageElement(*element)) { 81 if (isHTMLImageElement(*element)) {
84 if (loadError) 82 if (loadError)
85 ensureFallbackContent(); 83 ensureFallbackContent();
86 else 84 else
87 toHTMLImageElement(element)->ensurePrimaryContent(); 85 toHTMLImageElement(element)->ensurePrimaryContent();
88 } 86 }
89 87
90 if (isHTMLInputElement(*element)) { 88 if (isHTMLInputElement(*element)) {
91 if (loadError) 89 if (loadError)
92 ensureFallbackContent(); 90 ensureFallbackContent();
93 else 91 else
94 toHTMLInputElement(element)->ensurePrimaryContent(); 92 toHTMLInputElement(element)->ensurePrimaryContent();
95 } 93 }
96 94
97 if ((loadError || cachedImage->response().httpStatusCode() >= 400) && isHTML ObjectElement(*element)) 95 if ((loadError || imageResource->response().httpStatusCode() >= 400) && isHT MLObjectElement(*element))
98 toHTMLObjectElement(element)->renderFallbackContent(); 96 toHTMLObjectElement(element)->renderFallbackContent();
99 } 97 }
100 98
101 void HTMLImageLoader::ensureFallbackContent() 99 void HTMLImageLoader::ensureFallbackContent()
102 { 100 {
103 loadFallbackContentForElement(element()); 101 loadFallbackContentForElement(element());
104 } 102 }
105 103
106 } // namespace blink 104 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLImageLoader.h ('k') | third_party/WebKit/Source/core/loader/ImageLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698