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 13 matching lines...) Expand all Loading... | |
| 24 #ifndef HTMLImageElement_h | 24 #ifndef HTMLImageElement_h |
| 25 #define HTMLImageElement_h | 25 #define HTMLImageElement_h |
| 26 | 26 |
| 27 #include "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
| 28 #include "core/html/FormAssociated.h" | 28 #include "core/html/FormAssociated.h" |
| 29 #include "core/html/HTMLElement.h" | 29 #include "core/html/HTMLElement.h" |
| 30 #include "core/html/HTMLImageLoader.h" | 30 #include "core/html/HTMLImageLoader.h" |
| 31 #include "core/html/canvas/ImageElementBase.h" | 31 #include "core/html/canvas/ImageElementBase.h" |
| 32 #include "platform/bindings/ActiveScriptWrappable.h" | 32 #include "platform/bindings/ActiveScriptWrappable.h" |
| 33 #include "platform/graphics/GraphicsTypes.h" | 33 #include "platform/graphics/GraphicsTypes.h" |
| 34 #include "platform/heap/HeapAllocator.h" | |
| 34 #include "platform/loader/fetch/FetchParameters.h" | 35 #include "platform/loader/fetch/FetchParameters.h" |
| 35 #include "platform/loader/fetch/ResourceResponse.h" | 36 #include "platform/loader/fetch/ResourceResponse.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 class HTMLFormElement; | 40 class HTMLFormElement; |
| 40 class ImageCandidate; | 41 class ImageCandidate; |
| 41 class ShadowRoot; | 42 class ShadowRoot; |
| 42 | 43 |
| 43 class CORE_EXPORT HTMLImageElement final | 44 class CORE_EXPORT HTMLImageElement final |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 void setHeight(unsigned); | 93 void setHeight(unsigned); |
| 93 | 94 |
| 94 KURL Src() const; | 95 KURL Src() const; |
| 95 void SetSrc(const String&); | 96 void SetSrc(const String&); |
| 96 | 97 |
| 97 void setWidth(unsigned); | 98 void setWidth(unsigned); |
| 98 | 99 |
| 99 int x() const; | 100 int x() const; |
| 100 int y() const; | 101 int y() const; |
| 101 | 102 |
| 103 ScriptPromise decode(ScriptState*, ExceptionState&); | |
| 104 | |
| 102 bool complete() const; | 105 bool complete() const; |
| 103 | 106 |
| 104 bool HasPendingActivity() const final { | 107 bool HasPendingActivity() const final { |
| 105 return GetImageLoader().HasPendingActivity(); | 108 return GetImageLoader().HasPendingActivity(); |
| 106 } | 109 } |
| 107 | 110 |
| 108 bool CanContainRangeEndPoint() const override { return false; } | 111 bool CanContainRangeEndPoint() const override { return false; } |
| 109 | 112 |
| 110 const AtomicString ImageSourceURL() const override; | 113 const AtomicString ImageSourceURL() const override; |
| 111 | 114 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 126 void SetIsFallbackImage() { is_fallback_image_ = true; } | 129 void SetIsFallbackImage() { is_fallback_image_ = true; } |
| 127 | 130 |
| 128 FetchParameters::ResourceWidth GetResourceWidth(); | 131 FetchParameters::ResourceWidth GetResourceWidth(); |
| 129 float SourceSize(Element&); | 132 float SourceSize(Element&); |
| 130 | 133 |
| 131 void ForceReload() const; | 134 void ForceReload() const; |
| 132 | 135 |
| 133 FormAssociated* ToFormAssociatedOrNull() override { return this; }; | 136 FormAssociated* ToFormAssociatedOrNull() override { return this; }; |
| 134 void AssociateWith(HTMLFormElement*) override; | 137 void AssociateWith(HTMLFormElement*) override; |
| 135 | 138 |
| 139 void ImageNotifyFinished(bool success); | |
| 140 | |
| 136 protected: | 141 protected: |
| 137 // Controls how an image element appears in the layout. See: | 142 // Controls how an image element appears in the layout. See: |
| 138 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request | 143 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request |
| 139 enum class LayoutDisposition : uint8_t { | 144 enum class LayoutDisposition : uint8_t { |
| 140 // Displayed as a partially or completely loaded image. Corresponds to the | 145 // Displayed as a partially or completely loaded image. Corresponds to the |
| 141 // `current request` state being: `unavailable`, `partially available`, or | 146 // `current request` state being: `unavailable`, `partially available`, or |
| 142 // `completely available`. | 147 // `completely available`. |
| 143 kPrimaryContent, | 148 kPrimaryContent, |
| 144 // Showing a broken image icon and 'alt' text, if any. Corresponds to the | 149 // Showing a broken image icon and 'alt' text, if any. Corresponds to the |
| 145 // `current request` being in the `broken` state. | 150 // `current request` being in the `broken` state. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 | 183 |
| 179 bool draggable() const override; | 184 bool draggable() const override; |
| 180 | 185 |
| 181 InsertionNotificationRequest InsertedInto(ContainerNode*) override; | 186 InsertionNotificationRequest InsertedInto(ContainerNode*) override; |
| 182 void RemovedFrom(ContainerNode*) override; | 187 void RemovedFrom(ContainerNode*) override; |
| 183 bool ShouldRegisterAsNamedItem() const override { return true; } | 188 bool ShouldRegisterAsNamedItem() const override { return true; } |
| 184 bool ShouldRegisterAsExtraNamedItem() const override { return true; } | 189 bool ShouldRegisterAsExtraNamedItem() const override { return true; } |
| 185 bool IsInteractiveContent() const override; | 190 bool IsInteractiveContent() const override; |
| 186 Image* ImageContents() override; | 191 Image* ImageContents() override; |
| 187 | 192 |
| 193 void RequestDecode(); | |
| 194 void DidDecode(uint32_t sequence_id, bool success); | |
|
pdr.
2017/05/18 03:20:10
Can you add some short comments here and above Req
vmpstr
2017/05/18 18:51:13
Done.
| |
| 195 | |
| 188 void ResetFormOwner(); | 196 void ResetFormOwner(); |
| 189 ImageCandidate FindBestFitImageFromPictureParent(); | 197 ImageCandidate FindBestFitImageFromPictureParent(); |
| 190 void SetBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); | 198 void SetBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); |
| 191 HTMLImageLoader& GetImageLoader() const override { return *image_loader_; } | 199 HTMLImageLoader& GetImageLoader() const override { return *image_loader_; } |
| 192 void NotifyViewportChanged(); | 200 void NotifyViewportChanged(); |
| 193 void CreateMediaQueryListIfDoesNotExist(); | 201 void CreateMediaQueryListIfDoesNotExist(); |
| 194 | 202 |
| 195 Member<HTMLImageLoader> image_loader_; | 203 Member<HTMLImageLoader> image_loader_; |
| 196 Member<ViewportChangeListener> listener_; | 204 Member<ViewportChangeListener> listener_; |
| 197 Member<HTMLFormElement> form_; | 205 Member<HTMLFormElement> form_; |
| 198 AtomicString best_fit_image_url_; | 206 AtomicString best_fit_image_url_; |
| 199 float image_device_pixel_ratio_; | 207 float image_device_pixel_ratio_; |
| 200 Member<HTMLSourceElement> source_; | 208 Member<HTMLSourceElement> source_; |
| 201 LayoutDisposition layout_disposition_; | 209 LayoutDisposition layout_disposition_; |
| 210 HeapVector<Member<ScriptPromiseResolver>> decode_promise_resolvers_; | |
| 211 uint32_t decode_sequence_id_; | |
| 202 unsigned form_was_set_by_parser_ : 1; | 212 unsigned form_was_set_by_parser_ : 1; |
| 203 unsigned element_created_by_parser_ : 1; | 213 unsigned element_created_by_parser_ : 1; |
| 204 unsigned is_fallback_image_ : 1; | 214 unsigned is_fallback_image_ : 1; |
| 205 | 215 |
| 206 ReferrerPolicy referrer_policy_; | 216 ReferrerPolicy referrer_policy_; |
| 207 }; | 217 }; |
| 208 | 218 |
| 209 } // namespace blink | 219 } // namespace blink |
| 210 | 220 |
| 211 #endif // HTMLImageElement_h | 221 #endif // HTMLImageElement_h |
| OLD | NEW |