OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 case Width: { | 249 case Width: { |
250 float floatWidth; | 250 float floatWidth; |
251 VTTScanner valueScanner(value); | 251 VTTScanner valueScanner(value); |
252 if (VTTParser::parseFloatPercentageValue(valueScanner, floatWidth) && va
lueScanner.isAtEnd()) | 252 if (VTTParser::parseFloatPercentageValue(valueScanner, floatWidth) && va
lueScanner.isAtEnd()) |
253 m_width = floatWidth; | 253 m_width = floatWidth; |
254 else | 254 else |
255 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width"); | 255 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width"); |
256 break; | 256 break; |
257 } | 257 } |
258 case Height: { | 258 case Height: { |
259 unsigned position = 0; | |
260 int number; | 259 int number; |
261 if (VTTParser::collectDigitsToInt(value, &position, number) && position
== value.length()) | 260 VTTScanner valueScanner(value); |
| 261 if (valueScanner.scanDigits(number) && valueScanner.isAtEnd()) |
262 m_heightInLines = number; | 262 m_heightInLines = number; |
263 else | 263 else |
264 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height"); | 264 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height"); |
265 break; | 265 break; |
266 } | 266 } |
267 case RegionAnchor: | 267 case RegionAnchor: { |
268 if (!VTTParser::parseFloatPercentageValuePair(value, ',', m_regionAnchor
)) | 268 VTTScanner valueScanner(value); |
| 269 FloatPoint anchor; |
| 270 if (VTTParser::parseFloatPercentageValuePair(valueScanner, ',', anchor)
&& valueScanner.isAtEnd()) |
| 271 m_regionAnchor = anchor; |
| 272 else |
269 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid RegionAnchor")
; | 273 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid RegionAnchor")
; |
270 break; | 274 break; |
271 case ViewportAnchor: | 275 } |
272 if (!VTTParser::parseFloatPercentageValuePair(value, ',', m_viewportAnch
or)) | 276 case ViewportAnchor: { |
| 277 VTTScanner valueScanner(value); |
| 278 FloatPoint anchor; |
| 279 if (VTTParser::parseFloatPercentageValuePair(valueScanner, ',', anchor)
&& valueScanner.isAtEnd()) |
| 280 m_viewportAnchor = anchor; |
| 281 else |
273 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid ViewportAnchor
"); | 282 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid ViewportAnchor
"); |
274 break; | 283 break; |
| 284 } |
275 case Scroll: | 285 case Scroll: |
276 if (value == scrollUpValueKeyword) | 286 if (value == scrollUpValueKeyword) |
277 m_scroll = true; | 287 m_scroll = true; |
278 else | 288 else |
279 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Scroll"); | 289 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Scroll"); |
280 break; | 290 break; |
281 case None: | 291 case None: |
282 break; | 292 break; |
283 } | 293 } |
284 } | 294 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 460 |
451 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) | 461 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) |
452 { | 462 { |
453 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); | 463 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); |
454 | 464 |
455 stopTimer(); | 465 stopTimer(); |
456 displayLastVTTCueBox(); | 466 displayLastVTTCueBox(); |
457 } | 467 } |
458 | 468 |
459 } // namespace WebCore | 469 } // namespace WebCore |
OLD | NEW |