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 "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
| 28 #include "core/fetch/FetchRequest.h" | 28 #include "core/fetch/FetchRequest.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/CanvasImageSource.h" | 31 #include "core/html/canvas/CanvasImageSource.h" |
| 32 #include "core/imagebitmap/ImageBitmapSource.h" | |
| 32 #include "platform/graphics/GraphicsTypes.h" | 33 #include "platform/graphics/GraphicsTypes.h" |
| 33 #include "platform/network/ResourceResponse.h" | 34 #include "platform/network/ResourceResponse.h" |
| 34 #include "wtf/WeakPtr.h" | 35 #include "wtf/WeakPtr.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 class HTMLFormElement; | 39 class HTMLFormElement; |
| 39 class ImageCandidate; | 40 class ImageCandidate; |
| 40 class ShadowRoot; | 41 class ShadowRoot; |
| 41 | 42 |
| 42 class CORE_EXPORT HTMLImageElement final : public HTMLElement, public CanvasImag eSource { | 43 class CORE_EXPORT HTMLImageElement final : public HTMLElement, public CanvasImag eSource, public ImageBitmapSource { |
| 43 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
| 44 public: | 45 public: |
| 45 class ViewportChangeListener; | 46 class ViewportChangeListener; |
| 46 | 47 |
| 47 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&); | 48 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&); |
| 48 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&, HTMLFormEl ement*, bool createdByParser); | 49 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&, HTMLFormEl ement*, bool createdByParser); |
| 49 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum ent&); | 50 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum ent&); |
| 50 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum ent&, int width); | 51 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum ent&, int width); |
| 51 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum ent&, int width, int height); | 52 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum ent&, int width, int height); |
| 52 | 53 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); | 109 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); |
| 109 void reattachFallbackContent(); | 110 void reattachFallbackContent(); |
| 110 void setUseFallbackContent(); | 111 void setUseFallbackContent(); |
| 111 void setIsFallbackImage() { m_isFallbackImage = true; } | 112 void setIsFallbackImage() { m_isFallbackImage = true; } |
| 112 | 113 |
| 113 FetchRequest::ResourceWidth resourceWidth(); | 114 FetchRequest::ResourceWidth resourceWidth(); |
| 114 float sourceSize(Element&); | 115 float sourceSize(Element&); |
| 115 | 116 |
| 116 void forceReload() const; | 117 void forceReload() const; |
| 117 | 118 |
| 119 // ImageBitmapSource implementation | |
| 120 IntSize bitmapSourceSize() override { return IntSize(width(), height()); } | |
|
xidachen
2015/11/25 17:01:54
This implementation of bitmapSourceSize will be ch
| |
| 121 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageBitmapSourc e*, int sx, int sy, int sw, int sh, ExceptionState&) override; | |
| 122 | |
| 118 protected: | 123 protected: |
| 119 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar ser = false); | 124 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar ser = false); |
| 120 | 125 |
| 121 void didMoveToNewDocument(Document& oldDocument) override; | 126 void didMoveToNewDocument(Document& oldDocument) override; |
| 122 virtual bool useFallbackContent() const { return m_useFallbackContent; } | 127 virtual bool useFallbackContent() const { return m_useFallbackContent; } |
| 123 | 128 |
| 124 void didAddUserAgentShadowRoot(ShadowRoot&) override; | 129 void didAddUserAgentShadowRoot(ShadowRoot&) override; |
| 125 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; | 130 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; |
| 126 private: | 131 private: |
| 127 bool areAuthorShadowsAllowed() const override { return false; } | 132 bool areAuthorShadowsAllowed() const override { return false; } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 unsigned m_intrinsicSizingViewportDependant : 1; | 172 unsigned m_intrinsicSizingViewportDependant : 1; |
| 168 unsigned m_useFallbackContent : 1; | 173 unsigned m_useFallbackContent : 1; |
| 169 unsigned m_isFallbackImage : 1; | 174 unsigned m_isFallbackImage : 1; |
| 170 | 175 |
| 171 ReferrerPolicy m_referrerPolicy; | 176 ReferrerPolicy m_referrerPolicy; |
| 172 }; | 177 }; |
| 173 | 178 |
| 174 } // namespace blink | 179 } // namespace blink |
| 175 | 180 |
| 176 #endif // HTMLImageElement_h | 181 #endif // HTMLImageElement_h |
| OLD | NEW |