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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'; | 86 return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'; |
87 } | 87 } |
88 static inline bool isValidSettingDelimiter(char c) | 88 static inline bool isValidSettingDelimiter(char c) |
89 { | 89 { |
90 // ... a WebVTT cue consists of zero or more of the following components
, in any order, separated from each other by one or more | 90 // ... a WebVTT cue consists of zero or more of the following components
, in any order, separated from each other by one or more |
91 // U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characte
rs. | 91 // U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characte
rs. |
92 return c == ' ' || c == '\t'; | 92 return c == ' ' || c == '\t'; |
93 } | 93 } |
94 static String collectDigits(const String&, unsigned*); | 94 static String collectDigits(const String&, unsigned*); |
95 static String collectWord(const String&, unsigned*); | 95 static String collectWord(const String&, unsigned*); |
| 96 static double collectTimeStamp(const String&, unsigned*); |
96 | 97 |
97 // Useful functions for parsing percentage settings. | 98 // Useful functions for parsing percentage settings. |
98 static float parseFloatPercentageValue(const String&, bool&); | 99 static float parseFloatPercentageValue(const String&, bool&); |
99 static FloatPoint parseFloatPercentageValuePair(const String&, char, bool&); | 100 static FloatPoint parseFloatPercentageValuePair(const String&, char, bool&); |
100 | 101 |
101 // Input data to the parser to parse. | 102 // Input data to the parser to parse. |
102 void parseBytes(const char* data, unsigned length); | 103 void parseBytes(const char* data, unsigned length); |
103 | 104 |
104 // Transfers ownership of last parsed cues to caller. | 105 // Transfers ownership of last parsed cues to caller. |
105 void getNewCues(Vector<RefPtr<TextTrackCue> >&); | 106 void getNewCues(Vector<RefPtr<TextTrackCue> >&); |
106 void getNewRegions(Vector<RefPtr<TextTrackRegion> >&); | 107 void getNewRegions(Vector<RefPtr<TextTrackRegion> >&); |
107 | 108 |
108 PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(const String&
); | 109 PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(const String&
); |
109 double collectTimeStamp(const String&, unsigned*); | |
110 | 110 |
111 private: | 111 private: |
112 WebVTTParser(WebVTTParserClient*, Document&); | 112 WebVTTParser(WebVTTParserClient*, Document&); |
113 | 113 |
114 Document* m_document; | 114 Document* m_document; |
115 ParseState m_state; | 115 ParseState m_state; |
116 | 116 |
117 bool hasRequiredFileIdentifier(); | 117 bool hasRequiredFileIdentifier(); |
118 ParseState collectCueId(const String&); | 118 ParseState collectCueId(const String&); |
119 ParseState collectTimingsAndSettings(const String&); | 119 ParseState collectTimingsAndSettings(const String&); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 Vector<AtomicString> m_languageStack; | 152 Vector<AtomicString> m_languageStack; |
153 Vector<RefPtr<TextTrackCue> > m_cuelist; | 153 Vector<RefPtr<TextTrackCue> > m_cuelist; |
154 | 154 |
155 Vector<RefPtr<TextTrackRegion> > m_regionList; | 155 Vector<RefPtr<TextTrackRegion> > m_regionList; |
156 }; | 156 }; |
157 | 157 |
158 } // namespace WebCore | 158 } // namespace WebCore |
159 | 159 |
160 #endif | 160 #endif |
OLD | NEW |