| 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 17 matching lines...) Expand all Loading... |
| 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 VTTRegion_h | 31 #ifndef VTTRegion_h |
| 32 #define VTTRegion_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 "platform/heap/Handle.h" |
| 38 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
| 39 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 class ExceptionState; | 44 class ExceptionState; |
| 44 class HTMLDivElement; | 45 class HTMLDivElement; |
| 45 class VTTCueBox; | 46 class VTTCueBox; |
| 46 class VTTScanner; | 47 class VTTScanner; |
| 47 | 48 |
| 48 class VTTRegion : public RefCounted<VTTRegion> { | 49 class VTTRegion FINAL : public RefCountedWillBeGarbageCollectedFinalized<VTTRegi
on> { |
| 49 public: | 50 public: |
| 50 static PassRefPtr<VTTRegion> create() | 51 static PassRefPtrWillBeRawPtr<VTTRegion> create() |
| 51 { | 52 { |
| 52 return adoptRef(new VTTRegion()); | 53 return adoptRefWillBeNoop(new VTTRegion()); |
| 53 } | 54 } |
| 54 | 55 |
| 55 virtual ~VTTRegion(); | 56 virtual ~VTTRegion(); |
| 56 | 57 |
| 57 TextTrack* track() const { return m_track; } | 58 TextTrack* track() const { return m_track; } |
| 58 void setTrack(TextTrack*); | 59 void setTrack(TextTrack*); |
| 59 | 60 |
| 60 const String& id() const { return m_id; } | 61 const String& id() const { return m_id; } |
| 61 void setId(const String&); | 62 void setId(const String&); |
| 62 | 63 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 void setRegionSettings(const String&); | 88 void setRegionSettings(const String&); |
| 88 | 89 |
| 89 bool isScrollingRegion() { return m_scroll; } | 90 bool isScrollingRegion() { return m_scroll; } |
| 90 | 91 |
| 91 PassRefPtr<HTMLDivElement> getDisplayTree(Document&); | 92 PassRefPtr<HTMLDivElement> getDisplayTree(Document&); |
| 92 | 93 |
| 93 void appendVTTCueBox(PassRefPtr<VTTCueBox>); | 94 void appendVTTCueBox(PassRefPtr<VTTCueBox>); |
| 94 void displayLastVTTCueBox(); | 95 void displayLastVTTCueBox(); |
| 95 void willRemoveVTTCueBox(VTTCueBox*); | 96 void willRemoveVTTCueBox(VTTCueBox*); |
| 96 | 97 |
| 98 void trace(Visitor*); |
| 99 |
| 97 private: | 100 private: |
| 98 VTTRegion(); | 101 VTTRegion(); |
| 99 | 102 |
| 100 void prepareRegionDisplayTree(); | 103 void prepareRegionDisplayTree(); |
| 101 | 104 |
| 102 // The timer is needed to continue processing when cue scrolling ended. | 105 // The timer is needed to continue processing when cue scrolling ended. |
| 103 void startTimer(); | 106 void startTimer(); |
| 104 void stopTimer(); | 107 void stopTimer(); |
| 105 void scrollTimerFired(Timer<VTTRegion>*); | 108 void scrollTimerFired(Timer<VTTRegion>*); |
| 106 | 109 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 130 | 133 |
| 131 // The cue container is the container that is scrolled up to obtain the | 134 // The cue container is the container that is scrolled up to obtain the |
| 132 // effect of scrolling cues when this is enabled for the regions. | 135 // effect of scrolling cues when this is enabled for the regions. |
| 133 RefPtr<HTMLDivElement> m_cueContainer; | 136 RefPtr<HTMLDivElement> m_cueContainer; |
| 134 RefPtr<HTMLDivElement> m_regionDisplayTree; | 137 RefPtr<HTMLDivElement> m_regionDisplayTree; |
| 135 | 138 |
| 136 // The member variable track can be a raw pointer as it will never | 139 // The member variable track can be a raw pointer as it will never |
| 137 // reference a destroyed TextTrack, as this member variable | 140 // reference a destroyed TextTrack, as this member variable |
| 138 // is cleared in the TextTrack destructor and it is generally | 141 // is cleared in the TextTrack destructor and it is generally |
| 139 // set/reset within the addRegion and removeRegion methods. | 142 // set/reset within the addRegion and removeRegion methods. |
| 140 TextTrack* m_track; | 143 RawPtrWillBeMember<TextTrack> m_track; |
| 141 | 144 |
| 142 // Keep track of the current numeric value of the css "top" property. | 145 // Keep track of the current numeric value of the css "top" property. |
| 143 double m_currentTop; | 146 double m_currentTop; |
| 144 | 147 |
| 145 // The timer is used to display the next cue line after the current one has | 148 // 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 | 149 // 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 | 150 // 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 | 151 // currently it is used also for non-scrolling regions to use a single |
| 149 // code path. | 152 // code path. |
| 150 Timer<VTTRegion> m_scrollTimer; | 153 Timer<VTTRegion> m_scrollTimer; |
| 151 }; | 154 }; |
| 152 | 155 |
| 153 } // namespace WebCore | 156 } // namespace WebCore |
| 154 #endif | 157 #endif |
| OLD | NEW |