| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef HTMLVideoElement_h | 26 #ifndef HTMLVideoElement_h |
| 27 #define HTMLVideoElement_h | 27 #define HTMLVideoElement_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/html/HTMLImageLoader.h" | 30 #include "core/html/HTMLImageLoader.h" |
| 31 #include "core/html/HTMLMediaElement.h" | 31 #include "core/html/HTMLMediaElement.h" |
| 32 #include "core/html/canvas/CanvasImageSource.h" | 32 #include "core/html/canvas/CanvasImageSource.h" |
| 33 #include "core/imagebitmap/ImageBitmapSource.h" |
| 33 #include "platform/graphics/GraphicsTypes3D.h" | 34 #include "platform/graphics/GraphicsTypes3D.h" |
| 34 | 35 |
| 35 class SkPaint; | 36 class SkPaint; |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 class WebGraphicsContext3D; | 39 class WebGraphicsContext3D; |
| 39 class ExceptionState; | 40 class ExceptionState; |
| 40 class GraphicsContext; | 41 class GraphicsContext; |
| 41 | 42 |
| 42 // GL types as defined in OpenGL ES 2.0 header file gl2.h from khronos.org. | 43 // GL types as defined in OpenGL ES 2.0 header file gl2.h from khronos.org. |
| 43 // That header cannot be included directly due to a conflict with NPAPI headers. | 44 // That header cannot be included directly due to a conflict with NPAPI headers. |
| 44 // See crbug.com/328085. | 45 // See crbug.com/328085. |
| 45 typedef unsigned GLenum; | 46 typedef unsigned GLenum; |
| 46 typedef int GC3Dint; | 47 typedef int GC3Dint; |
| 47 | 48 |
| 48 class CORE_EXPORT HTMLVideoElement final : public HTMLMediaElement, public Canva
sImageSource { | 49 class CORE_EXPORT HTMLVideoElement final : public HTMLMediaElement, public Canva
sImageSource, public ImageBitmapSource { |
| 49 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
| 50 public: | 51 public: |
| 51 static PassRefPtrWillBeRawPtr<HTMLVideoElement> create(Document&); | 52 static PassRefPtrWillBeRawPtr<HTMLVideoElement> create(Document&); |
| 52 DECLARE_VIRTUAL_TRACE(); | 53 DECLARE_VIRTUAL_TRACE(); |
| 53 | 54 |
| 54 unsigned videoWidth() const; | 55 unsigned videoWidth() const; |
| 55 unsigned videoHeight() const; | 56 unsigned videoHeight() const; |
| 56 | 57 |
| 57 // Fullscreen | 58 // Fullscreen |
| 58 void webkitEnterFullscreen(); | 59 void webkitEnterFullscreen(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 | 80 |
| 80 // CanvasImageSource implementation | 81 // CanvasImageSource implementation |
| 81 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt) const override; | 82 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt) const override; |
| 82 bool isVideoElement() const override { return true; } | 83 bool isVideoElement() const override { return true; } |
| 83 bool wouldTaintOrigin(SecurityOrigin*) const override; | 84 bool wouldTaintOrigin(SecurityOrigin*) const override; |
| 84 FloatSize elementSize() const override; | 85 FloatSize elementSize() const override; |
| 85 const KURL& sourceURL() const override { return currentSrc(); } | 86 const KURL& sourceURL() const override { return currentSrc(); } |
| 86 | 87 |
| 87 bool isHTMLVideoElement() const override { return true; } | 88 bool isHTMLVideoElement() const override { return true; } |
| 88 | 89 |
| 90 // ImageBitmapSource implementation |
| 91 IntSize bitmapSourceSize() const override; |
| 92 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy,
int sw, int sh, ExceptionState&) override; |
| 93 |
| 89 private: | 94 private: |
| 90 HTMLVideoElement(Document&); | 95 HTMLVideoElement(Document&); |
| 91 | 96 |
| 92 bool layoutObjectIsNeeded(const ComputedStyle&) override; | 97 bool layoutObjectIsNeeded(const ComputedStyle&) override; |
| 93 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 98 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| 94 void attach(const AttachContext& = AttachContext()) override; | 99 void attach(const AttachContext& = AttachContext()) override; |
| 95 void parseAttribute(const QualifiedName&, const AtomicString&) override; | 100 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 96 bool isPresentationAttribute(const QualifiedName&) const override; | 101 bool isPresentationAttribute(const QualifiedName&) const override; |
| 97 void collectStyleForPresentationAttribute(const QualifiedName&, const Atomic
String&, MutableStylePropertySet*) override; | 102 void collectStyleForPresentationAttribute(const QualifiedName&, const Atomic
String&, MutableStylePropertySet*) override; |
| 98 bool hasVideo() const override { return webMediaPlayer() && webMediaPlayer()
->hasVideo(); } | 103 bool hasVideo() const override { return webMediaPlayer() && webMediaPlayer()
->hasVideo(); } |
| 99 bool isURLAttribute(const Attribute&) const override; | 104 bool isURLAttribute(const Attribute&) const override; |
| 100 const AtomicString imageSourceURL() const override; | 105 const AtomicString imageSourceURL() const override; |
| 101 | 106 |
| 102 void updateDisplayState() override; | 107 void updateDisplayState() override; |
| 103 void didMoveToNewDocument(Document& oldDocument) override; | 108 void didMoveToNewDocument(Document& oldDocument) override; |
| 104 void setDisplayMode(DisplayMode) override; | 109 void setDisplayMode(DisplayMode) override; |
| 105 | 110 |
| 106 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader; | 111 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader; |
| 107 | 112 |
| 108 AtomicString m_defaultPosterURL; | 113 AtomicString m_defaultPosterURL; |
| 109 }; | 114 }; |
| 110 | 115 |
| 111 } // namespace blink | 116 } // namespace blink |
| 112 | 117 |
| 113 #endif // HTMLVideoElement_h | 118 #endif // HTMLVideoElement_h |
| OLD | NEW |