| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 matched = WTF::equal(m_data.characters8, characters, charactersCount); | 60 matched = WTF::equal(m_data.characters8, characters, charactersCount); |
| 61 else | 61 else |
| 62 matched = WTF::equal(m_data.characters16, characters, charactersCount); | 62 matched = WTF::equal(m_data.characters16, characters, charactersCount); |
| 63 if (matched) | 63 if (matched) |
| 64 advance(charactersCount); | 64 advance(charactersCount); |
| 65 return matched; | 65 return matched; |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool VTTScanner::scanRun(const Run& run, const String& toMatch) | 68 bool VTTScanner::scanRun(const Run& run, const String& toMatch) |
| 69 { | 69 { |
| 70 ASSERT(run.start() == getPosition()); | 70 DCHECK_EQ(run.start(), getPosition()); |
| 71 ASSERT(run.start() <= end()); | 71 DCHECK_LE(run.start(), end()); |
| 72 ASSERT(run.end() >= run.start()); | 72 DCHECK_GE(run.end(), run.start()); |
| 73 ASSERT(run.end() <= end()); | 73 DCHECK_LE(run.end(), end()); |
| 74 size_t matchLength = run.length(); | 74 size_t matchLength = run.length(); |
| 75 if (toMatch.length() > matchLength) | 75 if (toMatch.length() > matchLength) |
| 76 return false; | 76 return false; |
| 77 bool matched; | 77 bool matched; |
| 78 if (m_is8Bit) | 78 if (m_is8Bit) |
| 79 matched = WTF::equal(toMatch.impl(), m_data.characters8, matchLength); | 79 matched = WTF::equal(toMatch.impl(), m_data.characters8, matchLength); |
| 80 else | 80 else |
| 81 matched = WTF::equal(toMatch.impl(), m_data.characters16, matchLength); | 81 matched = WTF::equal(toMatch.impl(), m_data.characters16, matchLength); |
| 82 if (matched) | 82 if (matched) |
| 83 seekTo(run.end()); | 83 seekTo(run.end()); |
| 84 return matched; | 84 return matched; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void VTTScanner::skipRun(const Run& run) | 87 void VTTScanner::skipRun(const Run& run) |
| 88 { | 88 { |
| 89 ASSERT(run.start() <= end()); | 89 DCHECK_LE(run.start(), end()); |
| 90 ASSERT(run.end() >= run.start()); | 90 DCHECK_GE(run.end(), run.start()); |
| 91 ASSERT(run.end() <= end()); | 91 DCHECK_LE(run.end(), end()); |
| 92 seekTo(run.end()); | 92 seekTo(run.end()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 String VTTScanner::extractString(const Run& run) | 95 String VTTScanner::extractString(const Run& run) |
| 96 { | 96 { |
| 97 ASSERT(run.start() == getPosition()); | 97 DCHECK_EQ(run.start(), getPosition()); |
| 98 ASSERT(run.start() <= end()); | 98 DCHECK_LE(run.start(), end()); |
| 99 ASSERT(run.end() >= run.start()); | 99 DCHECK_GE(run.end(), run.start()); |
| 100 ASSERT(run.end() <= end()); | 100 DCHECK_LE(run.end(), end()); |
| 101 String s; | 101 String s; |
| 102 if (m_is8Bit) | 102 if (m_is8Bit) |
| 103 s = String(m_data.characters8, run.length()); | 103 s = String(m_data.characters8, run.length()); |
| 104 else | 104 else |
| 105 s = String(m_data.characters16, run.length()); | 105 s = String(m_data.characters16, run.length()); |
| 106 seekTo(run.end()); | 106 seekTo(run.end()); |
| 107 return s; | 107 return s; |
| 108 } | 108 } |
| 109 | 109 |
| 110 String VTTScanner::restOfInputAsString() | 110 String VTTScanner::restOfInputAsString() |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (!scanFloat(percentage)) | 173 if (!scanFloat(percentage)) |
| 174 return false; | 174 return false; |
| 175 if (scan('%')) | 175 if (scan('%')) |
| 176 return true; | 176 return true; |
| 177 // Restore scanner position. | 177 // Restore scanner position. |
| 178 seekTo(savedPosition); | 178 seekTo(savedPosition); |
| 179 return false; | 179 return false; |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |