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

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

Issue 2685943004: Remove TextTrack.regions and VTTRegionList (Closed)
Patch Set: Rebase Created 3 years, 10 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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/html/track/LoadableTextTrack.h" 26 #include "core/html/track/LoadableTextTrack.h"
27 27
28 #include "core/dom/ElementTraversal.h" 28 #include "core/dom/ElementTraversal.h"
29 #include "core/html/HTMLTrackElement.h" 29 #include "core/html/HTMLTrackElement.h"
30 #include "core/html/track/vtt/VTTRegionList.h"
31 30
32 namespace blink { 31 namespace blink {
33 32
34 LoadableTextTrack::LoadableTextTrack(HTMLTrackElement* track) 33 LoadableTextTrack::LoadableTextTrack(HTMLTrackElement* track)
35 : TextTrack(subtitlesKeyword(), 34 : TextTrack(subtitlesKeyword(),
36 emptyAtom, 35 emptyAtom,
37 emptyAtom, 36 emptyAtom,
38 emptyAtom, 37 emptyAtom,
39 TrackElement), 38 TrackElement),
40 m_trackElement(track) { 39 m_trackElement(track) {
41 DCHECK(m_trackElement); 40 DCHECK(m_trackElement);
42 } 41 }
43 42
44 LoadableTextTrack::~LoadableTextTrack() {} 43 LoadableTextTrack::~LoadableTextTrack() {}
45 44
46 bool LoadableTextTrack::isDefault() const { 45 bool LoadableTextTrack::isDefault() const {
47 return m_trackElement->fastHasAttribute(HTMLNames::defaultAttr); 46 return m_trackElement->fastHasAttribute(HTMLNames::defaultAttr);
48 } 47 }
49 48
50 void LoadableTextTrack::setMode(const AtomicString& mode) { 49 void LoadableTextTrack::setMode(const AtomicString& mode) {
51 TextTrack::setMode(mode); 50 TextTrack::setMode(mode);
52 if (m_trackElement->getReadyState() == HTMLTrackElement::kNone) 51 if (m_trackElement->getReadyState() == HTMLTrackElement::kNone)
53 m_trackElement->scheduleLoad(); 52 m_trackElement->scheduleLoad();
54 } 53 }
55 54
56 void LoadableTextTrack::addRegions(
57 const HeapVector<Member<VTTRegion>>& newRegions) {
58 for (const auto& region : newRegions)
59 regions()->add(region);
60 }
61
62 size_t LoadableTextTrack::trackElementIndex() const { 55 size_t LoadableTextTrack::trackElementIndex() const {
63 // Count the number of preceding <track> elements (== the index.) 56 // Count the number of preceding <track> elements (== the index.)
64 size_t index = 0; 57 size_t index = 0;
65 for (const HTMLTrackElement* track = 58 for (const HTMLTrackElement* track =
66 Traversal<HTMLTrackElement>::previousSibling(*m_trackElement); 59 Traversal<HTMLTrackElement>::previousSibling(*m_trackElement);
67 track; track = Traversal<HTMLTrackElement>::previousSibling(*track)) 60 track; track = Traversal<HTMLTrackElement>::previousSibling(*track))
68 ++index; 61 ++index;
69 62
70 return index; 63 return index;
71 } 64 }
72 65
73 DEFINE_TRACE(LoadableTextTrack) { 66 DEFINE_TRACE(LoadableTextTrack) {
74 visitor->trace(m_trackElement); 67 visitor->trace(m_trackElement);
75 TextTrack::trace(visitor); 68 TextTrack::trace(visitor);
76 } 69 }
77 70
78 } // namespace blink 71 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698