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/TextTrackCue.h" | 38 #include "core/html/track/TextTrackCue.h" |
39 #include "core/html/track/TextTrackRegion.h" | 39 #include "core/html/track/VTTRegion.h" |
40 #include "core/html/track/WebVTTTokenizer.h" | 40 #include "core/html/track/WebVTTTokenizer.h" |
41 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
42 #include "wtf/text/StringBuilder.h" | 42 #include "wtf/text/StringBuilder.h" |
43 | 43 |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 using namespace HTMLNames; | 46 using namespace HTMLNames; |
47 | 47 |
48 class Document; | 48 class Document; |
49 | 49 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 static FloatPoint parseFloatPercentageValuePair(const String&, char, bool&); | 101 static FloatPoint parseFloatPercentageValuePair(const String&, char, bool&); |
102 | 102 |
103 // Create the DocumentFragment representation of the WebVTT cue text. | 103 // Create the DocumentFragment representation of the WebVTT cue text. |
104 static PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(Docume
nt&, const String&); | 104 static PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(Docume
nt&, const String&); |
105 | 105 |
106 // Input data to the parser to parse. | 106 // Input data to the parser to parse. |
107 void parseBytes(const char* data, unsigned length); | 107 void parseBytes(const char* data, unsigned length); |
108 | 108 |
109 // Transfers ownership of last parsed cues to caller. | 109 // Transfers ownership of last parsed cues to caller. |
110 void getNewCues(Vector<RefPtr<TextTrackCue> >&); | 110 void getNewCues(Vector<RefPtr<TextTrackCue> >&); |
111 void getNewRegions(Vector<RefPtr<TextTrackRegion> >&); | 111 void getNewRegions(Vector<RefPtr<VTTRegion> >&); |
112 | 112 |
113 private: | 113 private: |
114 WebVTTParser(WebVTTParserClient*, Document&); | 114 WebVTTParser(WebVTTParserClient*, Document&); |
115 | 115 |
116 Document* m_document; | 116 Document* m_document; |
117 ParseState m_state; | 117 ParseState m_state; |
118 | 118 |
119 bool hasRequiredFileIdentifier(const String& line); | 119 bool hasRequiredFileIdentifier(const String& line); |
120 ParseState collectCueId(const String&); | 120 ParseState collectCueId(const String&); |
121 ParseState collectTimingsAndSettings(const String&); | 121 ParseState collectTimingsAndSettings(const String&); |
(...skipping 17 matching lines...) Expand all Loading... |
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<TextTrackCue> > m_cuelist; |
148 | 148 |
149 Vector<RefPtr<TextTrackRegion> > 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 |