]>
Commit | Line | Data |
---|---|---|
a90939db JF |
1 | /* |
2 | * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
7 | * 1. Redistributions of source code must retain the above copyright | |
8 | * notice, this list of conditions and the following disclaimer. | |
9 | * 2. Redistributions in binary form must reproduce the above copyright | |
10 | * notice, this list of conditions and the following disclaimer in the | |
11 | * documentation and/or other materials provided with the distribution. | |
12 | * | |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | */ | |
25 | ||
26 | #ifndef RenderMedia_h | |
27 | #define RenderMedia_h | |
28 | ||
29 | #if ENABLE(VIDEO) | |
30 | ||
31 | #include "RenderReplaced.h" | |
32 | #include "Timer.h" | |
33 | ||
34 | namespace WebCore { | |
35 | ||
36 | class HTMLInputElement; | |
37 | class HTMLMediaElement; | |
38 | class MediaControlMuteButtonElement; | |
39 | class MediaControlPlayButtonElement; | |
40 | class MediaControlSeekButtonElement; | |
41 | class MediaControlTimelineElement; | |
42 | class MediaControlFullscreenButtonElement; | |
43 | class MediaTimeDisplayElement; | |
44 | class MediaPlayer; | |
45 | ||
46 | class RenderMedia : public RenderReplaced { | |
47 | public: | |
48 | RenderMedia(HTMLMediaElement*); | |
49 | RenderMedia(HTMLMediaElement*, const IntSize& intrinsicSize); | |
50 | virtual ~RenderMedia(); | |
51 | ||
52 | virtual RenderObject* firstChild() const; | |
53 | virtual RenderObject* lastChild() const; | |
54 | virtual void removeChild(RenderObject*); | |
55 | virtual void destroy(); | |
56 | ||
57 | virtual void layout(); | |
58 | ||
59 | virtual const char* renderName() const { return "RenderMedia"; } | |
60 | virtual bool isMedia() const { return true; } | |
61 | ||
62 | HTMLMediaElement* mediaElement() const; | |
63 | MediaPlayer* player() const; | |
64 | ||
65 | static String formatTime(float time); | |
66 | ||
67 | void updateFromElement(); | |
68 | void updatePlayer(); | |
69 | void updateControls(); | |
70 | void updateTimeDisplay(); | |
71 | ||
72 | void forwardEvent(Event*); | |
73 | ||
74 | virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const; | |
75 | virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const; | |
76 | virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const; | |
77 | ||
78 | private: | |
79 | void createControlsShadowRoot(); | |
80 | void destroyControlsShadowRoot(); | |
81 | void createPanel(); | |
82 | void createMuteButton(); | |
83 | void createPlayButton(); | |
84 | void createSeekBackButton(); | |
85 | void createSeekForwardButton(); | |
86 | void createTimelineContainer(); | |
87 | void createTimeline(); | |
88 | void createCurrentTimeDisplay(); | |
89 | void createTimeRemainingDisplay(); | |
90 | void createFullscreenButton(); | |
91 | ||
92 | void timeUpdateTimerFired(Timer<RenderMedia>*); | |
93 | ||
94 | void updateControlVisibility(); | |
95 | void changeOpacity(HTMLElement*, float opacity); | |
96 | void opacityAnimationTimerFired(Timer<RenderMedia>*); | |
97 | ||
98 | RefPtr<HTMLElement> m_controlsShadowRoot; | |
99 | RefPtr<HTMLElement> m_panel; | |
100 | RefPtr<MediaControlMuteButtonElement> m_muteButton; | |
101 | RefPtr<MediaControlPlayButtonElement> m_playButton; | |
102 | RefPtr<MediaControlSeekButtonElement> m_seekBackButton; | |
103 | RefPtr<MediaControlSeekButtonElement> m_seekForwardButton; | |
104 | RefPtr<MediaControlTimelineElement> m_timeline; | |
105 | RefPtr<MediaControlFullscreenButtonElement> m_fullscreenButton; | |
106 | RefPtr<HTMLElement> m_timelineContainer; | |
107 | RefPtr<MediaTimeDisplayElement> m_currentTimeDisplay; | |
108 | RefPtr<MediaTimeDisplayElement> m_timeRemainingDisplay; | |
109 | EventTargetNode* m_lastUnderNode; | |
110 | EventTargetNode* m_nodeUnderMouse; | |
111 | ||
112 | Timer<RenderMedia> m_timeUpdateTimer; | |
113 | Timer<RenderMedia> m_opacityAnimationTimer; | |
114 | bool m_mouseOver; | |
115 | double m_opacityAnimationStartTime; | |
116 | float m_opacityAnimationFrom; | |
117 | float m_opacityAnimationTo; | |
118 | EVisibility m_previousVisible; | |
119 | }; | |
120 | ||
121 | } // namespace WebCore | |
122 | ||
123 | #endif | |
124 | #endif // RenderMedia_h |