| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if (setting == scrollKeyword) | 228 if (setting == scrollKeyword) |
| 229 return Scroll; | 229 return Scroll; |
| 230 | 230 |
| 231 return None; | 231 return None; |
| 232 } | 232 } |
| 233 | 233 |
| 234 void VTTRegion::parseSettingValue(RegionSetting setting, const String& value) | 234 void VTTRegion::parseSettingValue(RegionSetting setting, const String& value) |
| 235 { | 235 { |
| 236 DEFINE_STATIC_LOCAL(const AtomicString, scrollUpValueKeyword, ("up", AtomicS
tring::ConstructFromLiteral)); | 236 DEFINE_STATIC_LOCAL(const AtomicString, scrollUpValueKeyword, ("up", AtomicS
tring::ConstructFromLiteral)); |
| 237 | 237 |
| 238 bool isValidSetting; | |
| 239 String numberAsString; | |
| 240 int number; | |
| 241 FloatPoint anchorPosition; | |
| 242 | |
| 243 switch (setting) { | 238 switch (setting) { |
| 244 case Id: | 239 case Id: |
| 245 if (value.find("-->") == kNotFound) | 240 if (value.find("-->") == kNotFound) |
| 246 m_id = value; | 241 m_id = value; |
| 247 break; | 242 break; |
| 248 case Width: | 243 case Width: { |
| 249 number = VTTParser::parseFloatPercentageValue(value, isValidSetting); | 244 float floatWidth; |
| 250 if (isValidSetting) | 245 if (VTTParser::parseFloatPercentageValue(value, floatWidth)) |
| 251 m_width = number; | 246 m_width = floatWidth; |
| 252 else | 247 else |
| 253 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width"); | 248 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width"); |
| 254 break; | 249 break; |
| 250 } |
| 255 case Height: { | 251 case Height: { |
| 256 unsigned position = 0; | 252 unsigned position = 0; |
| 253 int number; |
| 257 if (VTTParser::collectDigitsToInt(value, &position, number) && position
== value.length()) | 254 if (VTTParser::collectDigitsToInt(value, &position, number) && position
== value.length()) |
| 258 m_heightInLines = number; | 255 m_heightInLines = number; |
| 259 else | 256 else |
| 260 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height"); | 257 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height"); |
| 261 break; | 258 break; |
| 262 } | 259 } |
| 263 case RegionAnchor: | 260 case RegionAnchor: |
| 264 anchorPosition = VTTParser::parseFloatPercentageValuePair(value, ',', is
ValidSetting); | 261 if (!VTTParser::parseFloatPercentageValuePair(value, ',', m_regionAnchor
)) |
| 265 if (isValidSetting) | |
| 266 m_regionAnchor = anchorPosition; | |
| 267 else | |
| 268 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid RegionAnchor")
; | 262 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid RegionAnchor")
; |
| 269 break; | 263 break; |
| 270 case ViewportAnchor: | 264 case ViewportAnchor: |
| 271 anchorPosition = VTTParser::parseFloatPercentageValuePair(value, ',', is
ValidSetting); | 265 if (!VTTParser::parseFloatPercentageValuePair(value, ',', m_viewportAnch
or)) |
| 272 if (isValidSetting) | |
| 273 m_viewportAnchor = anchorPosition; | |
| 274 else | |
| 275 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid ViewportAnchor
"); | 266 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid ViewportAnchor
"); |
| 276 break; | 267 break; |
| 277 case Scroll: | 268 case Scroll: |
| 278 if (value == scrollUpValueKeyword) | 269 if (value == scrollUpValueKeyword) |
| 279 m_scroll = true; | 270 m_scroll = true; |
| 280 else | 271 else |
| 281 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Scroll"); | 272 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Scroll"); |
| 282 break; | 273 break; |
| 283 case None: | 274 case None: |
| 284 break; | 275 break; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 457 |
| 467 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) | 458 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) |
| 468 { | 459 { |
| 469 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); | 460 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); |
| 470 | 461 |
| 471 stopTimer(); | 462 stopTimer(); |
| 472 displayLastVTTCueBox(); | 463 displayLastVTTCueBox(); |
| 473 } | 464 } |
| 474 | 465 |
| 475 } // namespace WebCore | 466 } // namespace WebCore |
| OLD | NEW |