Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: Source/core/html/track/WebVTTParser.h

Issue 59453002: Add a flushing mechanism for the WebVTTParser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Even more binary Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Useful functions for parsing percentage settings. 99 // Useful functions for parsing percentage settings.
100 static float parseFloatPercentageValue(const String&, bool&); 100 static float parseFloatPercentageValue(const String&, bool&);
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 void flush();
108 109
109 // Transfers ownership of last parsed cues to caller. 110 // Transfers ownership of last parsed cues to caller.
110 void getNewCues(Vector<RefPtr<TextTrackCue> >&); 111 void getNewCues(Vector<RefPtr<TextTrackCue> >&);
111 void getNewRegions(Vector<RefPtr<VTTRegion> >&); 112 void getNewRegions(Vector<RefPtr<VTTRegion> >&);
112 113
113 private: 114 private:
114 WebVTTParser(WebVTTParserClient*, Document&); 115 WebVTTParser(WebVTTParserClient*, Document&);
115 116
116 Document* m_document; 117 Document* m_document;
117 ParseState m_state; 118 ParseState m_state;
118 119
120 void parse(const String& textData);
121 void flushPendingCue();
119 bool hasRequiredFileIdentifier(const String& line); 122 bool hasRequiredFileIdentifier(const String& line);
120 ParseState collectCueId(const String&); 123 ParseState collectCueId(const String&);
121 ParseState collectTimingsAndSettings(const String&); 124 ParseState collectTimingsAndSettings(const String&);
122 ParseState collectCueText(const String&, bool); 125 ParseState collectCueText(const String&);
123 ParseState ignoreBadCue(const String&); 126 ParseState ignoreBadCue(const String&);
124 127
125 void createNewCue(); 128 void createNewCue();
126 void resetCueValues(); 129 void resetCueValues();
127 130
128 void collectMetadataHeader(const String&); 131 void collectMetadataHeader(const String&);
129 void createNewRegion(); 132 void createNewRegion();
130 133
131 void skipWhiteSpace(const String&, unsigned*); 134 void skipWhiteSpace(const String&, unsigned*);
132 static void skipLineTerminator(const String& data, unsigned*); 135 static void skipLineTerminator(const String& data, unsigned*);
(...skipping 12 matching lines...) Expand all
145 WebVTTParserClient* m_client; 148 WebVTTParserClient* m_client;
146 149
147 Vector<RefPtr<TextTrackCue> > m_cuelist; 150 Vector<RefPtr<TextTrackCue> > m_cuelist;
148 151
149 Vector<RefPtr<VTTRegion> > m_regionList; 152 Vector<RefPtr<VTTRegion> > m_regionList;
150 }; 153 };
151 154
152 } // namespace WebCore 155 } // namespace WebCore
153 156
154 #endif 157 #endif
OLDNEW
« no previous file with comments | « LayoutTests/media/track/captions-webvtt/captions-multiline-lf.vtt ('k') | Source/core/html/track/WebVTTParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698