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

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

Issue 481753002: Use Shadow DOM to display fallback content for images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated 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
Index: Source/core/html/HTMLImageElement.h
diff --git a/Source/core/html/HTMLImageElement.h b/Source/core/html/HTMLImageElement.h
index 1fceb3d75797573aed9677d44a935dc4aaa4340f..1c9972ad611232fd83df9732ba8b167ef9c67190 100644
--- a/Source/core/html/HTMLImageElement.h
+++ b/Source/core/html/HTMLImageElement.h
@@ -34,6 +34,7 @@ namespace blink {
class HTMLFormElement;
class ImageCandidate;
+class ShadowRoot;
class HTMLImageElement final : public HTMLElement, public CanvasImageSource {
DEFINE_WRAPPERTYPEINFO();
@@ -56,7 +57,7 @@ public:
bool isServerMap() const;
- const AtomicString& altText() const;
+ virtual String altText() const override final;
ImageResource* cachedImage() const { return imageLoader().image(); }
void setImageResource(ImageResource* i) { imageLoader().setImage(i); };
@@ -86,6 +87,8 @@ public:
virtual HTMLFormElement* formOwner() const override;
void formRemovedFromTree(const Node& formRoot);
+ virtual void ensureFallbackContent();
+ virtual void ensurePrimaryContent();
// CanvasImageSourceImplementations
virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceImageStatus*) const override;
@@ -96,11 +99,18 @@ public:
// public so that HTMLPictureElement can call this as well.
void selectSourceURL(ImageLoader::UpdateFromElementBehavior);
+ void reattachFallbackContent();
+ void setUseFallbackContent();
+ void setIsFallbackImage() { m_isFallbackImage = true; }
+
protected:
explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByParser = false);
virtual void didMoveToNewDocument(Document& oldDocument) override;
+ virtual bool useFallbackContent() const { return m_useFallbackContent; }
+ virtual void didAddUserAgentShadowRoot(ShadowRoot&) override;
+ virtual PassRefPtr<RenderStyle> customStyleForRenderer() override;
private:
virtual bool areAuthorShadowsAllowed() const override { return false; }
@@ -146,6 +156,8 @@ private:
unsigned m_elementCreatedByParser : 1;
// Intrinsic sizing is viewport dependant if the 'w' descriptor was used for the picked resource.
unsigned m_intrinsicSizingViewportDependant : 1;
+ unsigned m_useFallbackContent : 1;
+ unsigned m_isFallbackImage : 1;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698