| 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 13 matching lines...) Expand all Loading... |
| 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 TextTrackRegion_h |
| 32 #define TextTrackRegion_h | 32 #define TextTrackRegion_h |
| 33 | 33 |
| 34 #if ENABLE(WEBVTT_REGIONS) | |
| 35 | |
| 36 #include "core/dom/ContextLifecycleObserver.h" | 34 #include "core/dom/ContextLifecycleObserver.h" |
| 37 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 38 #include "core/html/track/TextTrack.h" | 36 #include "core/html/track/TextTrack.h" |
| 39 #include "platform/geometry/FloatPoint.h" | 37 #include "platform/geometry/FloatPoint.h" |
| 40 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 41 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 42 | 40 |
| 43 namespace WebCore { | 41 namespace WebCore { |
| 44 | 42 |
| 45 class ExceptionState; | 43 class ExceptionState; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 bool isScrollingRegion() { return m_scroll; } | 88 bool isScrollingRegion() { return m_scroll; } |
| 91 | 89 |
| 92 PassRefPtr<HTMLDivElement> getDisplayTree(); | 90 PassRefPtr<HTMLDivElement> getDisplayTree(); |
| 93 | 91 |
| 94 void appendTextTrackCueBox(PassRefPtr<TextTrackCueBox>); | 92 void appendTextTrackCueBox(PassRefPtr<TextTrackCueBox>); |
| 95 void displayLastTextTrackCueBox(); | 93 void displayLastTextTrackCueBox(); |
| 96 void willRemoveTextTrackCueBox(TextTrackCueBox*); | 94 void willRemoveTextTrackCueBox(TextTrackCueBox*); |
| 97 | 95 |
| 98 private: | 96 private: |
| 99 TextTrackRegion(ExecutionContext*); | 97 TextTrackRegion(ExecutionContext*); |
| 100 Document* ownerDocument() { return toDocument(m_executionContext); } | 98 Document* ownerDocument() { return toDocument(executionContext()); } |
| 101 | 99 |
| 102 void prepareRegionDisplayTree(); | 100 void prepareRegionDisplayTree(); |
| 103 | 101 |
| 104 // The timer is needed to continue processing when cue scrolling ended. | 102 // The timer is needed to continue processing when cue scrolling ended. |
| 105 void startTimer(); | 103 void startTimer(); |
| 106 void stopTimer(); | 104 void stopTimer(); |
| 107 void scrollTimerFired(Timer<TextTrackRegion>*); | 105 void scrollTimerFired(Timer<TextTrackRegion>*); |
| 108 | 106 |
| 109 enum RegionSetting { | 107 enum RegionSetting { |
| 110 None, | 108 None, |
| 111 Id, | 109 Id, |
| 112 Width, | 110 Width, |
| 113 Height, | 111 Height, |
| 114 RegionAnchor, | 112 RegionAnchor, |
| 115 ViewportAnchor, | 113 ViewportAnchor, |
| 116 Scroll | 114 Scroll |
| 117 }; | 115 }; |
| 118 | |
| 119 RegionSetting getSettingFromString(const String&); | 116 RegionSetting getSettingFromString(const String&); |
| 120 | |
| 121 void parseSettingValue(RegionSetting, const String&); | 117 void parseSettingValue(RegionSetting, const String&); |
| 122 void parseSetting(const String&, unsigned*); | 118 void parseSetting(const String&, unsigned*); |
| 123 | 119 |
| 124 static const AtomicString& textTrackCueContainerShadowPseudoId(); | 120 static const AtomicString& textTrackCueContainerShadowPseudoId(); |
| 125 static const AtomicString& textTrackCueContainerScrollingClass(); | 121 static const AtomicString& textTrackCueContainerScrollingClass(); |
| 126 static const AtomicString& textTrackRegionShadowPseudoId(); | 122 static const AtomicString& textTrackRegionShadowPseudoId(); |
| 127 | 123 |
| 128 String m_id; | 124 String m_id; |
| 129 String m_settings; | 125 String m_settings; |
| 130 | |
| 131 double m_width; | 126 double m_width; |
| 132 unsigned m_heightInLines; | 127 unsigned m_heightInLines; |
| 133 | |
| 134 FloatPoint m_regionAnchor; | 128 FloatPoint m_regionAnchor; |
| 135 FloatPoint m_viewportAnchor; | 129 FloatPoint m_viewportAnchor; |
| 136 | |
| 137 bool m_scroll; | 130 bool m_scroll; |
| 138 | 131 |
| 139 RefPtr<HTMLDivElement> m_regionDisplayTree; | |
| 140 | |
| 141 // The cue container is the container that is scrolled up to obtain the | 132 // The cue container is the container that is scrolled up to obtain the |
| 142 // effect of scrolling cues when this is enabled for the regions. | 133 // effect of scrolling cues when this is enabled for the regions. |
| 143 RefPtr<HTMLDivElement> m_cueContainer; | 134 RefPtr<HTMLDivElement> m_cueContainer; |
| 135 RefPtr<HTMLDivElement> m_regionDisplayTree; |
| 144 | 136 |
| 145 // The member variable track can be a raw pointer as it will never | 137 // The member variable track can be a raw pointer as it will never |
| 146 // reference a destroyed TextTrack, as this member variable | 138 // reference a destroyed TextTrack, as this member variable |
| 147 // is cleared in the TextTrack destructor and it is generally | 139 // is cleared in the TextTrack destructor and it is generally |
| 148 // set/reset within the addRegion and removeRegion methods. | 140 // set/reset within the addRegion and removeRegion methods. |
| 149 TextTrack* m_track; | 141 TextTrack* m_track; |
| 150 | 142 |
| 151 // Keep track of the current numeric value of the css "top" property. | 143 // Keep track of the current numeric value of the css "top" property. |
| 152 double m_currentTop; | 144 double m_currentTop; |
| 153 | 145 |
| 154 // The timer is used to display the next cue line after the current one has | 146 // The timer is used to display the next cue line after the current one has |
| 155 // been displayed. It's main use is for scrolling regions and it triggers as | 147 // been displayed. It's main use is for scrolling regions and it triggers as |
| 156 // soon as the animation for rolling out one line has finished, but | 148 // soon as the animation for rolling out one line has finished, but |
| 157 // currently it is used also for non-scrolling regions to use a single | 149 // currently it is used also for non-scrolling regions to use a single |
| 158 // code path. | 150 // code path. |
| 159 Timer<TextTrackRegion> m_scrollTimer; | 151 Timer<TextTrackRegion> m_scrollTimer; |
| 160 }; | 152 }; |
| 161 | 153 |
| 162 } // namespace WebCore | 154 } // namespace WebCore |
| 163 | |
| 164 #endif | 155 #endif |
| 165 #endif | |
| OLD | NEW |