2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef TextTrackCue_h
33 #define TextTrackCue_h
35 #include "core/events/EventTarget.h"
36 #include "core/html/HTMLDivElement.h"
37 #include "platform/heap/Handle.h"
38 #include "wtf/RefCounted.h"
44 class TextTrackCue
: public RefCountedGarbageCollectedEventTargetWithInlineData
<TextTrackCue
> {
45 DEFINE_WRAPPERTYPEINFO();
46 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(TextTrackCue
);
48 static const AtomicString
& cueShadowPseudoId()
50 DEFINE_STATIC_LOCAL(const AtomicString
, cue
, ("cue", AtomicString::ConstructFromLiteral
));
54 ~TextTrackCue() override
{ }
56 TextTrack
* track() const;
57 void setTrack(TextTrack
*);
61 const AtomicString
& id() const { return m_id
; }
62 void setId(const AtomicString
&);
64 double startTime() const { return m_startTime
; }
65 void setStartTime(double);
67 double endTime() const { return m_endTime
; }
68 void setEndTime(double);
70 bool pauseOnExit() const { return m_pauseOnExit
; }
71 void setPauseOnExit(bool);
74 void updateCueIndex(unsigned cueIndex
) { m_cueIndex
= cueIndex
; }
75 void invalidateCueIndex();
77 bool isActive() const { return m_isActive
; }
78 void setIsActive(bool active
) { m_isActive
= active
; }
80 // Updates the display tree and appends it to container if it has not
81 // already been added.
82 virtual void updateDisplay(HTMLDivElement
& container
) = 0;
84 // Marks the nodes of the display tree as past or future relative to
85 // movieTime. If updateDisplay() has not been called there is no display
86 // tree and nothing is done.
87 virtual void updatePastAndFutureNodes(double movieTime
) = 0;
89 // FIXME: Refactor to eliminate removeDisplayTree(). https://crbug.com/322434
90 enum RemovalNotification
{
94 virtual void removeDisplayTree(RemovalNotification
= NotifyRegion
) = 0;
96 const AtomicString
& interfaceName() const override
;
99 virtual String
toString() const = 0;
102 DEFINE_ATTRIBUTE_EVENT_LISTENER(enter
);
103 DEFINE_ATTRIBUTE_EVENT_LISTENER(exit
);
105 DECLARE_VIRTUAL_TRACE();
108 TextTrackCue(double start
, double end
);
110 void cueWillChange();
111 virtual void cueDidChange();
112 bool dispatchEventInternal(PassRefPtrWillBeRawPtr
<Event
>) override
;
119 Member
<TextTrack
> m_track
;
124 bool m_pauseOnExit
: 1;
129 #endif // TextTrackCue_h