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 22 matching lines...) Expand all Loading... |
33 #include "core/html/track/TextTrackCue.h" | 33 #include "core/html/track/TextTrackCue.h" |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class Document; | 39 class Document; |
40 class DoubleOrAutoKeyword; | 40 class DoubleOrAutoKeyword; |
41 class ExecutionContext; | 41 class ExecutionContext; |
42 class VTTCue; | 42 class VTTCue; |
| 43 class VTTRegion; |
43 class VTTScanner; | 44 class VTTScanner; |
44 | 45 |
| 46 using VTTRegionMap = HeapHashMap<String, Member<VTTRegion>>; |
| 47 |
45 struct VTTDisplayParameters { | 48 struct VTTDisplayParameters { |
46 STACK_ALLOCATED(); | 49 STACK_ALLOCATED(); |
47 VTTDisplayParameters(); | 50 VTTDisplayParameters(); |
48 | 51 |
49 FloatPoint position; | 52 FloatPoint position; |
50 float size; | 53 float size; |
51 CSSValueID direction; | 54 CSSValueID direction; |
52 CSSValueID textAlign; | 55 CSSValueID textAlign; |
53 CSSValueID writingMode; | 56 CSSValueID writingMode; |
54 float snapToLinesPosition; | 57 float snapToLinesPosition; |
(...skipping 24 matching lines...) Expand all Loading... |
79 public: | 82 public: |
80 static VTTCue* create(Document& document, | 83 static VTTCue* create(Document& document, |
81 double startTime, | 84 double startTime, |
82 double endTime, | 85 double endTime, |
83 const String& text) { | 86 const String& text) { |
84 return new VTTCue(document, startTime, endTime, text); | 87 return new VTTCue(document, startTime, endTime, text); |
85 } | 88 } |
86 | 89 |
87 ~VTTCue() override; | 90 ~VTTCue() override; |
88 | 91 |
| 92 VTTRegion* region() const { return m_region; } |
| 93 void setRegion(VTTRegion*); |
| 94 |
89 const String& vertical() const; | 95 const String& vertical() const; |
90 void setVertical(const String&); | 96 void setVertical(const String&); |
91 | 97 |
92 bool snapToLines() const { return m_snapToLines; } | 98 bool snapToLines() const { return m_snapToLines; } |
93 void setSnapToLines(bool); | 99 void setSnapToLines(bool); |
94 | 100 |
95 void line(DoubleOrAutoKeyword&) const; | 101 void line(DoubleOrAutoKeyword&) const; |
96 void setLine(const DoubleOrAutoKeyword&); | 102 void setLine(const DoubleOrAutoKeyword&); |
97 | 103 |
98 void position(DoubleOrAutoKeyword&) const; | 104 void position(DoubleOrAutoKeyword&) const; |
99 void setPosition(const DoubleOrAutoKeyword&, ExceptionState&); | 105 void setPosition(const DoubleOrAutoKeyword&, ExceptionState&); |
100 | 106 |
101 double size() const { return m_cueSize; } | 107 double size() const { return m_cueSize; } |
102 void setSize(double, ExceptionState&); | 108 void setSize(double, ExceptionState&); |
103 | 109 |
104 const String& align() const; | 110 const String& align() const; |
105 void setAlign(const String&); | 111 void setAlign(const String&); |
106 | 112 |
107 const String& text() const { return m_text; } | 113 const String& text() const { return m_text; } |
108 void setText(const String&); | 114 void setText(const String&); |
109 | 115 |
110 void parseSettings(const String&); | 116 void parseSettings(const VTTRegionMap*, const String&); |
111 | 117 |
112 // Applies CSS override style from user settings. | 118 // Applies CSS override style from user settings. |
113 void applyUserOverrideCSSProperties(); | 119 void applyUserOverrideCSSProperties(); |
114 | 120 |
115 DocumentFragment* getCueAsHTML(); | 121 DocumentFragment* getCueAsHTML(); |
116 | 122 |
117 const String& regionId() const { return m_regionId; } | |
118 void setRegionId(const String&); | |
119 | |
120 void updateDisplay(HTMLDivElement& container) override; | 123 void updateDisplay(HTMLDivElement& container) override; |
121 | 124 |
122 void updatePastAndFutureNodes(double movieTime) override; | 125 void updatePastAndFutureNodes(double movieTime) override; |
123 | 126 |
124 void removeDisplayTree(RemovalNotification) override; | 127 void removeDisplayTree(RemovalNotification) override; |
125 | 128 |
126 float calculateComputedLinePosition() const; | 129 float calculateComputedLinePosition() const; |
127 | 130 |
128 enum WritingDirection { | 131 enum WritingDirection { |
129 Horizontal = 0, | 132 Horizontal = 0, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 168 |
166 enum CueSetting { None, Vertical, Line, Position, Size, Align, RegionId }; | 169 enum CueSetting { None, Vertical, Line, Position, Size, Align, RegionId }; |
167 CueSetting settingName(VTTScanner&) const; | 170 CueSetting settingName(VTTScanner&) const; |
168 | 171 |
169 String m_text; | 172 String m_text; |
170 float m_linePosition; | 173 float m_linePosition; |
171 float m_textPosition; | 174 float m_textPosition; |
172 float m_cueSize; | 175 float m_cueSize; |
173 WritingDirection m_writingDirection; | 176 WritingDirection m_writingDirection; |
174 CueAlignment m_cueAlignment; | 177 CueAlignment m_cueAlignment; |
175 String m_regionId; | |
176 | 178 |
| 179 Member<VTTRegion> m_region; |
177 Member<DocumentFragment> m_vttNodeTree; | 180 Member<DocumentFragment> m_vttNodeTree; |
178 Member<HTMLDivElement> m_cueBackgroundBox; | 181 Member<HTMLDivElement> m_cueBackgroundBox; |
179 Member<VTTCueBox> m_displayTree; | 182 Member<VTTCueBox> m_displayTree; |
180 | 183 |
181 bool m_snapToLines : 1; | 184 bool m_snapToLines : 1; |
182 bool m_displayTreeShouldChange : 1; | 185 bool m_displayTreeShouldChange : 1; |
183 }; | 186 }; |
184 | 187 |
185 // VTTCue is currently the only TextTrackCue subclass. | 188 // VTTCue is currently the only TextTrackCue subclass. |
186 DEFINE_TYPE_CASTS(VTTCue, TextTrackCue, cue, true, true); | 189 DEFINE_TYPE_CASTS(VTTCue, TextTrackCue, cue, true, true); |
187 | 190 |
188 } // namespace blink | 191 } // namespace blink |
189 | 192 |
190 #endif // VTTCue_h | 193 #endif // VTTCue_h |
OLD | NEW |