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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLImageElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.h b/third_party/WebKit/Source/core/html/HTMLImageElement.h
index 1bc5c0cd1c677c4b104b4df99b2b9fc23ca74200..0ea9752b7c60cd23d675fe35484e14938bb03b8a 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLImageElement.h
@@ -102,7 +102,7 @@ class CORE_EXPORT HTMLImageElement final : public HTMLElement,
HTMLFormElement* formOwner() const override;
void formRemovedFromTree(const Node& formRoot);
- virtual void ensureFallbackContent();
+ virtual void ensureCollapsedOrFallbackContent();
virtual void ensureFallbackForGeneratedContent();
virtual void ensurePrimaryContent();
@@ -123,7 +123,7 @@ class CORE_EXPORT HTMLImageElement final : public HTMLElement,
// public so that HTMLPictureElement can call this as well.
void selectSourceURL(ImageLoader::UpdateFromElementBehavior);
- void reattachFallbackContent();
+ void reattachContent();
void setUseFallbackContent();
void setIsFallbackImage() { m_isFallbackImage = true; }
@@ -141,12 +141,16 @@ class CORE_EXPORT HTMLImageElement final : public HTMLElement,
ExceptionState&) override;
protected:
+ enum class ContentType : uint8_t { Primary, Fallback, Collapsed };
+
explicit HTMLImageElement(Document&,
HTMLFormElement* = 0,
bool createdByParser = false);
void didMoveToNewDocument(Document& oldDocument) override;
- virtual bool useFallbackContent() const { return m_useFallbackContent; }
+ virtual bool useFallbackContent() const {
+ return m_contentType == ContentType::Fallback;
+ }
void didAddUserAgentShadowRoot(ShadowRoot&) override;
PassRefPtr<ComputedStyle> customStyleForLayoutObject() override;
@@ -163,6 +167,7 @@ class CORE_EXPORT HTMLImageElement final : public HTMLElement,
MutableStylePropertySet*) override;
void attachLayoutTree(const AttachContext& = AttachContext()) override;
+ bool layoutObjectIsNeeded(const ComputedStyle&) override;
LayoutObject* createLayoutObject(const ComputedStyle&) override;
bool canStartSelection() const override { return false; }
@@ -193,9 +198,9 @@ class CORE_EXPORT HTMLImageElement final : public HTMLElement,
AtomicString m_bestFitImageURL;
float m_imageDevicePixelRatio;
Member<HTMLSourceElement> m_source;
+ 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.
unsigned m_formWasSetByParser : 1;
unsigned m_elementCreatedByParser : 1;
- unsigned m_useFallbackContent : 1;
unsigned m_isFallbackImage : 1;
ReferrerPolicy m_referrerPolicy;

Powered by Google App Engine
This is Rietveld 408576698