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

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

Issue 1277013005: Images from content:url() aren't loading if the alt attribute is present (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/layout/LayoutImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLImageElement.cpp
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index a79a7be988dcae4eeadc310ec544dcba798f002b..f6d39f0c885c1a734ffba8092e779063de159c56 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -46,6 +46,7 @@
#include "core/layout/LayoutBlockFlow.h"
#include "core/layout/LayoutImage.h"
#include "core/page/Page.h"
+#include "core/style/ContentData.h"
#include "platform/ContentType.h"
#include "platform/EventDispatchForbiddenScope.h"
#include "platform/MIMETypeRegistry.h"
@@ -330,12 +331,13 @@ ImageCandidate HTMLImageElement::findBestFitImageFromPictureParent()
LayoutObject* HTMLImageElement::createLayoutObject(const ComputedStyle& style)
{
+ const ContentData* contentData = style.contentData();
+ if (contentData && contentData->isImage() && !toImageContentData(contentData)->image()->cachedImage()->errorOccurred())
+ return LayoutObject::createObject(this, style);
+
if (m_useFallbackContent)
return new LayoutBlockFlow(this);
- if (style.hasContent())
- return LayoutObject::createObject(this, style);
-
LayoutImage* image = new LayoutImage(this);
image->setImageResource(LayoutImageResource::create());
image->setImageDevicePixelRatio(m_imageDevicePixelRatio);
@@ -699,6 +701,12 @@ void HTMLImageElement::didAddUserAgentShadowRoot(ShadowRoot&)
HTMLImageFallbackHelper::createAltTextShadowTree(*this);
}
+void HTMLImageElement::ensureFallbackForGeneratedContent()
+{
+ setUseFallbackContent();
+ reattachFallbackContent();
+}
+
void HTMLImageElement::ensureFallbackContent()
{
if (m_useFallbackContent || m_isFallbackImage)
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/layout/LayoutImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698