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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLImageElement.h

Issue 2535383003: Collapse images disallowed by the Safe Browsing Subresource Filter. (Closed)
Patch Set: Initial draft. Created 4 years 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
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool hasPendingActivity() const final { 95 bool hasPendingActivity() const final {
96 return imageLoader().hasPendingActivity(); 96 return imageLoader().hasPendingActivity();
97 } 97 }
98 98
99 bool canContainRangeEndPoint() const override { return false; } 99 bool canContainRangeEndPoint() const override { return false; }
100 100
101 const AtomicString imageSourceURL() const override; 101 const AtomicString imageSourceURL() const override;
102 102
103 HTMLFormElement* formOwner() const override; 103 HTMLFormElement* formOwner() const override;
104 void formRemovedFromTree(const Node& formRoot); 104 void formRemovedFromTree(const Node& formRoot);
105 virtual void ensureFallbackContent(); 105 virtual void ensureCollapsedOrFallbackContent();
106 virtual void ensureFallbackForGeneratedContent(); 106 virtual void ensureFallbackForGeneratedContent();
107 virtual void ensurePrimaryContent(); 107 virtual void ensurePrimaryContent();
108 108
109 // CanvasImageSource implementation 109 // CanvasImageSource implementation
110 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, 110 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*,
111 AccelerationHint, 111 AccelerationHint,
112 SnapshotReason, 112 SnapshotReason,
113 const FloatSize&) const override; 113 const FloatSize&) const override;
114 bool isSVGSource() const override; 114 bool isSVGSource() const override;
115 bool wouldTaintOrigin(SecurityOrigin*) const override; 115 bool wouldTaintOrigin(SecurityOrigin*) const override;
116 FloatSize elementSize(const FloatSize&) const override; 116 FloatSize elementSize(const FloatSize&) const override;
117 FloatSize defaultDestinationSize(const FloatSize&) const override; 117 FloatSize defaultDestinationSize(const FloatSize&) const override;
118 const KURL& sourceURL() const override; 118 const KURL& sourceURL() const override;
119 bool isAccelerated() const override { return false; } 119 bool isAccelerated() const override { return false; }
120 bool isOpaque() const override; 120 bool isOpaque() const override;
121 int sourceWidth() override; 121 int sourceWidth() override;
122 int sourceHeight() override; 122 int sourceHeight() override;
123 123
124 // public so that HTMLPictureElement can call this as well. 124 // public so that HTMLPictureElement can call this as well.
125 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); 125 void selectSourceURL(ImageLoader::UpdateFromElementBehavior);
126 void reattachFallbackContent(); 126 void reattachContent();
127 void setUseFallbackContent(); 127 void setUseFallbackContent();
128 void setIsFallbackImage() { m_isFallbackImage = true; } 128 void setIsFallbackImage() { m_isFallbackImage = true; }
129 129
130 FetchRequest::ResourceWidth getResourceWidth(); 130 FetchRequest::ResourceWidth getResourceWidth();
131 float sourceSize(Element&); 131 float sourceSize(Element&);
132 132
133 void forceReload() const; 133 void forceReload() const;
134 134
135 // ImageBitmapSource implementation 135 // ImageBitmapSource implementation
136 IntSize bitmapSourceSize() const override; 136 IntSize bitmapSourceSize() const override;
137 ScriptPromise createImageBitmap(ScriptState*, 137 ScriptPromise createImageBitmap(ScriptState*,
138 EventTarget&, 138 EventTarget&,
139 Optional<IntRect> cropRect, 139 Optional<IntRect> cropRect,
140 const ImageBitmapOptions&, 140 const ImageBitmapOptions&,
141 ExceptionState&) override; 141 ExceptionState&) override;
142 142
143 protected: 143 protected:
144 enum class ContentType : uint8_t { Primary, Fallback, Collapsed };
145
144 explicit HTMLImageElement(Document&, 146 explicit HTMLImageElement(Document&,
145 HTMLFormElement* = 0, 147 HTMLFormElement* = 0,
146 bool createdByParser = false); 148 bool createdByParser = false);
147 149
148 void didMoveToNewDocument(Document& oldDocument) override; 150 void didMoveToNewDocument(Document& oldDocument) override;
149 virtual bool useFallbackContent() const { return m_useFallbackContent; } 151 virtual bool useFallbackContent() const {
152 return m_contentType == ContentType::Fallback;
153 }
150 154
151 void didAddUserAgentShadowRoot(ShadowRoot&) override; 155 void didAddUserAgentShadowRoot(ShadowRoot&) override;
152 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; 156 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override;
153 157
154 private: 158 private:
155 bool areAuthorShadowsAllowed() const override { return false; } 159 bool areAuthorShadowsAllowed() const override { return false; }
156 160
157 void parseAttribute(const QualifiedName&, 161 void parseAttribute(const QualifiedName&,
158 const AtomicString&, 162 const AtomicString&,
159 const AtomicString&) override; 163 const AtomicString&) override;
160 bool isPresentationAttribute(const QualifiedName&) const override; 164 bool isPresentationAttribute(const QualifiedName&) const override;
161 void collectStyleForPresentationAttribute(const QualifiedName&, 165 void collectStyleForPresentationAttribute(const QualifiedName&,
162 const AtomicString&, 166 const AtomicString&,
163 MutableStylePropertySet*) override; 167 MutableStylePropertySet*) override;
164 168
165 void attachLayoutTree(const AttachContext& = AttachContext()) override; 169 void attachLayoutTree(const AttachContext& = AttachContext()) override;
170 bool layoutObjectIsNeeded(const ComputedStyle&) override;
166 LayoutObject* createLayoutObject(const ComputedStyle&) override; 171 LayoutObject* createLayoutObject(const ComputedStyle&) override;
167 172
168 bool canStartSelection() const override { return false; } 173 bool canStartSelection() const override { return false; }
169 174
170 bool isURLAttribute(const Attribute&) const override; 175 bool isURLAttribute(const Attribute&) const override;
171 bool hasLegalLinkAttribute(const QualifiedName&) const override; 176 bool hasLegalLinkAttribute(const QualifiedName&) const override;
172 const QualifiedName& subResourceAttributeName() const override; 177 const QualifiedName& subResourceAttributeName() const override;
173 178
174 bool draggable() const override; 179 bool draggable() const override;
175 180
(...skipping 10 matching lines...) Expand all
186 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } 191 HTMLImageLoader& imageLoader() const { return *m_imageLoader; }
187 void notifyViewportChanged(); 192 void notifyViewportChanged();
188 void createMediaQueryListIfDoesNotExist(); 193 void createMediaQueryListIfDoesNotExist();
189 194
190 Member<HTMLImageLoader> m_imageLoader; 195 Member<HTMLImageLoader> m_imageLoader;
191 Member<ViewportChangeListener> m_listener; 196 Member<ViewportChangeListener> m_listener;
192 Member<HTMLFormElement> m_form; 197 Member<HTMLFormElement> m_form;
193 AtomicString m_bestFitImageURL; 198 AtomicString m_bestFitImageURL;
194 float m_imageDevicePixelRatio; 199 float m_imageDevicePixelRatio;
195 Member<HTMLSourceElement> m_source; 200 Member<HTMLSourceElement> m_source;
201 ContentType m_contentType;
Mike West 2016/11/30 15:57:35 Nit: "LayoutDisposition", perhaps? `ContentType` m
engedy 2016/11/30 17:37:39 Good point. LayoutDisposition sounds good, done.
196 unsigned m_formWasSetByParser : 1; 202 unsigned m_formWasSetByParser : 1;
197 unsigned m_elementCreatedByParser : 1; 203 unsigned m_elementCreatedByParser : 1;
198 unsigned m_useFallbackContent : 1;
199 unsigned m_isFallbackImage : 1; 204 unsigned m_isFallbackImage : 1;
200 205
201 ReferrerPolicy m_referrerPolicy; 206 ReferrerPolicy m_referrerPolicy;
202 }; 207 };
203 208
204 } // namespace blink 209 } // namespace blink
205 210
206 #endif // HTMLImageElement_h 211 #endif // HTMLImageElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698