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

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

Issue 757583002: Revert of Use Shadow DOM to display fallback content for images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/core/html/HTMLImageLoader.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLImageLoader.cpp
diff --git a/Source/core/html/HTMLImageLoader.cpp b/Source/core/html/HTMLImageLoader.cpp
index 78479403fde99240b57e72309959d41973774515..44fc879fe2f85abc3b3d5fe90ff5fef691766d39 100644
--- a/Source/core/html/HTMLImageLoader.cpp
+++ b/Source/core/html/HTMLImageLoader.cpp
@@ -27,18 +27,14 @@
#include "core/events/Event.h"
#include "core/fetch/ImageResource.h"
#include "core/html/HTMLImageElement.h"
-#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLObjectElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "platform/Logging.h"
namespace blink {
-using namespace HTMLNames;
-
-HTMLImageLoader::HTMLImageLoader(Element* element)
- : ImageLoader(element)
- , m_loadFallbackContentTimer(this, &HTMLImageLoader::timerFired)
+HTMLImageLoader::HTMLImageLoader(Element* node)
+ : ImageLoader(node)
{
}
@@ -65,56 +61,17 @@
return stripLeadingAndTrailingHTMLSpaces(attr);
}
-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());
-}
-
void HTMLImageLoader::notifyFinished(Resource*)
{
ImageResource* cachedImage = image();
+
RefPtrWillBeRawPtr<Element> element = this->element();
ImageLoader::notifyFinished(cachedImage);
bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400;
- if (isHTMLImageElement(*element)) {
- if (loadError)
- ensureFallbackContent();
- else
- toHTMLImageElement(element)->ensurePrimaryContent();
- }
-
- if (isHTMLInputElement(*element)) {
- if (loadError)
- ensureFallbackContent();
- else
- toHTMLInputElement(element)->ensurePrimaryContent();
- }
if (loadError && isHTMLObjectElement(*element))
toHTMLObjectElement(element)->renderFallbackContent();
}
-void HTMLImageLoader::ensureFallbackContent()
-{
- if (image()->url().protocolIsData())
- m_loadFallbackContentTimer.startOneShot(0, FROM_HERE);
- else
- loadFallbackContentForElement(element());
}
-
-void HTMLImageLoader::timerFired(Timer<HTMLImageLoader>*)
-{
- loadFallbackContentForElement(element());
-}
-}
« no previous file with comments | « Source/core/html/HTMLImageLoader.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698