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

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

Issue 143983002: Rework end-of-value field handling in VTTRegion::parseSettingValue (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
« no previous file with comments | « Source/core/html/track/vtt/VTTParser.cpp ('k') | Source/core/html/track/vtt/VTTScanner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTParser.cpp ('k') | Source/core/html/track/vtt/VTTScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698