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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLTrackElement.cpp

Issue 1973343002: Clean up HTMLTrackElement.kind invalid/missing value default handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | third_party/WebKit/Source/core/html/track/AudioTrack.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 { 87 {
88 if (name == srcAttr) { 88 if (name == srcAttr) {
89 if (!value.isEmpty()) 89 if (!value.isEmpty())
90 scheduleLoad(); 90 scheduleLoad();
91 else if (m_track) 91 else if (m_track)
92 m_track->removeAllCues(); 92 m_track->removeAllCues();
93 93
94 // 4.8.10.12.3 Sourcing out-of-band text tracks 94 // 4.8.10.12.3 Sourcing out-of-band text tracks
95 // As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly... 95 // As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly...
96 } else if (name == kindAttr) { 96 } else if (name == kindAttr) {
97 track()->setKind(!value.isNull() ? value.lower() : TextTrack::subtitlesK eyword()); 97 AtomicString lowerCaseValue = value.lower();
98 // 'missing value default' ("subtitles")
99 if (lowerCaseValue.isNull())
100 lowerCaseValue = TextTrack::subtitlesKeyword();
101 // 'invalid value default' ("metadata")
102 else if (!TextTrack::isValidKindKeyword(lowerCaseValue))
103 lowerCaseValue = TextTrack::metadataKeyword();
104
105 track()->setKind(lowerCaseValue);
98 } else if (name == labelAttr) { 106 } else if (name == labelAttr) {
99 track()->setLabel(value); 107 track()->setLabel(value);
100 } else if (name == srclangAttr) { 108 } else if (name == srclangAttr) {
101 track()->setLanguage(value); 109 track()->setLanguage(value);
102 } else if (name == idAttr) { 110 } else if (name == idAttr) {
103 track()->setId(value); 111 track()->setId(value);
104 } 112 }
105 113
106 HTMLElement::parseAttribute(name, oldValue, value); 114 HTMLElement::parseAttribute(name, oldValue, value);
107 } 115 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 333 }
326 334
327 DEFINE_TRACE(HTMLTrackElement) 335 DEFINE_TRACE(HTMLTrackElement)
328 { 336 {
329 visitor->trace(m_track); 337 visitor->trace(m_track);
330 visitor->trace(m_loader); 338 visitor->trace(m_loader);
331 HTMLElement::trace(visitor); 339 HTMLElement::trace(visitor);
332 } 340 }
333 341
334 } // namespace blink 342 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/track/AudioTrack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698