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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 LayoutDisposition : uint8_t { | |
| 145 PrimaryContent, | |
|
dominicc (has gone to gerrit)
2016/12/05 03:30:55
It would be splendid to have some comments explain
engedy
2016/12/06 15:27:57
Done.
| |
| 146 FallbackContent, | |
| 147 Collapsed | |
| 148 }; | |
| 149 | |
| 144 explicit HTMLImageElement(Document&, | 150 explicit HTMLImageElement(Document&, |
| 145 HTMLFormElement* = 0, | 151 HTMLFormElement* = 0, |
| 146 bool createdByParser = false); | 152 bool createdByParser = false); |
| 147 | 153 |
| 148 void didMoveToNewDocument(Document& oldDocument) override; | 154 void didMoveToNewDocument(Document& oldDocument) override; |
| 149 virtual bool useFallbackContent() const { return m_useFallbackContent; } | 155 virtual bool useFallbackContent() const { |
| 156 return m_layoutDisposition == LayoutDisposition::FallbackContent; | |
| 157 } | |
| 150 | 158 |
| 151 void didAddUserAgentShadowRoot(ShadowRoot&) override; | 159 void didAddUserAgentShadowRoot(ShadowRoot&) override; |
| 152 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; | 160 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; |
| 153 | 161 |
| 154 private: | 162 private: |
| 155 bool areAuthorShadowsAllowed() const override { return false; } | 163 bool areAuthorShadowsAllowed() const override { return false; } |
| 156 | 164 |
| 157 void parseAttribute(const QualifiedName&, | 165 void parseAttribute(const QualifiedName&, |
| 158 const AtomicString&, | 166 const AtomicString&, |
| 159 const AtomicString&) override; | 167 const AtomicString&) override; |
| 160 bool isPresentationAttribute(const QualifiedName&) const override; | 168 bool isPresentationAttribute(const QualifiedName&) const override; |
| 161 void collectStyleForPresentationAttribute(const QualifiedName&, | 169 void collectStyleForPresentationAttribute(const QualifiedName&, |
| 162 const AtomicString&, | 170 const AtomicString&, |
| 163 MutableStylePropertySet*) override; | 171 MutableStylePropertySet*) override; |
| 164 | 172 |
| 165 void attachLayoutTree(const AttachContext& = AttachContext()) override; | 173 void attachLayoutTree(const AttachContext& = AttachContext()) override; |
| 174 bool layoutObjectIsNeeded(const ComputedStyle&) override; | |
| 166 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 175 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| 167 | 176 |
| 168 bool canStartSelection() const override { return false; } | 177 bool canStartSelection() const override { return false; } |
| 169 | 178 |
| 170 bool isURLAttribute(const Attribute&) const override; | 179 bool isURLAttribute(const Attribute&) const override; |
| 171 bool hasLegalLinkAttribute(const QualifiedName&) const override; | 180 bool hasLegalLinkAttribute(const QualifiedName&) const override; |
| 172 const QualifiedName& subResourceAttributeName() const override; | 181 const QualifiedName& subResourceAttributeName() const override; |
| 173 | 182 |
| 174 bool draggable() const override; | 183 bool draggable() const override; |
| 175 | 184 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 186 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } | 195 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } |
| 187 void notifyViewportChanged(); | 196 void notifyViewportChanged(); |
| 188 void createMediaQueryListIfDoesNotExist(); | 197 void createMediaQueryListIfDoesNotExist(); |
| 189 | 198 |
| 190 Member<HTMLImageLoader> m_imageLoader; | 199 Member<HTMLImageLoader> m_imageLoader; |
| 191 Member<ViewportChangeListener> m_listener; | 200 Member<ViewportChangeListener> m_listener; |
| 192 Member<HTMLFormElement> m_form; | 201 Member<HTMLFormElement> m_form; |
| 193 AtomicString m_bestFitImageURL; | 202 AtomicString m_bestFitImageURL; |
| 194 float m_imageDevicePixelRatio; | 203 float m_imageDevicePixelRatio; |
| 195 Member<HTMLSourceElement> m_source; | 204 Member<HTMLSourceElement> m_source; |
| 205 LayoutDisposition m_layoutDisposition; | |
| 196 unsigned m_formWasSetByParser : 1; | 206 unsigned m_formWasSetByParser : 1; |
| 197 unsigned m_elementCreatedByParser : 1; | 207 unsigned m_elementCreatedByParser : 1; |
| 198 unsigned m_useFallbackContent : 1; | |
| 199 unsigned m_isFallbackImage : 1; | 208 unsigned m_isFallbackImage : 1; |
| 200 | 209 |
| 201 ReferrerPolicy m_referrerPolicy; | 210 ReferrerPolicy m_referrerPolicy; |
| 202 }; | 211 }; |
| 203 | 212 |
| 204 } // namespace blink | 213 } // namespace blink |
| 205 | 214 |
| 206 #endif // HTMLImageElement_h | 215 #endif // HTMLImageElement_h |
| OLD | NEW |