| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/fetch/TextResourceDecoder.h" | 37 #include "core/fetch/TextResourceDecoder.h" |
| 38 #include "core/html/track/vtt/BufferedLineReader.h" | 38 #include "core/html/track/vtt/BufferedLineReader.h" |
| 39 #include "core/html/track/vtt/VTTCue.h" | 39 #include "core/html/track/vtt/VTTCue.h" |
| 40 #include "core/html/track/vtt/VTTRegion.h" | 40 #include "core/html/track/vtt/VTTRegion.h" |
| 41 #include "core/html/track/vtt/VTTTokenizer.h" | 41 #include "core/html/track/vtt/VTTTokenizer.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; | |
| 48 | |
| 49 class Document; | 47 class Document; |
| 50 class VTTScanner; | 48 class VTTScanner; |
| 51 | 49 |
| 52 class VTTParserClient { | 50 class VTTParserClient { |
| 53 public: | 51 public: |
| 54 virtual ~VTTParserClient() { } | 52 virtual ~VTTParserClient() { } |
| 55 | 53 |
| 56 virtual void newCuesParsed() = 0; | 54 virtual void newCuesParsed() = 0; |
| 57 virtual void newRegionsParsed() = 0; | 55 virtual void newRegionsParsed() = 0; |
| 58 virtual void fileFailedToParse() = 0; | 56 virtual void fileFailedToParse() = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 69 BadCue | 67 BadCue |
| 70 }; | 68 }; |
| 71 | 69 |
| 72 static PassOwnPtr<VTTParser> create(VTTParserClient* client, Document& docum
ent) | 70 static PassOwnPtr<VTTParser> create(VTTParserClient* client, Document& docum
ent) |
| 73 { | 71 { |
| 74 return adoptPtr(new VTTParser(client, document)); | 72 return adoptPtr(new VTTParser(client, document)); |
| 75 } | 73 } |
| 76 | 74 |
| 77 static inline bool isRecognizedTag(const AtomicString& tagName) | 75 static inline bool isRecognizedTag(const AtomicString& tagName) |
| 78 { | 76 { |
| 79 return tagName == iTag | 77 return tagName == HTMLNames::iTag |
| 80 || tagName == bTag | 78 || tagName == HTMLNames::bTag |
| 81 || tagName == uTag | 79 || tagName == HTMLNames::uTag |
| 82 || tagName == rubyTag | 80 || tagName == HTMLNames::rubyTag |
| 83 || tagName == rtTag; | 81 || tagName == HTMLNames::rtTag; |
| 84 } | 82 } |
| 85 static inline bool isASpace(UChar c) | 83 static inline bool isASpace(UChar c) |
| 86 { | 84 { |
| 87 // WebVTT space characters are U+0020 SPACE, U+0009 CHARACTER TABULATION
(tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN
(CR). | 85 // WebVTT space characters are U+0020 SPACE, U+0009 CHARACTER TABULATION
(tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN
(CR). |
| 88 return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'; | 86 return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'; |
| 89 } | 87 } |
| 90 static inline bool isValidSettingDelimiter(UChar c) | 88 static inline bool isValidSettingDelimiter(UChar c) |
| 91 { | 89 { |
| 92 // ... 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 |
| 93 // 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. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 VTTParserClient* m_client; | 144 VTTParserClient* m_client; |
| 147 | 145 |
| 148 Vector<RefPtr<VTTCue> > m_cuelist; | 146 Vector<RefPtr<VTTCue> > m_cuelist; |
| 149 | 147 |
| 150 Vector<RefPtr<VTTRegion> > m_regionList; | 148 Vector<RefPtr<VTTRegion> > m_regionList; |
| 151 }; | 149 }; |
| 152 | 150 |
| 153 } // namespace WebCore | 151 } // namespace WebCore |
| 154 | 152 |
| 155 #endif | 153 #endif |
| OLD | NEW |