OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 17 matching lines...) Expand all Loading... | |
28 */ | 28 */ |
29 | 29 |
30 #ifndef VTTCue_h | 30 #ifndef VTTCue_h |
31 #define VTTCue_h | 31 #define VTTCue_h |
32 | 32 |
33 #include "bindings/v8/ScriptWrappable.h" | 33 #include "bindings/v8/ScriptWrappable.h" |
34 #include "core/html/track/TextTrackCue.h" | 34 #include "core/html/track/TextTrackCue.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class Document; | |
39 class ExecutionContext; | |
40 class VTTCue; | |
41 | |
42 // ---------------------------- | |
43 | |
44 class VTTCueBox FINAL : public TextTrackCueBox { | |
45 public: | |
46 static PassRefPtr<VTTCueBox> create(Document& document, VTTCue* cue) | |
47 { | |
48 return adoptRef(new VTTCueBox(document, cue)); | |
49 } | |
50 | |
51 VTTCue* getCue() const { return m_cue; } | |
52 void applyCSSProperties(const IntSize& videoSize); | |
53 | |
54 protected: | |
55 VTTCueBox(Document&, VTTCue*); | |
56 | |
57 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; | |
58 | |
59 VTTCue* m_cue; | |
60 }; | |
61 | |
62 // ---------------------------- | |
63 | |
38 class VTTCue FINAL : public TextTrackCue, public ScriptWrappable { | 64 class VTTCue FINAL : public TextTrackCue, public ScriptWrappable { |
39 public: | 65 public: |
40 static PassRefPtr<VTTCue> create(Document&, double startTime, double endTime , const String& text); | 66 static PassRefPtr<VTTCue> create(Document& document, double startTime, doubl e endTime, const String& text) |
acolwell GONE FROM CHROMIUM
2013/11/21 19:22:00
nit: Remove document param name since it doesn't a
gasubic
2013/11/22 15:27:34
I guess you didn't notice that document is referen
| |
67 { | |
68 return adoptRef(new VTTCue(document, startTime, endTime, text)); | |
69 } | |
70 | |
71 virtual ~VTTCue(); | |
72 | |
73 virtual bool isVTTCue() const OVERRIDE { return true; } | |
74 | |
75 const String& vertical() const; | |
76 void setVertical(const String&, ExceptionState&); | |
77 | |
78 bool snapToLines() const { return m_snapToLines; } | |
79 void setSnapToLines(bool); | |
80 | |
81 int line() const { return m_linePosition; } | |
82 void setLine(int, ExceptionState&); | |
83 | |
84 int position() const { return m_textPosition; } | |
85 void setPosition(int, ExceptionState&); | |
86 | |
87 int size() const { return m_cueSize; } | |
88 void setSize(int, ExceptionState&); | |
89 | |
90 const String& align() const; | |
91 void setAlign(const String&, ExceptionState&); | |
92 | |
93 const String& text() const { return m_text; } | |
94 void setText(const String&); | |
95 | |
96 void parseSettings(const String&); | |
97 | |
98 PassRefPtr<DocumentFragment> getCueAsHTML(); | |
99 PassRefPtr<DocumentFragment> createCueRenderingTree(); | |
100 | |
101 const String& regionId() const { return m_regionId; } | |
102 void setRegionId(const String&); | |
103 virtual void notifyRegionWhenRemovingDisplayTree(bool) OVERRIDE; | |
104 | |
105 virtual void updateDisplay(const IntSize& videoSize, HTMLDivElement* contain er) OVERRIDE; | |
106 | |
107 virtual void updateDisplayTree(double) OVERRIDE; | |
108 virtual void removeDisplayTree() OVERRIDE; | |
109 void markFutureAndPastNodes(ContainerNode*, double, double); | |
110 | |
111 int calculateComputedLinePosition(); | |
112 | |
113 std::pair<double, double> getCSSPosition() const; | |
114 | |
115 CSSValueID getCSSAlignment() const; | |
116 int getCSSSize() const; | |
117 CSSValueID getCSSWritingDirection() const; | |
118 CSSValueID getCSSWritingMode() const; | |
119 | |
120 enum WritingDirection { | |
121 Horizontal = 0, | |
122 VerticalGrowingLeft, | |
123 VerticalGrowingRight, | |
124 NumberOfWritingDirections | |
125 }; | |
126 WritingDirection getWritingDirection() const { return m_writingDirection; } | |
127 | |
128 enum CueAlignment { | |
129 Start = 0, | |
130 Middle, | |
131 End, | |
132 Left, | |
133 Right, | |
134 NumberOfAlignments | |
135 }; | |
136 CueAlignment getAlignment() const { return m_cueAlignment; } | |
137 | |
138 virtual ExecutionContext* executionContext() const OVERRIDE; | |
41 | 139 |
42 private: | 140 private: |
43 VTTCue(Document&, double startTime, double endTime, const String& text); | 141 VTTCue(Document&, double startTime, double endTime, const String& text); |
142 | |
143 Document& document() const; | |
144 | |
145 PassRefPtr<VTTCueBox> displayTreeInternal(); | |
146 PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize); | |
147 | |
148 virtual void cueDidChange() OVERRIDE; | |
149 | |
150 void createVTTNodeTree(); | |
151 void copyVTTNodeToDOMTree(ContainerNode* VTTNode, ContainerNode* root); | |
152 | |
153 std::pair<double, double> getPositionCoordinates() const; | |
154 | |
155 void determineTextDirection(); | |
156 void calculateDisplayParameters(); | |
157 | |
158 enum CueSetting { | |
159 None, | |
160 Vertical, | |
161 Line, | |
162 Position, | |
163 Size, | |
164 Align, | |
165 RegionId | |
166 }; | |
167 CueSetting settingName(const String&); | |
168 | |
169 String m_text; | |
170 int m_linePosition; | |
171 int m_computedLinePosition; | |
172 int m_textPosition; | |
173 int m_cueSize; | |
174 WritingDirection m_writingDirection; | |
175 | |
176 CueAlignment m_cueAlignment; | |
177 | |
178 RefPtr<DocumentFragment> m_webVTTNodeTree; | |
179 bool m_snapToLines; | |
180 | |
181 RefPtr<HTMLDivElement> m_cueBackgroundBox; | |
182 | |
183 bool m_displayTreeShouldChange; | |
184 RefPtr<VTTCueBox> m_displayTree; | |
185 | |
186 CSSValueID m_displayDirection; | |
187 | |
188 int m_displaySize; | |
189 | |
190 std::pair<float, float> m_displayPosition; | |
191 String m_regionId; | |
192 bool m_notifyRegion; | |
44 }; | 193 }; |
45 | 194 |
46 inline VTTCue* toVTTCue(TextTrackCue* cue) | 195 inline VTTCue* toVTTCue(TextTrackCue* cue) |
47 { | 196 { |
48 // VTTCue is currently the only TextTrackCue subclass. | 197 // VTTCue is currently the only TextTrackCue subclass. |
49 return static_cast<VTTCue*>(cue); | 198 return static_cast<VTTCue*>(cue); |
50 } | 199 } |
51 | 200 |
52 } // namespace WebCore | 201 } // namespace WebCore |
53 | 202 |
54 #endif | 203 #endif |
OLD | NEW |