Chromium Code Reviews| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; | 238 bool isValidSetting; |
| 239 String numberAsString; | 239 String numberAsString; |
| 240 int number; | 240 int number; |
| 241 unsigned position; | |
| 242 FloatPoint anchorPosition; | 241 FloatPoint anchorPosition; |
| 243 | 242 |
| 244 switch (setting) { | 243 switch (setting) { |
| 245 case Id: | 244 case Id: |
| 246 if (value.find("-->") == kNotFound) | 245 if (value.find("-->") == kNotFound) |
| 247 m_id = value; | 246 m_id = value; |
| 248 break; | 247 break; |
| 249 case Width: | 248 case Width: |
| 250 number = VTTParser::parseFloatPercentageValue(value, isValidSetting); | 249 number = VTTParser::parseFloatPercentageValue(value, isValidSetting); |
| 251 if (isValidSetting) | 250 if (isValidSetting) |
| 252 m_width = number; | 251 m_width = number; |
| 253 else | 252 else |
| 254 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width"); | 253 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width"); |
| 255 break; | 254 break; |
| 256 case Height: | 255 case Height: { |
| 257 position = 0; | 256 unsigned position = 0; |
| 258 | 257 if (VTTParser::collectDigitsToInt(value, &position, number) && position == value.length()) |
| 259 numberAsString = VTTParser::collectDigits(value, &position); | |
| 260 number = value.toInt(&isValidSetting); | |
| 261 | |
| 262 if (isValidSetting && number >= 0) | |
| 263 m_heightInLines = number; | 258 m_heightInLines = number; |
| 264 else | 259 else |
| 265 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height"); | 260 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height"); |
| 266 break; | 261 break; |
| 262 } | |
|
Mike West
2013/12/03 13:55:41
Why did you add the '{' and '}'?
jochen (gone - plz use gerrit)
2013/12/03 14:48:37
So the unsigned position in line 256 is properly s
| |
| 267 case RegionAnchor: | 263 case RegionAnchor: |
| 268 anchorPosition = VTTParser::parseFloatPercentageValuePair(value, ',', is ValidSetting); | 264 anchorPosition = VTTParser::parseFloatPercentageValuePair(value, ',', is ValidSetting); |
| 269 if (isValidSetting) | 265 if (isValidSetting) |
| 270 m_regionAnchor = anchorPosition; | 266 m_regionAnchor = anchorPosition; |
| 271 else | 267 else |
| 272 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid RegionAnchor") ; | 268 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid RegionAnchor") ; |
| 273 break; | 269 break; |
| 274 case ViewportAnchor: | 270 case ViewportAnchor: |
| 275 anchorPosition = VTTParser::parseFloatPercentageValuePair(value, ',', is ValidSetting); | 271 anchorPosition = VTTParser::parseFloatPercentageValuePair(value, ',', is ValidSetting); |
| 276 if (isValidSetting) | 272 if (isValidSetting) |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 | 468 |
| 473 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) | 469 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) |
| 474 { | 470 { |
| 475 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); | 471 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); |
| 476 | 472 |
| 477 stopTimer(); | 473 stopTimer(); |
| 478 displayLastTextTrackCueBox(); | 474 displayLastTextTrackCueBox(); |
| 479 } | 475 } |
| 480 | 476 |
| 481 } // namespace WebCore | 477 } // namespace WebCore |
| OLD | NEW |