Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Side by Side Diff: Source/core/html/track/vtt/VTTRegion.cpp

Issue 139343006: Rework float value/percentage scanning for VTTRegion (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 { 241 {
242 DEFINE_STATIC_LOCAL(const AtomicString, scrollUpValueKeyword, ("up", AtomicS tring::ConstructFromLiteral)); 242 DEFINE_STATIC_LOCAL(const AtomicString, scrollUpValueKeyword, ("up", AtomicS tring::ConstructFromLiteral));
243 243
244 switch (setting) { 244 switch (setting) {
245 case Id: 245 case Id:
246 if (value.find("-->") == kNotFound) 246 if (value.find("-->") == kNotFound)
247 m_id = value; 247 m_id = value;
248 break; 248 break;
249 case Width: { 249 case Width: {
250 float floatWidth; 250 float floatWidth;
251 if (VTTParser::parseFloatPercentageValue(value, floatWidth)) 251 VTTScanner valueScanner(value);
252 if (VTTParser::parseFloatPercentageValue(valueScanner, floatWidth) && va lueScanner.isAtEnd())
252 m_width = floatWidth; 253 m_width = floatWidth;
253 else 254 else
254 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width"); 255 WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width");
255 break; 256 break;
256 } 257 }
257 case Height: { 258 case Height: {
258 unsigned position = 0; 259 unsigned position = 0;
259 int number; 260 int number;
260 if (VTTParser::collectDigitsToInt(value, &position, number) && position == value.length()) 261 if (VTTParser::collectDigitsToInt(value, &position, number) && position == value.length())
261 m_heightInLines = number; 262 m_heightInLines = number;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 450
450 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) 451 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*)
451 { 452 {
452 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); 453 WTF_LOG(Media, "VTTRegion::scrollTimerFired");
453 454
454 stopTimer(); 455 stopTimer();
455 displayLastVTTCueBox(); 456 displayLastVTTCueBox();
456 } 457 }
457 458
458 } // namespace WebCore 459 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698