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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLTrackElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTrackElement.cpp b/third_party/WebKit/Source/core/html/HTMLTrackElement.cpp
index d9a9108db84e47dbe6ea33b0f85e5cc76b3d113c..7dc0f0cdeb783572f0aab8a84e7974b45f99efda 100644
--- a/third_party/WebKit/Source/core/html/HTMLTrackElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTrackElement.cpp
@@ -94,7 +94,15 @@ void HTMLTrackElement::parseAttribute(const QualifiedName& name, const AtomicStr
// 4.8.10.12.3 Sourcing out-of-band text tracks
// As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly...
} else if (name == kindAttr) {
- track()->setKind(!value.isNull() ? value.lower() : TextTrack::subtitlesKeyword());
+ AtomicString lowerCaseValue = value.lower();
+ // 'missing value default' ("subtitles")
+ if (lowerCaseValue.isNull())
+ lowerCaseValue = TextTrack::subtitlesKeyword();
+ // 'invalid value default' ("metadata")
+ else if (!TextTrack::isValidKindKeyword(lowerCaseValue))
+ lowerCaseValue = TextTrack::metadataKeyword();
+
+ track()->setKind(lowerCaseValue);
} else if (name == labelAttr) {
track()->setLabel(value);
} else if (name == srclangAttr) {
« 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