Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: third_party/WebKit/Source/core/html/track/vtt/VTTRegion.h

Issue 2682333002: Implement VTTCue.region and sync the VTTRegion interface (Closed)
Patch Set: Add DCHECK Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
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 VTTRegion_h 31 #ifndef VTTRegion_h
32 #define VTTRegion_h 32 #define VTTRegion_h
33 33
34 #include "bindings/core/v8/ScriptWrappable.h" 34 #include "bindings/core/v8/ScriptWrappable.h"
35 #include "core/dom/ContextLifecycleObserver.h" 35 #include "core/dom/ContextLifecycleObserver.h"
36 #include "core/html/track/TextTrack.h"
37 #include "platform/Timer.h" 36 #include "platform/Timer.h"
38 #include "platform/geometry/FloatPoint.h" 37 #include "platform/geometry/FloatPoint.h"
39 #include "platform/heap/Handle.h" 38 #include "platform/heap/Handle.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
43 class Document; 42 class Document;
44 class ExceptionState; 43 class ExceptionState;
45 class HTMLDivElement; 44 class HTMLDivElement;
46 class VTTCueBox; 45 class VTTCueBox;
47 class VTTScanner; 46 class VTTScanner;
48 47
49 class VTTRegion final : public GarbageCollectedFinalized<VTTRegion>, 48 class VTTRegion final : public GarbageCollectedFinalized<VTTRegion>,
50 public ScriptWrappable { 49 public ScriptWrappable {
51 DEFINE_WRAPPERTYPEINFO(); 50 DEFINE_WRAPPERTYPEINFO();
52 51
53 public: 52 public:
54 static VTTRegion* create() { return new VTTRegion; } 53 static VTTRegion* create() { return new VTTRegion; }
55 54
56 virtual ~VTTRegion(); 55 virtual ~VTTRegion();
57 56
58 TextTrack* track() const { return m_track; }
59 void setTrack(TextTrack*);
60
61 const String& id() const { return m_id; } 57 const String& id() const { return m_id; }
62 void setId(const String&); 58 void setId(const String&);
63 59
64 double width() const { return m_width; } 60 double width() const { return m_width; }
65 void setWidth(double, ExceptionState&); 61 void setWidth(double, ExceptionState&);
66 62
67 long height() const { return m_heightInLines; } 63 long lines() const { return m_lines; }
68 void setHeight(long, ExceptionState&); 64 void setLines(long, ExceptionState&);
69 65
70 double regionAnchorX() const { return m_regionAnchor.x(); } 66 double regionAnchorX() const { return m_regionAnchor.x(); }
71 void setRegionAnchorX(double, ExceptionState&); 67 void setRegionAnchorX(double, ExceptionState&);
72 68
73 double regionAnchorY() const { return m_regionAnchor.y(); } 69 double regionAnchorY() const { return m_regionAnchor.y(); }
74 void setRegionAnchorY(double, ExceptionState&); 70 void setRegionAnchorY(double, ExceptionState&);
75 71
76 double viewportAnchorX() const { return m_viewportAnchor.x(); } 72 double viewportAnchorX() const { return m_viewportAnchor.x(); }
77 void setViewportAnchorX(double, ExceptionState&); 73 void setViewportAnchorX(double, ExceptionState&);
78 74
79 double viewportAnchorY() const { return m_viewportAnchor.y(); } 75 double viewportAnchorY() const { return m_viewportAnchor.y(); }
80 void setViewportAnchorY(double, ExceptionState&); 76 void setViewportAnchorY(double, ExceptionState&);
81 77
82 const AtomicString scroll() const; 78 const AtomicString scroll() const;
83 void setScroll(const AtomicString&, ExceptionState&); 79 void setScroll(const AtomicString&);
84 80
85 void updateParametersFromRegion(VTTRegion*); 81 void updateParametersFromRegion(VTTRegion*);
86 82
87 const String& regionSettings() const { return m_settings; } 83 const String& regionSettings() const { return m_settings; }
88 void setRegionSettings(const String&); 84 void setRegionSettings(const String&);
89 85
90 bool isScrollingRegion() { return m_scroll; } 86 bool isScrollingRegion() { return m_scroll; }
91 87
92 HTMLDivElement* getDisplayTree(Document&); 88 HTMLDivElement* getDisplayTree(Document&);
93 89
(...skipping 25 matching lines...) Expand all
119 RegionSetting scanSettingName(VTTScanner&); 115 RegionSetting scanSettingName(VTTScanner&);
120 void parseSettingValue(RegionSetting, VTTScanner&); 116 void parseSettingValue(RegionSetting, VTTScanner&);
121 117
122 static const AtomicString& textTrackCueContainerShadowPseudoId(); 118 static const AtomicString& textTrackCueContainerShadowPseudoId();
123 static const AtomicString& textTrackCueContainerScrollingClass(); 119 static const AtomicString& textTrackCueContainerScrollingClass();
124 static const AtomicString& textTrackRegionShadowPseudoId(); 120 static const AtomicString& textTrackRegionShadowPseudoId();
125 121
126 String m_id; 122 String m_id;
127 String m_settings; 123 String m_settings;
128 double m_width; 124 double m_width;
129 unsigned m_heightInLines; 125 unsigned m_lines;
130 FloatPoint m_regionAnchor; 126 FloatPoint m_regionAnchor;
131 FloatPoint m_viewportAnchor; 127 FloatPoint m_viewportAnchor;
132 bool m_scroll; 128 bool m_scroll;
133 129
134 // The cue container is the container that is scrolled up to obtain the 130 // The cue container is the container that is scrolled up to obtain the
135 // effect of scrolling cues when this is enabled for the regions. 131 // effect of scrolling cues when this is enabled for the regions.
136 Member<HTMLDivElement> m_cueContainer; 132 Member<HTMLDivElement> m_cueContainer;
137 Member<HTMLDivElement> m_regionDisplayTree; 133 Member<HTMLDivElement> m_regionDisplayTree;
138 134
139 // The member variable track can be a raw pointer as it will never
140 // reference a destroyed TextTrack, as this member variable
141 // is cleared in the TextTrack destructor and it is generally
142 // set/reset within the addRegion and removeRegion methods.
143 Member<TextTrack> m_track;
144
145 // Keep track of the current numeric value of the css "top" property. 135 // Keep track of the current numeric value of the css "top" property.
146 double m_currentTop; 136 double m_currentTop;
147 137
148 // The timer is used to display the next cue line after the current one has 138 // The timer is used to display the next cue line after the current one has
149 // been displayed. It's main use is for scrolling regions and it triggers as 139 // been displayed. It's main use is for scrolling regions and it triggers as
150 // soon as the animation for rolling out one line has finished, but 140 // soon as the animation for rolling out one line has finished, but
151 // currently it is used also for non-scrolling regions to use a single 141 // currently it is used also for non-scrolling regions to use a single
152 // code path. 142 // code path.
153 Timer<VTTRegion> m_scrollTimer; 143 Timer<VTTRegion> m_scrollTimer;
154 }; 144 };
155 145
156 } // namespace blink 146 } // namespace blink
157 147
158 #endif // VTTRegion_h 148 #endif // VTTRegion_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698