2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
31 #include "RenderReplaced.h"
36 class HTMLInputElement
;
37 class HTMLMediaElement
;
38 class MediaControlMuteButtonElement
;
39 class MediaControlPlayButtonElement
;
40 class MediaControlSeekButtonElement
;
41 class MediaControlTimelineElement
;
42 class MediaControlFullscreenButtonElement
;
43 class MediaTimeDisplayElement
;
46 class RenderMedia
: public RenderReplaced
{
48 RenderMedia(HTMLMediaElement
*);
49 RenderMedia(HTMLMediaElement
*, const IntSize
& intrinsicSize
);
50 virtual ~RenderMedia();
52 virtual RenderObject
* firstChild() const;
53 virtual RenderObject
* lastChild() const;
54 virtual void removeChild(RenderObject
*);
55 virtual void destroy();
57 virtual void layout();
59 virtual const char* renderName() const { return "RenderMedia"; }
60 virtual bool isMedia() const { return true; }
62 HTMLMediaElement
* mediaElement() const;
63 MediaPlayer
* player() const;
65 static String
formatTime(float time
);
67 void updateFromElement();
69 void updateControls();
70 void updateTimeDisplay();
72 void forwardEvent(Event
*);
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;
79 void createControlsShadowRoot();
80 void destroyControlsShadowRoot();
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();
92 void timeUpdateTimerFired(Timer
<RenderMedia
>*);
94 void updateControlVisibility();
95 void changeOpacity(HTMLElement
*, float opacity
);
96 void opacityAnimationTimerFired(Timer
<RenderMedia
>*);
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
;
112 Timer
<RenderMedia
> m_timeUpdateTimer
;
113 Timer
<RenderMedia
> m_opacityAnimationTimer
;
115 double m_opacityAnimationStartTime
;
116 float m_opacityAnimationFrom
;
117 float m_opacityAnimationTo
;
118 EVisibility m_previousVisible
;
121 } // namespace WebCore
124 #endif // RenderMedia_h