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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
976 // Steps 1 - 2 skipped. | 976 // Steps 1 - 2 skipped. |
977 float number; | 977 float number; |
978 // 3. If linepos does not contain at least one ASCII digit, then | 978 // 3. If linepos does not contain at least one ASCII digit, then |
979 // jump to the step labeled next setting. | 979 // jump to the step labeled next setting. |
980 // 4. If the last character in linepos is a U+0025 PERCENT SIGN | 980 // 4. If the last character in linepos is a U+0025 PERCENT SIGN |
981 // character (%) | 981 // character (%) |
982 // | 982 // |
983 // If parse a percentage string from linepos doesn't fail, let | 983 // If parse a percentage string from linepos doesn't fail, let |
984 // number be the returned percentage, otherwise jump to the step | 984 // number be the returned percentage, otherwise jump to the step |
985 // labeled next setting. | 985 // labeled next setting. |
986 bool isPercentage = scanPercentage(input, number); | 986 bool isPercentage = input.scanPercentage(number); |
987 if (!isPercentage) { | 987 if (isPercentage) { |
988 if (isInvalidPercentage(number)) | |
989 break; | |
990 } else { | |
988 // Otherwise | 991 // Otherwise |
989 // | 992 // |
990 // 1. If linepos contains any characters other than U+002D | 993 // 1. If linepos contains any characters other than U+002D |
991 // HYPHEN-MINUS characters (-) and ASCII digits, then jump to | 994 // HYPHEN-MINUS characters (-), ASCII digits, and U+002E DOT |
992 // the step labeled next setting. | 995 // character (.), then jump to the step labeled next setting. |
993 // 2. If any character in linepos other than the first character is | 996 // |
994 // a U+002D HYPHEN-MINUS character (-), then jump to the step | 997 // 2. If any character in linepos other than the first character is a |
998 // U+002D HYPHEN-MINUS character (-), then jump to the step | |
995 // labeled next setting. | 999 // labeled next setting. |
1000 // | |
1001 // 3. If there are more than one U+002E DOT characters (.), then jump | |
1002 // to the step labeled next setting. | |
1003 // | |
1004 // 4. If there is a U+002E DOT character (.) and the character before | |
1005 // or the character after is not an ASCII digit, or if the U+002E | |
1006 // DOT character (.) is the first or the last character, then jump | |
1007 // to the step labeled next setting. | |
1008 // | |
1009 // 5. Interpret linepos as a (potentially signed) real number, and | |
foolip
2017/03/03 15:13:57
Hmm, strictly speaking I guess this is ambiguous f
fs
2017/03/03 15:21:03
Discussed this with the spec editor earlier today
foolip
2017/03/03 15:25:35
Yay :)
| |
1010 // let number be that number. | |
996 bool isNegative = input.scan('-'); | 1011 bool isNegative = input.scan('-'); |
997 int intLinePosition; | 1012 if (!input.scanFloat(number)) |
998 if (!input.scanDigits(intLinePosition)) | |
999 break; | 1013 break; |
1000 // 3. Interpret linepos as a (potentially signed) integer, and let | 1014 // Negate number if it was preceded by a hyphen-minus - unless it's |
1001 // number be that number. | 1015 // zero. |
1002 number = isNegative ? -intLinePosition : intLinePosition; | 1016 if (isNegative && number) |
1017 number = -number; | |
1003 } | 1018 } |
1004 if (!input.isAt(valueRun.end())) | 1019 if (!input.isAt(valueRun.end())) |
1005 break; | 1020 break; |
1006 // 5. Let cue's WebVTT cue line be number. | 1021 // 5. Let cue's WebVTT cue line be number. |
1007 m_linePosition = number; | 1022 m_linePosition = number; |
1008 // 6. If the last character in linepos is a U+0025 PERCENT SIGN | 1023 // 6. If the last character in linepos is a U+0025 PERCENT SIGN |
1009 // character (%), then let cue's WebVTT cue snap-to-lines | 1024 // character (%), then let cue's WebVTT cue snap-to-lines |
1010 // flag be false. Otherwise, let it be true. | 1025 // flag be false. Otherwise, let it be true. |
1011 m_snapToLines = !isPercentage; | 1026 m_snapToLines = !isPercentage; |
1012 // Steps 7 - 9 skipped. | 1027 // Steps 7 - 9 skipped. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1118 | 1133 |
1119 DEFINE_TRACE(VTTCue) { | 1134 DEFINE_TRACE(VTTCue) { |
1120 visitor->trace(m_region); | 1135 visitor->trace(m_region); |
1121 visitor->trace(m_vttNodeTree); | 1136 visitor->trace(m_vttNodeTree); |
1122 visitor->trace(m_cueBackgroundBox); | 1137 visitor->trace(m_cueBackgroundBox); |
1123 visitor->trace(m_displayTree); | 1138 visitor->trace(m_displayTree); |
1124 TextTrackCue::trace(visitor); | 1139 TextTrackCue::trace(visitor); |
1125 } | 1140 } |
1126 | 1141 |
1127 } // namespace blink | 1142 } // namespace blink |
OLD | NEW |