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

Side by Side 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, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/html/HTMLImageElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 int width(bool ignorePendingStylesheets = false); 51 int width(bool ignorePendingStylesheets = false);
52 int height(bool ignorePendingStylesheets = false); 52 int height(bool ignorePendingStylesheets = false);
53 53
54 int naturalWidth() const; 54 int naturalWidth() const;
55 int naturalHeight() const; 55 int naturalHeight() const;
56 const String& currentSrc() const; 56 const String& currentSrc() const;
57 57
58 bool isServerMap() const; 58 bool isServerMap() const;
59 59
60 const AtomicString& altText() const; 60 virtual String altText() const OVERRIDE FINAL;
61 61
62 CompositeOperator compositeOperator() const { return m_compositeOperator; } 62 CompositeOperator compositeOperator() const { return m_compositeOperator; }
63 63
64 ImageResource* cachedImage() const { return imageLoader().image(); } 64 ImageResource* cachedImage() const { return imageLoader().image(); }
65 void setImageResource(ImageResource* i) { imageLoader().setImage(i); }; 65 void setImageResource(ImageResource* i) { imageLoader().setImage(i); };
66 66
67 void setLoadingImageDocument() { imageLoader().setLoadingImageDocument(); } 67 void setLoadingImageDocument() { imageLoader().setLoadingImageDocument(); }
68 68
69 void setHeight(int); 69 void setHeight(int);
70 70
(...skipping 11 matching lines...) Expand all
82 82
83 virtual bool canContainRangeEndPoint() const OVERRIDE { return false; } 83 virtual bool canContainRangeEndPoint() const OVERRIDE { return false; }
84 84
85 void addClient(ImageLoaderClient* client) { imageLoader().addClient(client); } 85 void addClient(ImageLoaderClient* client) { imageLoader().addClient(client); }
86 void removeClient(ImageLoaderClient* client) { imageLoader().removeClient(cl ient); } 86 void removeClient(ImageLoaderClient* client) { imageLoader().removeClient(cl ient); }
87 87
88 virtual const AtomicString imageSourceURL() const OVERRIDE; 88 virtual const AtomicString imageSourceURL() const OVERRIDE;
89 89
90 virtual HTMLFormElement* formOwner() const OVERRIDE; 90 virtual HTMLFormElement* formOwner() const OVERRIDE;
91 void formRemovedFromTree(const Node& formRoot); 91 void formRemovedFromTree(const Node& formRoot);
92 virtual void ensureFallbackContent() OVERRIDE FINAL;
93 virtual void ensurePrimaryContent() OVERRIDE FINAL;
92 94
93 // CanvasImageSourceImplementations 95 // CanvasImageSourceImplementations
94 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const; 96 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const;
95 virtual bool wouldTaintOrigin(SecurityOrigin*) const OVERRIDE; 97 virtual bool wouldTaintOrigin(SecurityOrigin*) const OVERRIDE;
96 virtual FloatSize sourceSize() const OVERRIDE; 98 virtual FloatSize sourceSize() const OVERRIDE;
97 virtual FloatSize defaultDestinationSize() const OVERRIDE; 99 virtual FloatSize defaultDestinationSize() const OVERRIDE;
98 virtual const KURL& sourceURL() const OVERRIDE; 100 virtual const KURL& sourceURL() const OVERRIDE;
99 101
100 // public so that HTMLPictureElement can call this as well. 102 // public so that HTMLPictureElement can call this as well.
101 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); 103 void selectSourceURL(ImageLoader::UpdateFromElementBehavior);
104 void reattachFallbackContent();
105 void setUseFallbackContent() { m_useFallbackContent = true; ensureUserAgentS hadowRoot(); }
106 void setIsFallbackImage() { m_isFallbackImage = true; }
107
102 protected: 108 protected:
103 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar ser = false); 109 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar ser = false);
104 110
105 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; 111 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
112 virtual bool useFallbackContent() const { return m_useFallbackContent; }
106 113
114 virtual void didAddUserAgentShadowRoot(ShadowRoot&) OVERRIDE;
115 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
107 private: 116 private:
108 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } 117 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
109 118
110 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 119 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
111 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; 120 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
112 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE; 121 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE;
113 122
114 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 123 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
115 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; 124 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
116 125
(...skipping 11 matching lines...) Expand all
128 virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; } 137 virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; }
129 virtual bool isInteractiveContent() const OVERRIDE; 138 virtual bool isInteractiveContent() const OVERRIDE;
130 virtual Image* imageContents() OVERRIDE; 139 virtual Image* imageContents() OVERRIDE;
131 140
132 void resetFormOwner(); 141 void resetFormOwner();
133 ImageCandidate findBestFitImageFromPictureParent(); 142 ImageCandidate findBestFitImageFromPictureParent();
134 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); 143 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&);
135 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } 144 HTMLImageLoader& imageLoader() const { return *m_imageLoader; }
136 void notifyViewportChanged(); 145 void notifyViewportChanged();
137 void createMediaQueryListIfDoesNotExist(); 146 void createMediaQueryListIfDoesNotExist();
147 Text* altTextNode() { return m_altTextNode; }
138 148
139 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader; 149 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader;
140 RefPtrWillBeMember<ViewportChangeListener> m_listener; 150 RefPtrWillBeMember<ViewportChangeListener> m_listener;
141 #if ENABLE(OILPAN) 151 #if ENABLE(OILPAN)
142 Member<HTMLFormElement> m_form; 152 Member<HTMLFormElement> m_form;
143 #else 153 #else
144 WeakPtr<HTMLFormElement> m_form; 154 WeakPtr<HTMLFormElement> m_form;
145 #endif 155 #endif
156 Text* m_altTextNode;
esprehn 2014/09/09 19:52:41 There's no reason for this, just do userAgentShado
146 CompositeOperator m_compositeOperator; 157 CompositeOperator m_compositeOperator;
147 AtomicString m_bestFitImageURL; 158 AtomicString m_bestFitImageURL;
148 float m_imageDevicePixelRatio; 159 float m_imageDevicePixelRatio;
149 unsigned m_formWasSetByParser : 1; 160 unsigned m_formWasSetByParser : 1;
150 unsigned m_elementCreatedByParser : 1; 161 unsigned m_elementCreatedByParser : 1;
151 // Intrinsic sizing is viewport dependant if the 'w' descriptor was used for the picked resource. 162 // Intrinsic sizing is viewport dependant if the 'w' descriptor was used for the picked resource.
152 unsigned m_intrinsicSizingViewportDependant : 1; 163 unsigned m_intrinsicSizingViewportDependant : 1;
153 // Effective size is viewport dependant if the sizes attribute's effective s ize used v* length units. 164 // Effective size is viewport dependant if the sizes attribute's effective s ize used v* length units.
154 unsigned m_effectiveSizeViewportDependant : 1; 165 unsigned m_effectiveSizeViewportDependant : 1;
166 unsigned m_useFallbackContent : 1;
167 unsigned m_isFallbackImage : 1;
155 }; 168 };
156 169
157 } // namespace blink 170 } // namespace blink
158 171
159 #endif // HTMLImageElement_h 172 #endif // HTMLImageElement_h
OLDNEW
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/html/HTMLImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698