Chromium Code Reviews| Index: Source/core/html/HTMLImageElement.cpp |
| diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp |
| index a79a7be988dcae4eeadc310ec544dcba798f002b..4af7c42865a778f71336d232c61285697c4c9fa4 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); |
| @@ -344,6 +346,7 @@ LayoutObject* HTMLImageElement::createLayoutObject(const ComputedStyle& style) |
| void HTMLImageElement::attach(const AttachContext& context) |
| { |
| + |
|
pdr.
2015/08/11 20:48:29
Nit: extra space
|
| HTMLElement::attach(context); |
| if (layoutObject() && layoutObject()->isImage()) { |
| @@ -699,6 +702,12 @@ void HTMLImageElement::didAddUserAgentShadowRoot(ShadowRoot&) |
| HTMLImageFallbackHelper::createAltTextShadowTree(*this); |
| } |
| +void HTMLImageElement::ensureFallbackForGeneratedContent() |
| +{ |
| + setUseFallbackContent(); |
| + reattachFallbackContent(); |
| +} |
| + |
| void HTMLImageElement::ensureFallbackContent() |
| { |
| if (m_useFallbackContent || m_isFallbackImage) |