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 RefCountedWillBeRefCountedGarbageCollected<TextTrackCue>, public EventTargetWithInlineData {
45 REFCOUNTED_EVENT_TARGET(TextTrackCue);
46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TextTrackCue);
48 static const AtomicString& cueShadowPseudoId()
50 DEFINE_STATIC_LOCAL(const AtomicString, cue, ("cue", AtomicString::ConstructFromLiteral));
54 virtual ~TextTrackCue() { }
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 invalidateCueIndex();
76 using EventTarget::dispatchEvent;
77 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE;
80 void setIsActive(bool);
82 virtual void updateDisplay(const IntSize& videoSize, HTMLDivElement& container) = 0;
84 // FIXME: Consider refactoring to eliminate or merge the following three members.
85 // https://code.google.com/p/chromium/issues/detail?id=322434
86 virtual void updateDisplayTree(double movieTime) = 0;
87 virtual void removeDisplayTree() = 0;
88 virtual void notifyRegionWhenRemovingDisplayTree(bool notifyRegion) = 0;
90 virtual const AtomicString& interfaceName() const OVERRIDE;
93 virtual String toString() const = 0;
96 DEFINE_ATTRIBUTE_EVENT_LISTENER(enter);
97 DEFINE_ATTRIBUTE_EVENT_LISTENER(exit);
99 virtual void trace(Visitor*) OVERRIDE;
102 TextTrackCue(double start, double end);
104 void cueWillChange();
105 virtual void cueDidChange();
113 RawPtrWillBeMember<TextTrack> m_track;
116 bool m_pauseOnExit : 1;