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

Unified Diff: third_party/WebKit/Source/core/html/HTMLImageLoader.cpp

Issue 2535383003: Collapse images disallowed by the Safe Browsing Subresource Filter. (Closed)
Patch Set: Rebase. Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp b/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
index 1c33485e39292924bcbe7f978bafef8f57ea1127..ec641860758504dd4ee54a2f7b6fc2dab9f12159 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
@@ -56,18 +56,16 @@ void HTMLImageLoader::dispatchLoadEvent() {
: EventTypeNames::load));
}
-static void loadFallbackContentForElement(Element* element) {
- if (isHTMLImageElement(element))
- toHTMLImageElement(element)->ensureFallbackContent();
- else if (isHTMLInputElement(element))
- toHTMLInputElement(element)->ensureFallbackContent();
-}
-
void HTMLImageLoader::noImageResourceToLoad() {
// FIXME: Use fallback content even when there is no alt-text. The only
// blocker is the large amount of rebaselining it requires.
- if (!toHTMLElement(element())->altText().isEmpty())
- loadFallbackContentForElement(element());
+ if (toHTMLElement(element())->altText().isEmpty())
+ return;
+
+ if (isHTMLImageElement(element()))
+ toHTMLImageElement(element())->ensureCollapsedOrFallbackContent();
+ else if (isHTMLInputElement(element()))
+ toHTMLInputElement(element())->ensureFallbackContent();
}
void HTMLImageLoader::imageNotifyFinished(ImageResource*) {
@@ -78,14 +76,14 @@ void HTMLImageLoader::imageNotifyFinished(ImageResource*) {
bool loadError = cachedImage->errorOccurred();
if (isHTMLImageElement(*element)) {
if (loadError)
- ensureFallbackContent();
+ toHTMLImageElement(element)->ensureCollapsedOrFallbackContent();
else
toHTMLImageElement(element)->ensurePrimaryContent();
}
if (isHTMLInputElement(*element)) {
if (loadError)
- ensureFallbackContent();
+ toHTMLInputElement(element)->ensureFallbackContent();
else
toHTMLInputElement(element)->ensurePrimaryContent();
}
@@ -95,8 +93,4 @@ void HTMLImageLoader::imageNotifyFinished(ImageResource*) {
toHTMLObjectElement(element)->renderFallbackContent();
}
-void HTMLImageLoader::ensureFallbackContent() {
- loadFallbackContentForElement(element());
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698