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

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

Issue 2682333002: Implement VTTCue.region and sync the VTTRegion interface (Closed)
Patch Set: Add DCHECK 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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 void LoadableTextTrack::setMode(const AtomicString& mode) { 50 void LoadableTextTrack::setMode(const AtomicString& mode) {
51 TextTrack::setMode(mode); 51 TextTrack::setMode(mode);
52 if (m_trackElement->getReadyState() == HTMLTrackElement::kNone) 52 if (m_trackElement->getReadyState() == HTMLTrackElement::kNone)
53 m_trackElement->scheduleLoad(); 53 m_trackElement->scheduleLoad();
54 } 54 }
55 55
56 void LoadableTextTrack::addRegions( 56 void LoadableTextTrack::addRegions(
57 const HeapVector<Member<VTTRegion>>& newRegions) { 57 const HeapVector<Member<VTTRegion>>& newRegions) {
58 for (const auto& region : newRegions) { 58 for (const auto& region : newRegions)
59 region->setTrack(this);
60 regions()->add(region); 59 regions()->add(region);
61 }
62 } 60 }
63 61
64 size_t LoadableTextTrack::trackElementIndex() const { 62 size_t LoadableTextTrack::trackElementIndex() const {
65 // Count the number of preceding <track> elements (== the index.) 63 // Count the number of preceding <track> elements (== the index.)
66 size_t index = 0; 64 size_t index = 0;
67 for (const HTMLTrackElement* track = 65 for (const HTMLTrackElement* track =
68 Traversal<HTMLTrackElement>::previousSibling(*m_trackElement); 66 Traversal<HTMLTrackElement>::previousSibling(*m_trackElement);
69 track; track = Traversal<HTMLTrackElement>::previousSibling(*track)) 67 track; track = Traversal<HTMLTrackElement>::previousSibling(*track))
70 ++index; 68 ++index;
71 69
72 return index; 70 return index;
73 } 71 }
74 72
75 DEFINE_TRACE(LoadableTextTrack) { 73 DEFINE_TRACE(LoadableTextTrack) {
76 visitor->trace(m_trackElement); 74 visitor->trace(m_trackElement);
77 TextTrack::trace(visitor); 75 TextTrack::trace(visitor);
78 } 76 }
79 77
80 } // namespace blink 78 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp ('k') | third_party/WebKit/Source/core/html/track/vtt/VTTCue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698