Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 11 matching lines...) Expand all Loading... | |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #ifndef HTMLImageElement_h | 24 #ifndef HTMLImageElement_h |
| 25 #define HTMLImageElement_h | 25 #define HTMLImageElement_h |
| 26 | 26 |
| 27 #include "bindings/core/v8/ActiveScriptWrappable.h" | 27 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
| 29 #include "core/html/FormAssociated.h" | 29 #include "core/html/FormAssociated.h" |
| 30 #include "core/html/HTMLElement.h" | 30 #include "core/html/HTMLElement.h" |
| 31 #include "core/html/HTMLImageLoader.h" | 31 #include "core/html/HTMLImageLoader.h" |
| 32 #include "core/html/canvas/CanvasImageSource.h" | 32 #include "core/html/canvas/CanvasImageElementSource.h" |
| 33 #include "core/imagebitmap/ImageBitmapSource.h" | 33 #include "core/imagebitmap/ImageBitmapSource.h" |
| 34 #include "platform/graphics/GraphicsTypes.h" | 34 #include "platform/graphics/GraphicsTypes.h" |
| 35 #include "platform/loader/fetch/FetchRequest.h" | 35 #include "platform/loader/fetch/FetchRequest.h" |
| 36 #include "platform/network/ResourceResponse.h" | 36 #include "platform/network/ResourceResponse.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class HTMLFormElement; | 40 class HTMLFormElement; |
| 41 class ImageCandidate; | 41 class ImageCandidate; |
| 42 class ShadowRoot; | 42 class ShadowRoot; |
| 43 class ImageBitmapOptions; | 43 class ImageBitmapOptions; |
| 44 | 44 |
| 45 class CORE_EXPORT HTMLImageElement final | 45 class CORE_EXPORT HTMLImageElement final |
| 46 : public HTMLElement, | 46 : public HTMLElement, |
| 47 public CanvasImageSource, | 47 public CanvasImageElementSource, |
| 48 public ImageBitmapSource, | 48 public ImageBitmapSource, |
| 49 public ActiveScriptWrappable<HTMLImageElement>, | 49 public ActiveScriptWrappable<HTMLImageElement>, |
| 50 public FormAssociated { | 50 public FormAssociated { |
| 51 DEFINE_WRAPPERTYPEINFO(); | 51 DEFINE_WRAPPERTYPEINFO(); |
| 52 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement); | 52 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement); |
| 53 | 53 |
| 54 public: | 54 public: |
| 55 class ViewportChangeListener; | 55 class ViewportChangeListener; |
| 56 | 56 |
| 57 static HTMLImageElement* create(Document&); | 57 static HTMLImageElement* create(Document&); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 109 |
| 110 const AtomicString imageSourceURL() const override; | 110 const AtomicString imageSourceURL() const override; |
| 111 | 111 |
| 112 HTMLFormElement* formOwner() const override; | 112 HTMLFormElement* formOwner() const override; |
| 113 void formRemovedFromTree(const Node& formRoot); | 113 void formRemovedFromTree(const Node& formRoot); |
| 114 virtual void ensureCollapsedOrFallbackContent(); | 114 virtual void ensureCollapsedOrFallbackContent(); |
| 115 virtual void ensureFallbackForGeneratedContent(); | 115 virtual void ensureFallbackForGeneratedContent(); |
| 116 virtual void ensurePrimaryContent(); | 116 virtual void ensurePrimaryContent(); |
| 117 bool isCollapsed() const; | 117 bool isCollapsed() const; |
| 118 | 118 |
| 119 // CanvasImageSource implementation | 119 // CanvasImageSource interface implementation. |
| 120 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, | 120 FloatSize sourceDefaultSize() override; |
| 121 AccelerationHint, | |
| 122 SnapshotReason, | |
| 123 const FloatSize&) const override; | |
| 124 bool isSVGSource() const override; | |
| 125 bool wouldTaintOrigin(SecurityOrigin*) const override; | |
| 126 FloatSize elementSize(const FloatSize&) const override; | |
| 127 FloatSize defaultDestinationSize(const FloatSize&) const override; | 121 FloatSize defaultDestinationSize(const FloatSize&) const override; |
| 128 const KURL& sourceURL() const override; | |
| 129 bool isAccelerated() const override { return false; } | |
| 130 bool isOpaque() const override; | |
| 131 int sourceWidth() override; | |
| 132 int sourceHeight() override; | |
| 133 | 122 |
| 134 // public so that HTMLPictureElement can call this as well. | 123 // public so that HTMLPictureElement can call this as well. |
| 135 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); | 124 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); |
| 136 | 125 |
| 137 void setIsFallbackImage() { m_isFallbackImage = true; } | 126 void setIsFallbackImage() { m_isFallbackImage = true; } |
| 138 | 127 |
| 139 FetchRequest::ResourceWidth getResourceWidth(); | 128 FetchRequest::ResourceWidth getResourceWidth(); |
| 140 float sourceSize(Element&); | 129 float sourceSize(Element&); |
| 141 | 130 |
| 142 void forceReload() const; | 131 void forceReload() const; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 190 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 202 void removedFrom(ContainerNode*) override; | 191 void removedFrom(ContainerNode*) override; |
| 203 bool shouldRegisterAsNamedItem() const override { return true; } | 192 bool shouldRegisterAsNamedItem() const override { return true; } |
| 204 bool shouldRegisterAsExtraNamedItem() const override { return true; } | 193 bool shouldRegisterAsExtraNamedItem() const override { return true; } |
| 205 bool isInteractiveContent() const override; | 194 bool isInteractiveContent() const override; |
| 206 Image* imageContents() override; | 195 Image* imageContents() override; |
| 207 | 196 |
| 208 void resetFormOwner(); | 197 void resetFormOwner(); |
| 209 ImageCandidate findBestFitImageFromPictureParent(); | 198 ImageCandidate findBestFitImageFromPictureParent(); |
| 210 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); | 199 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); |
| 211 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } | 200 HTMLImageLoader& imageLoader() const override { return *m_imageLoader; } |
|
fs
2017/03/07 22:01:24
(This is a bit scary-looking, hopefully it's futur
fserb
2017/03/21 19:15:22
I double checked with some people and nobody could
fs
2017/03/21 21:05:41
Ok.
| |
| 212 void notifyViewportChanged(); | 201 void notifyViewportChanged(); |
| 213 void createMediaQueryListIfDoesNotExist(); | 202 void createMediaQueryListIfDoesNotExist(); |
| 214 | 203 |
| 215 Member<HTMLImageLoader> m_imageLoader; | 204 Member<HTMLImageLoader> m_imageLoader; |
| 216 Member<ViewportChangeListener> m_listener; | 205 Member<ViewportChangeListener> m_listener; |
| 217 Member<HTMLFormElement> m_form; | 206 Member<HTMLFormElement> m_form; |
| 218 AtomicString m_bestFitImageURL; | 207 AtomicString m_bestFitImageURL; |
| 219 float m_imageDevicePixelRatio; | 208 float m_imageDevicePixelRatio; |
| 220 Member<HTMLSourceElement> m_source; | 209 Member<HTMLSourceElement> m_source; |
| 221 LayoutDisposition m_layoutDisposition; | 210 LayoutDisposition m_layoutDisposition; |
| 222 unsigned m_formWasSetByParser : 1; | 211 unsigned m_formWasSetByParser : 1; |
| 223 unsigned m_elementCreatedByParser : 1; | 212 unsigned m_elementCreatedByParser : 1; |
| 224 unsigned m_isFallbackImage : 1; | 213 unsigned m_isFallbackImage : 1; |
| 225 | 214 |
| 226 ReferrerPolicy m_referrerPolicy; | 215 ReferrerPolicy m_referrerPolicy; |
| 227 }; | 216 }; |
| 228 | 217 |
| 229 } // namespace blink | 218 } // namespace blink |
| 230 | 219 |
| 231 #endif // HTMLImageElement_h | 220 #endif // HTMLImageElement_h |
| OLD | NEW |