OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebVTTParser_h | 31 #ifndef WebVTTParser_h |
32 #define WebVTTParser_h | 32 #define WebVTTParser_h |
33 | 33 |
34 #include "HTMLNames.h" | 34 #include "HTMLNames.h" |
35 #include "RuntimeEnabledFeatures.h" | 35 #include "RuntimeEnabledFeatures.h" |
36 #include "core/dom/DocumentFragment.h" | 36 #include "core/dom/DocumentFragment.h" |
37 #include "core/fetch/TextResourceDecoder.h" | 37 #include "core/fetch/TextResourceDecoder.h" |
38 #include "core/html/track/BufferedLineReader.h" | 38 #include "core/html/track/BufferedLineReader.h" |
39 #include "core/html/track/TextTrackCue.h" | 39 #include "core/html/track/VTTCue.h" |
40 #include "core/html/track/VTTRegion.h" | 40 #include "core/html/track/VTTRegion.h" |
41 #include "core/html/track/WebVTTTokenizer.h" | 41 #include "core/html/track/WebVTTTokenizer.h" |
42 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
43 #include "wtf/text/StringBuilder.h" | 43 #include "wtf/text/StringBuilder.h" |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 using namespace HTMLNames; | 47 using namespace HTMLNames; |
48 | 48 |
49 class Document; | 49 class Document; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 static FloatPoint parseFloatPercentageValuePair(const String&, char, bool&); | 102 static FloatPoint parseFloatPercentageValuePair(const String&, char, bool&); |
103 | 103 |
104 // Create the DocumentFragment representation of the WebVTT cue text. | 104 // Create the DocumentFragment representation of the WebVTT cue text. |
105 static PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(Docume
nt&, const String&); | 105 static PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(Docume
nt&, const String&); |
106 | 106 |
107 // Input data to the parser to parse. | 107 // Input data to the parser to parse. |
108 void parseBytes(const char* data, unsigned length); | 108 void parseBytes(const char* data, unsigned length); |
109 void flush(); | 109 void flush(); |
110 | 110 |
111 // Transfers ownership of last parsed cues to caller. | 111 // Transfers ownership of last parsed cues to caller. |
112 void getNewCues(Vector<RefPtr<TextTrackCue> >&); | 112 void getNewCues(Vector<RefPtr<VTTCue> >&); |
113 void getNewRegions(Vector<RefPtr<VTTRegion> >&); | 113 void getNewRegions(Vector<RefPtr<VTTRegion> >&); |
114 | 114 |
115 private: | 115 private: |
116 WebVTTParser(WebVTTParserClient*, Document&); | 116 WebVTTParser(WebVTTParserClient*, Document&); |
117 | 117 |
118 Document* m_document; | 118 Document* m_document; |
119 ParseState m_state; | 119 ParseState m_state; |
120 | 120 |
121 void parse(); | 121 void parse(); |
122 void flushPendingCue(); | 122 void flushPendingCue(); |
(...skipping 14 matching lines...) Expand all Loading... |
137 BufferedLineReader m_lineReader; | 137 BufferedLineReader m_lineReader; |
138 RefPtr<TextResourceDecoder> m_decoder; | 138 RefPtr<TextResourceDecoder> m_decoder; |
139 String m_currentId; | 139 String m_currentId; |
140 double m_currentStartTime; | 140 double m_currentStartTime; |
141 double m_currentEndTime; | 141 double m_currentEndTime; |
142 StringBuilder m_currentContent; | 142 StringBuilder m_currentContent; |
143 String m_currentSettings; | 143 String m_currentSettings; |
144 | 144 |
145 WebVTTParserClient* m_client; | 145 WebVTTParserClient* m_client; |
146 | 146 |
147 Vector<RefPtr<TextTrackCue> > m_cuelist; | 147 Vector<RefPtr<VTTCue> > m_cuelist; |
148 | 148 |
149 Vector<RefPtr<VTTRegion> > m_regionList; | 149 Vector<RefPtr<VTTRegion> > m_regionList; |
150 }; | 150 }; |
151 | 151 |
152 } // namespace WebCore | 152 } // namespace WebCore |
153 | 153 |
154 #endif | 154 #endif |
OLD | NEW |