| 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 (size_t i = 0; i < newRegions.size(); ++i) { | 58 for (const auto& region : newRegions) { |
| 59 newRegions[i]->setTrack(this); | 59 region->setTrack(this); |
| 60 regions()->add(newRegions[i]); | 60 regions()->add(region); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 size_t LoadableTextTrack::trackElementIndex() const { | 64 size_t LoadableTextTrack::trackElementIndex() const { |
| 65 // Count the number of preceding <track> elements (== the index.) | 65 // Count the number of preceding <track> elements (== the index.) |
| 66 size_t index = 0; | 66 size_t index = 0; |
| 67 for (const HTMLTrackElement* track = | 67 for (const HTMLTrackElement* track = |
| 68 Traversal<HTMLTrackElement>::previousSibling(*m_trackElement); | 68 Traversal<HTMLTrackElement>::previousSibling(*m_trackElement); |
| 69 track; track = Traversal<HTMLTrackElement>::previousSibling(*track)) | 69 track; track = Traversal<HTMLTrackElement>::previousSibling(*track)) |
| 70 ++index; | 70 ++index; |
| 71 | 71 |
| 72 return index; | 72 return index; |
| 73 } | 73 } |
| 74 | 74 |
| 75 DEFINE_TRACE(LoadableTextTrack) { | 75 DEFINE_TRACE(LoadableTextTrack) { |
| 76 visitor->trace(m_trackElement); | 76 visitor->trace(m_trackElement); |
| 77 TextTrack::trace(visitor); | 77 TextTrack::trace(visitor); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace blink | 80 } // namespace blink |
| OLD | NEW |