OLD | NEW |
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 Loading... |
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 |
OLD | NEW |