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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 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) 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 parent->didAddTrackElement(this); 70 parent->didAddTrackElement(this);
71 return InsertionDone; 71 return InsertionDone;
72 } 72 }
73 73
74 void HTMLTrackElement::removedFrom(ContainerNode* insertionPoint) { 74 void HTMLTrackElement::removedFrom(ContainerNode* insertionPoint) {
75 if (!parentNode() && isHTMLMediaElement(*insertionPoint)) 75 if (!parentNode() && isHTMLMediaElement(*insertionPoint))
76 toHTMLMediaElement(insertionPoint)->didRemoveTrackElement(this); 76 toHTMLMediaElement(insertionPoint)->didRemoveTrackElement(this);
77 HTMLElement::removedFrom(insertionPoint); 77 HTMLElement::removedFrom(insertionPoint);
78 } 78 }
79 79
80 void HTMLTrackElement::parseAttribute(const QualifiedName& name, 80 void HTMLTrackElement::parseAttribute(
81 const AtomicString& oldValue, 81 const AttributeModificationParams& params) {
82 const AtomicString& value) { 82 const QualifiedName& name = params.name;
83 if (name == srcAttr) { 83 if (name == srcAttr) {
84 if (!value.isEmpty()) 84 if (!params.newValue.isEmpty())
85 scheduleLoad(); 85 scheduleLoad();
86 else if (m_track) 86 else if (m_track)
87 m_track->removeAllCues(); 87 m_track->removeAllCues();
88 88
89 // 4.8.10.12.3 Sourcing out-of-band text tracks 89 // 4.8.10.12.3 Sourcing out-of-band text tracks
90 // As the kind, label, and srclang attributes are set, changed, or removed, 90 // As the kind, label, and srclang attributes are set, changed, or removed,
91 // the text track must update accordingly... 91 // the text track must update accordingly...
92 } else if (name == kindAttr) { 92 } else if (name == kindAttr) {
93 AtomicString lowerCaseValue = value.lower(); 93 AtomicString lowerCaseValue = params.newValue.lower();
94 // 'missing value default' ("subtitles") 94 // 'missing value default' ("subtitles")
95 if (lowerCaseValue.isNull()) 95 if (lowerCaseValue.isNull())
96 lowerCaseValue = TextTrack::subtitlesKeyword(); 96 lowerCaseValue = TextTrack::subtitlesKeyword();
97 // 'invalid value default' ("metadata") 97 // 'invalid value default' ("metadata")
98 else if (!TextTrack::isValidKindKeyword(lowerCaseValue)) 98 else if (!TextTrack::isValidKindKeyword(lowerCaseValue))
99 lowerCaseValue = TextTrack::metadataKeyword(); 99 lowerCaseValue = TextTrack::metadataKeyword();
100 100
101 track()->setKind(lowerCaseValue); 101 track()->setKind(lowerCaseValue);
102 } else if (name == labelAttr) { 102 } else if (name == labelAttr) {
103 track()->setLabel(value); 103 track()->setLabel(params.newValue);
104 } else if (name == srclangAttr) { 104 } else if (name == srclangAttr) {
105 track()->setLanguage(value); 105 track()->setLanguage(params.newValue);
106 } else if (name == idAttr) { 106 } else if (name == idAttr) {
107 track()->setId(value); 107 track()->setId(params.newValue);
108 } 108 }
109 109
110 HTMLElement::parseAttribute(name, oldValue, value); 110 HTMLElement::parseAttribute(params);
111 } 111 }
112 112
113 const AtomicString& HTMLTrackElement::kind() { 113 const AtomicString& HTMLTrackElement::kind() {
114 return track()->kind(); 114 return track()->kind();
115 } 115 }
116 116
117 void HTMLTrackElement::setKind(const AtomicString& kind) { 117 void HTMLTrackElement::setKind(const AtomicString& kind) {
118 setAttribute(kindAttr, kind); 118 setAttribute(kindAttr, kind);
119 } 119 }
120 120
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 return nullptr; 345 return nullptr;
346 } 346 }
347 347
348 DEFINE_TRACE(HTMLTrackElement) { 348 DEFINE_TRACE(HTMLTrackElement) {
349 visitor->trace(m_track); 349 visitor->trace(m_track);
350 visitor->trace(m_loader); 350 visitor->trace(m_loader);
351 HTMLElement::trace(visitor); 351 HTMLElement::trace(visitor);
352 } 352 }
353 353
354 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTrackElement.h ('k') | third_party/WebKit/Source/core/html/HTMLVideoElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698