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

Side by Side Diff: Source/core/html/track/TextTrack.cpp

Issue 55653003: Rename TextTrackRegion/TextTrackRegionList to VTTRegion/VTTRegionList (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update test expectations Created 7 years, 1 month 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
« no previous file with comments | « Source/core/html/track/TextTrack.h ('k') | Source/core/html/track/TextTrack.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 21 matching lines...) Expand all
32 #include "config.h" 32 #include "config.h"
33 #include "core/html/track/TextTrack.h" 33 #include "core/html/track/TextTrack.h"
34 34
35 #include "RuntimeEnabledFeatures.h" 35 #include "RuntimeEnabledFeatures.h"
36 #include "bindings/v8/ExceptionStatePlaceholder.h" 36 #include "bindings/v8/ExceptionStatePlaceholder.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ExceptionCode.h" 38 #include "core/dom/ExceptionCode.h"
39 #include "core/html/HTMLMediaElement.h" 39 #include "core/html/HTMLMediaElement.h"
40 #include "core/html/track/TextTrackCueList.h" 40 #include "core/html/track/TextTrackCueList.h"
41 #include "core/html/track/TextTrackList.h" 41 #include "core/html/track/TextTrackList.h"
42 #include "core/html/track/TextTrackRegion.h" 42 #include "core/html/track/VTTRegion.h"
43 #include "core/html/track/TextTrackRegionList.h" 43 #include "core/html/track/VTTRegionList.h"
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 static const int invalidTrackIndex = -1; 47 static const int invalidTrackIndex = -1;
48 48
49 const AtomicString& TextTrack::subtitlesKeyword() 49 const AtomicString& TextTrack::subtitlesKeyword()
50 { 50 {
51 DEFINE_STATIC_LOCAL(const AtomicString, subtitles, ("subtitles", AtomicStrin g::ConstructFromLiteral)); 51 DEFINE_STATIC_LOCAL(const AtomicString, subtitles, ("subtitles", AtomicStrin g::ConstructFromLiteral));
52 return subtitles; 52 return subtitles;
53 } 53 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (!m_cues || !m_cues->remove(cue)) { 272 if (!m_cues || !m_cues->remove(cue)) {
273 es.throwUninformativeAndGenericDOMException(InvalidStateError); 273 es.throwUninformativeAndGenericDOMException(InvalidStateError);
274 return; 274 return;
275 } 275 }
276 276
277 cue->setTrack(0); 277 cue->setTrack(0);
278 if (m_client) 278 if (m_client)
279 m_client->textTrackRemoveCue(this, cue); 279 m_client->textTrackRemoveCue(this, cue);
280 } 280 }
281 281
282 TextTrackRegionList* TextTrack::ensureTextTrackRegionList() 282 VTTRegionList* TextTrack::ensureVTTRegionList()
283 { 283 {
284 if (!m_regions) 284 if (!m_regions)
285 m_regions = TextTrackRegionList::create(); 285 m_regions = VTTRegionList::create();
286 286
287 return m_regions.get(); 287 return m_regions.get();
288 } 288 }
289 289
290 TextTrackRegionList* TextTrack::regions() 290 VTTRegionList* TextTrack::regions()
291 { 291 {
292 // If the text track mode of the text track that the TextTrack object 292 // If the text track mode of the text track that the TextTrack object
293 // represents is not the text track disabled mode, then the regions 293 // represents is not the text track disabled mode, then the regions
294 // attribute must return a live TextTrackRegionList object that represents 294 // attribute must return a live VTTRegionList object that represents
295 // the text track list of regions of the text track. Otherwise, it must 295 // the text track list of regions of the text track. Otherwise, it must
296 // return null. When an object is returned, the same object must be returned 296 // return null. When an object is returned, the same object must be returned
297 // each time. 297 // each time.
298 if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && m_mode != disabledKeyw ord()) 298 if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && m_mode != disabledKeyw ord())
299 return ensureTextTrackRegionList(); 299 return ensureVTTRegionList();
300 return 0; 300 return 0;
301 } 301 }
302 302
303 void TextTrack::addRegion(PassRefPtr<TextTrackRegion> prpRegion) 303 void TextTrack::addRegion(PassRefPtr<VTTRegion> prpRegion)
304 { 304 {
305 if (!prpRegion) 305 if (!prpRegion)
306 return; 306 return;
307 307
308 RefPtr<TextTrackRegion> region = prpRegion; 308 RefPtr<VTTRegion> region = prpRegion;
309 TextTrackRegionList* regionList = ensureTextTrackRegionList(); 309 VTTRegionList* regionList = ensureVTTRegionList();
310 310
311 // 1. If the given region is in a text track list of regions, then remove 311 // 1. If the given region is in a text track list of regions, then remove
312 // region from that text track list of regions. 312 // region from that text track list of regions.
313 TextTrack* regionTrack = region->track(); 313 TextTrack* regionTrack = region->track();
314 if (regionTrack && regionTrack != this) 314 if (regionTrack && regionTrack != this)
315 regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION); 315 regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION);
316 316
317 // 2. If the method's TextTrack object's text track list of regions contains 317 // 2. If the method's TextTrack object's text track list of regions contains
318 // a region with the same identifier as region replace the values of that 318 // a region with the same identifier as region replace the values of that
319 // region's width, height, anchor point, viewport anchor point and scroll 319 // region's width, height, anchor point, viewport anchor point and scroll
320 // attributes with those of region. 320 // attributes with those of region.
321 TextTrackRegion* existingRegion = regionList->getRegionById(region->id()); 321 VTTRegion* existingRegion = regionList->getRegionById(region->id());
322 if (existingRegion) { 322 if (existingRegion) {
323 existingRegion->updateParametersFromRegion(region.get()); 323 existingRegion->updateParametersFromRegion(region.get());
324 return; 324 return;
325 } 325 }
326 326
327 // Otherwise: add region to the method's TextTrack object's text track 327 // Otherwise: add region to the method's TextTrack object's text track
328 // list of regions. 328 // list of regions.
329 region->setTrack(this); 329 region->setTrack(this);
330 regionList->add(region); 330 regionList->add(region);
331 } 331 }
332 332
333 void TextTrack::removeRegion(TextTrackRegion* region, ExceptionState &es) 333 void TextTrack::removeRegion(VTTRegion* region, ExceptionState &es)
334 { 334 {
335 if (!region) 335 if (!region)
336 return; 336 return;
337 337
338 // 1. If the given region is not currently listed in the method's TextTrack 338 // 1. If the given region is not currently listed in the method's TextTrack
339 // object's text track list of regions, then throw a NotFoundError exception . 339 // object's text track list of regions, then throw a NotFoundError exception .
340 if (region->track() != this) { 340 if (region->track() != this) {
341 es.throwUninformativeAndGenericDOMException(NotFoundError); 341 es.throwUninformativeAndGenericDOMException(NotFoundError);
342 return; 342 return;
343 } 343 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 return EventTargetNames::TextTrack; 489 return EventTargetNames::TextTrack;
490 } 490 }
491 491
492 ExecutionContext* TextTrack::executionContext() const 492 ExecutionContext* TextTrack::executionContext() const
493 { 493 {
494 return m_document; 494 return m_document;
495 } 495 }
496 496
497 } // namespace WebCore 497 } // namespace WebCore
498 498
OLDNEW
« no previous file with comments | « Source/core/html/track/TextTrack.h ('k') | Source/core/html/track/TextTrack.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698