OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef TextTrackRegion_h | 31 #ifndef VTTRegion_h |
32 #define TextTrackRegion_h | 32 #define VTTRegion_h |
33 | 33 |
34 #include "core/dom/ContextLifecycleObserver.h" | 34 #include "core/dom/ContextLifecycleObserver.h" |
35 #include "core/html/track/TextTrack.h" | 35 #include "core/html/track/TextTrack.h" |
36 #include "platform/Timer.h" | 36 #include "platform/Timer.h" |
37 #include "platform/geometry/FloatPoint.h" | 37 #include "platform/geometry/FloatPoint.h" |
38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 class ExceptionState; | 43 class ExceptionState; |
44 class HTMLDivElement; | 44 class HTMLDivElement; |
45 class TextTrackCueBox; | 45 class TextTrackCueBox; |
46 | 46 |
47 class TextTrackRegion : public RefCounted<TextTrackRegion> { | 47 class VTTRegion : public RefCounted<VTTRegion> { |
48 public: | 48 public: |
49 static PassRefPtr<TextTrackRegion> create() | 49 static PassRefPtr<VTTRegion> create() |
50 { | 50 { |
51 return adoptRef(new TextTrackRegion()); | 51 return adoptRef(new VTTRegion()); |
52 } | 52 } |
53 | 53 |
54 virtual ~TextTrackRegion(); | 54 virtual ~VTTRegion(); |
55 | 55 |
56 TextTrack* track() const { return m_track; } | 56 TextTrack* track() const { return m_track; } |
57 void setTrack(TextTrack*); | 57 void setTrack(TextTrack*); |
58 | 58 |
59 const String& id() const { return m_id; } | 59 const String& id() const { return m_id; } |
60 void setId(const String&); | 60 void setId(const String&); |
61 | 61 |
62 double width() const { return m_width; } | 62 double width() const { return m_width; } |
63 void setWidth(double, ExceptionState&); | 63 void setWidth(double, ExceptionState&); |
64 | 64 |
65 long height() const { return m_heightInLines; } | 65 long height() const { return m_heightInLines; } |
66 void setHeight(long, ExceptionState&); | 66 void setHeight(long, ExceptionState&); |
67 | 67 |
68 double regionAnchorX() const { return m_regionAnchor.x(); } | 68 double regionAnchorX() const { return m_regionAnchor.x(); } |
69 void setRegionAnchorX(double, ExceptionState&); | 69 void setRegionAnchorX(double, ExceptionState&); |
70 | 70 |
71 double regionAnchorY() const { return m_regionAnchor.y(); } | 71 double regionAnchorY() const { return m_regionAnchor.y(); } |
72 void setRegionAnchorY(double, ExceptionState&); | 72 void setRegionAnchorY(double, ExceptionState&); |
73 | 73 |
74 double viewportAnchorX() const { return m_viewportAnchor.x(); } | 74 double viewportAnchorX() const { return m_viewportAnchor.x(); } |
75 void setViewportAnchorX(double, ExceptionState&); | 75 void setViewportAnchorX(double, ExceptionState&); |
76 | 76 |
77 double viewportAnchorY() const { return m_viewportAnchor.y(); } | 77 double viewportAnchorY() const { return m_viewportAnchor.y(); } |
78 void setViewportAnchorY(double, ExceptionState&); | 78 void setViewportAnchorY(double, ExceptionState&); |
79 | 79 |
80 const AtomicString scroll() const; | 80 const AtomicString scroll() const; |
81 void setScroll(const AtomicString&, ExceptionState&); | 81 void setScroll(const AtomicString&, ExceptionState&); |
82 | 82 |
83 void updateParametersFromRegion(TextTrackRegion*); | 83 void updateParametersFromRegion(VTTRegion*); |
84 | 84 |
85 const String& regionSettings() const { return m_settings; } | 85 const String& regionSettings() const { return m_settings; } |
86 void setRegionSettings(const String&); | 86 void setRegionSettings(const String&); |
87 | 87 |
88 bool isScrollingRegion() { return m_scroll; } | 88 bool isScrollingRegion() { return m_scroll; } |
89 | 89 |
90 PassRefPtr<HTMLDivElement> getDisplayTree(Document&); | 90 PassRefPtr<HTMLDivElement> getDisplayTree(Document&); |
91 | 91 |
92 void appendTextTrackCueBox(PassRefPtr<TextTrackCueBox>); | 92 void appendTextTrackCueBox(PassRefPtr<TextTrackCueBox>); |
93 void displayLastTextTrackCueBox(); | 93 void displayLastTextTrackCueBox(); |
94 void willRemoveTextTrackCueBox(TextTrackCueBox*); | 94 void willRemoveTextTrackCueBox(TextTrackCueBox*); |
95 | 95 |
96 private: | 96 private: |
97 TextTrackRegion(); | 97 VTTRegion(); |
98 | 98 |
99 void prepareRegionDisplayTree(); | 99 void prepareRegionDisplayTree(); |
100 | 100 |
101 // The timer is needed to continue processing when cue scrolling ended. | 101 // The timer is needed to continue processing when cue scrolling ended. |
102 void startTimer(); | 102 void startTimer(); |
103 void stopTimer(); | 103 void stopTimer(); |
104 void scrollTimerFired(Timer<TextTrackRegion>*); | 104 void scrollTimerFired(Timer<VTTRegion>*); |
105 | 105 |
106 enum RegionSetting { | 106 enum RegionSetting { |
107 None, | 107 None, |
108 Id, | 108 Id, |
109 Width, | 109 Width, |
110 Height, | 110 Height, |
111 RegionAnchor, | 111 RegionAnchor, |
112 ViewportAnchor, | 112 ViewportAnchor, |
113 Scroll | 113 Scroll |
114 }; | 114 }; |
(...skipping 25 matching lines...) Expand all Loading... |
140 TextTrack* m_track; | 140 TextTrack* m_track; |
141 | 141 |
142 // Keep track of the current numeric value of the css "top" property. | 142 // Keep track of the current numeric value of the css "top" property. |
143 double m_currentTop; | 143 double m_currentTop; |
144 | 144 |
145 // The timer is used to display the next cue line after the current one has | 145 // The timer is used to display the next cue line after the current one has |
146 // been displayed. It's main use is for scrolling regions and it triggers as | 146 // been displayed. It's main use is for scrolling regions and it triggers as |
147 // soon as the animation for rolling out one line has finished, but | 147 // soon as the animation for rolling out one line has finished, but |
148 // currently it is used also for non-scrolling regions to use a single | 148 // currently it is used also for non-scrolling regions to use a single |
149 // code path. | 149 // code path. |
150 Timer<TextTrackRegion> m_scrollTimer; | 150 Timer<VTTRegion> m_scrollTimer; |
151 }; | 151 }; |
152 | 152 |
153 } // namespace WebCore | 153 } // namespace WebCore |
154 #endif | 154 #endif |
OLD | NEW |