| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 // When the user agent is to parse the WebVTT settings given by a string
input for a text track cue cue, | 924 // When the user agent is to parse the WebVTT settings given by a string
input for a text track cue cue, |
| 925 // the user agent must run the following steps: | 925 // the user agent must run the following steps: |
| 926 // 1. Let settings be the result of splitting input on spaces. | 926 // 1. Let settings be the result of splitting input on spaces. |
| 927 // 2. For each token setting in the list settings, run the following sub
steps: | 927 // 2. For each token setting in the list settings, run the following sub
steps: |
| 928 // 1. If setting does not contain a U+003A COLON character (:), or if
the first U+003A COLON character (:) | 928 // 1. If setting does not contain a U+003A COLON character (:), or if
the first U+003A COLON character (:) |
| 929 // in setting is either the first or last character of setting, th
en jump to the step labeled next setting. | 929 // in setting is either the first or last character of setting, th
en jump to the step labeled next setting. |
| 930 unsigned endOfSetting = position; | 930 unsigned endOfSetting = position; |
| 931 String setting = WebVTTParser::collectWord(input, &endOfSetting); | 931 String setting = WebVTTParser::collectWord(input, &endOfSetting); |
| 932 CueSetting name; | 932 CueSetting name; |
| 933 size_t colonOffset = setting.find(':', 1); | 933 size_t colonOffset = setting.find(':', 1); |
| 934 if (colonOffset == notFound || colonOffset == 0 || colonOffset == settin
g.length() - 1) | 934 if (colonOffset == kNotFound || !colonOffset || colonOffset == setting.l
ength() - 1) |
| 935 goto NextSetting; | 935 goto NextSetting; |
| 936 | 936 |
| 937 // 2. Let name be the leading substring of setting up to and excluding t
he first U+003A COLON character (:) in that string. | 937 // 2. Let name be the leading substring of setting up to and excluding t
he first U+003A COLON character (:) in that string. |
| 938 name = settingName(setting.substring(0, colonOffset)); | 938 name = settingName(setting.substring(0, colonOffset)); |
| 939 | 939 |
| 940 // 3. Let value be the trailing substring of setting starting from the c
haracter immediately after the first U+003A COLON character (:) in that string. | 940 // 3. Let value be the trailing substring of setting starting from the c
haracter immediately after the first U+003A COLON character (:) in that string. |
| 941 position += colonOffset + 1; | 941 position += colonOffset + 1; |
| 942 if (position >= input.length()) | 942 if (position >= input.length()) |
| 943 break; | 943 break; |
| 944 | 944 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 971 if (position < input.length() && !WebVTTParser::isValidSettingDelimi
ter(input[position])) | 971 if (position < input.length() && !WebVTTParser::isValidSettingDelimi
ter(input[position])) |
| 972 break; | 972 break; |
| 973 | 973 |
| 974 // 2. If value does not contain at least one character in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT | 974 // 2. If value does not contain at least one character in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT |
| 975 // NINE (9), then jump to the step labeled next setting. | 975 // NINE (9), then jump to the step labeled next setting. |
| 976 // 3. If any character in value other than the first character is a
U+002D HYPHEN-MINUS character (-), then | 976 // 3. If any character in value other than the first character is a
U+002D HYPHEN-MINUS character (-), then |
| 977 // jump to the step labeled next setting. | 977 // jump to the step labeled next setting. |
| 978 // 4. If any character in value other than the last character is a U
+0025 PERCENT SIGN character (%), then | 978 // 4. If any character in value other than the last character is a U
+0025 PERCENT SIGN character (%), then |
| 979 // jump to the step labeled next setting. | 979 // jump to the step labeled next setting. |
| 980 String linePosition = linePositionBuilder.toString(); | 980 String linePosition = linePositionBuilder.toString(); |
| 981 if (linePosition.find('-', 1) != notFound || linePosition.reverseFin
d("%", linePosition.length() - 2) != notFound) | 981 if (linePosition.find('-', 1) != kNotFound || linePosition.reverseFi
nd("%", linePosition.length() - 2) != kNotFound) |
| 982 break; | 982 break; |
| 983 | 983 |
| 984 // 5. If the first character in value is a U+002D HYPHEN-MINUS chara
cter (-) and the last character in value is a | 984 // 5. If the first character in value is a U+002D HYPHEN-MINUS chara
cter (-) and the last character in value is a |
| 985 // U+0025 PERCENT SIGN character (%), then jump to the step label
ed next setting. | 985 // U+0025 PERCENT SIGN character (%), then jump to the step label
ed next setting. |
| 986 if (linePosition[0] == '-' && linePosition[linePosition.length() - 1
] == '%') | 986 if (linePosition[0] == '-' && linePosition[linePosition.length() - 1
] == '%') |
| 987 break; | 987 break; |
| 988 | 988 |
| 989 // 6. Ignoring the trailing percent sign, if any, interpret value as
a (potentially signed) integer, and | 989 // 6. Ignoring the trailing percent sign, if any, interpret value as
a (potentially signed) integer, and |
| 990 // let number be that number. | 990 // let number be that number. |
| 991 // NOTE: toInt ignores trailing non-digit characters, such as '%'. | 991 // NOTE: toInt ignores trailing non-digit characters, such as '%'. |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 return false; | 1184 return false; |
| 1185 if (m_cueSize != cue.size()) | 1185 if (m_cueSize != cue.size()) |
| 1186 return false; | 1186 return false; |
| 1187 if (align() != cue.align()) | 1187 if (align() != cue.align()) |
| 1188 return false; | 1188 return false; |
| 1189 | 1189 |
| 1190 return true; | 1190 return true; |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 } // namespace WebCore | 1193 } // namespace WebCore |
| OLD | NEW |