| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 switch (setting) { | 252 switch (setting) { |
| 253 case Id: | 253 case Id: |
| 254 if (value.find("-->") == notFound) | 254 if (value.find("-->") == notFound) |
| 255 m_id = value; | 255 m_id = value; |
| 256 break; | 256 break; |
| 257 case Width: | 257 case Width: |
| 258 number = WebVTTParser::parseFloatPercentageValue(value, isValidSetting); | 258 number = WebVTTParser::parseFloatPercentageValue(value, isValidSetting); |
| 259 if (isValidSetting) | 259 if (isValidSetting) |
| 260 m_width = number; | 260 m_width = number; |
| 261 else | 261 else |
| 262 LOG(Media, "TextTrackRegion::parseSettingValue, invalid Width"); | 262 LOG_INFO(Media, "TextTrackRegion::parseSettingValue, invalid Width")
; |
| 263 break; | 263 break; |
| 264 case Height: | 264 case Height: |
| 265 position = 0; | 265 position = 0; |
| 266 | 266 |
| 267 numberAsString = WebVTTParser::collectDigits(value, &position); | 267 numberAsString = WebVTTParser::collectDigits(value, &position); |
| 268 number = value.toInt(&isValidSetting); | 268 number = value.toInt(&isValidSetting); |
| 269 | 269 |
| 270 if (isValidSetting && number >= 0) | 270 if (isValidSetting && number >= 0) |
| 271 m_heightInLines = number; | 271 m_heightInLines = number; |
| 272 else | 272 else |
| 273 LOG(Media, "TextTrackRegion::parseSettingValue, invalid Height"); | 273 LOG_INFO(Media, "TextTrackRegion::parseSettingValue, invalid Height"
); |
| 274 break; | 274 break; |
| 275 case RegionAnchor: | 275 case RegionAnchor: |
| 276 anchorPosition = WebVTTParser::parseFloatPercentageValuePair(value, ',',
isValidSetting); | 276 anchorPosition = WebVTTParser::parseFloatPercentageValuePair(value, ',',
isValidSetting); |
| 277 if (isValidSetting) | 277 if (isValidSetting) |
| 278 m_regionAnchor = anchorPosition; | 278 m_regionAnchor = anchorPosition; |
| 279 else | 279 else |
| 280 LOG(Media, "TextTrackRegion::parseSettingValue, invalid RegionAnchor
"); | 280 LOG_INFO(Media, "TextTrackRegion::parseSettingValue, invalid RegionA
nchor"); |
| 281 break; | 281 break; |
| 282 case ViewportAnchor: | 282 case ViewportAnchor: |
| 283 anchorPosition = WebVTTParser::parseFloatPercentageValuePair(value, ',',
isValidSetting); | 283 anchorPosition = WebVTTParser::parseFloatPercentageValuePair(value, ',',
isValidSetting); |
| 284 if (isValidSetting) | 284 if (isValidSetting) |
| 285 m_viewportAnchor = anchorPosition; | 285 m_viewportAnchor = anchorPosition; |
| 286 else | 286 else |
| 287 LOG(Media, "TextTrackRegion::parseSettingValue, invalid ViewportAnch
or"); | 287 LOG_INFO(Media, "TextTrackRegion::parseSettingValue, invalid Viewpor
tAnchor"); |
| 288 break; | 288 break; |
| 289 case Scroll: | 289 case Scroll: |
| 290 if (value == scrollUpValueKeyword) | 290 if (value == scrollUpValueKeyword) |
| 291 m_scroll = true; | 291 m_scroll = true; |
| 292 else | 292 else |
| 293 LOG(Media, "TextTrackRegion::parseSettingValue, invalid Scroll"); | 293 LOG_INFO(Media, "TextTrackRegion::parseSettingValue, invalid Scroll"
); |
| 294 break; | 294 break; |
| 295 case None: | 295 case None: |
| 296 break; | 296 break; |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 void TextTrackRegion::parseSetting(const String& input, unsigned* position) | 300 void TextTrackRegion::parseSetting(const String& input, unsigned* position) |
| 301 { | 301 { |
| 302 String setting = WebVTTParser::collectWord(input, position); | 302 String setting = WebVTTParser::collectWord(input, position); |
| 303 | 303 |
| 304 size_t equalOffset = setting.find('=', 1); | 304 size_t equalOffset = setting.find('=', 1); |
| 305 if (equalOffset == notFound || !equalOffset || equalOffset == setting.length
() - 1) | 305 if (equalOffset == notFound || !equalOffset || equalOffset == setting.length
() - 1) |
| 306 return; | 306 return; |
| 307 | 307 |
| 308 RegionSetting name = getSettingFromString(setting.substring(0, equalOffset))
; | 308 RegionSetting name = getSettingFromString(setting.substring(0, equalOffset))
; |
| 309 String value = setting.substring(equalOffset + 1, setting.length() - 1); | 309 String value = setting.substring(equalOffset + 1, setting.length() - 1); |
| 310 | 310 |
| 311 parseSettingValue(name, value); | 311 parseSettingValue(name, value); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace WebCore | 314 } // namespace WebCore |
| 315 | 315 |
| 316 #endif | 316 #endif |
| OLD | NEW |