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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 195813003: Use new is*Element() helper functions further more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bad assertion Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled()); 2312 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled());
2313 2313
2314 if (!m_textTracks) 2314 if (!m_textTracks)
2315 m_textTracks = TextTrackList::create(this); 2315 m_textTracks = TextTrackList::create(this);
2316 2316
2317 return m_textTracks.get(); 2317 return m_textTracks.get();
2318 } 2318 }
2319 2319
2320 void HTMLMediaElement::didAddTrackElement(HTMLTrackElement* trackElement) 2320 void HTMLMediaElement::didAddTrackElement(HTMLTrackElement* trackElement)
2321 { 2321 {
2322 ASSERT(trackElement->hasTagName(trackTag));
adamk 2014/03/13 20:20:36 Do you understand why this was here before? I cert
philipj_slow 2014/03/14 02:20:01 It's from <http://trac.webkit.org/changeset/102968
2323
2324 if (!RuntimeEnabledFeatures::videoTrackEnabled()) 2322 if (!RuntimeEnabledFeatures::videoTrackEnabled())
2325 return; 2323 return;
2326 2324
2327 // 4.8.10.12.3 Sourcing out-of-band text tracks 2325 // 4.8.10.12.3 Sourcing out-of-band text tracks
2328 // When a track element's parent element changes and the new parent is a med ia element, 2326 // When a track element's parent element changes and the new parent is a med ia element,
2329 // then the user agent must add the track element's corresponding text track to the 2327 // then the user agent must add the track element's corresponding text track to the
2330 // media element's list of text tracks ... [continues in TextTrackList::appe nd] 2328 // media element's list of text tracks ... [continues in TextTrackList::appe nd]
2331 RefPtr<TextTrack> textTrack = trackElement->track(); 2329 RefPtr<TextTrack> textTrack = trackElement->track();
2332 if (!textTrack) 2330 if (!textTrack)
2333 return; 2331 return;
2334 2332
2335 addTextTrack(textTrack.get()); 2333 addTextTrack(textTrack.get());
2336 2334
2337 // Do not schedule the track loading until parsing finishes so we don't star t before all tracks 2335 // Do not schedule the track loading until parsing finishes so we don't star t before all tracks
2338 // in the markup have been added. 2336 // in the markup have been added.
2339 if (isFinishedParsingChildren()) 2337 if (isFinishedParsingChildren())
2340 scheduleDelayedAction(LoadTextTrackResource); 2338 scheduleDelayedAction(LoadTextTrackResource);
2341 2339
2342 if (hasMediaControls()) 2340 if (hasMediaControls())
2343 mediaControls()->closedCaptionTracksChanged(); 2341 mediaControls()->closedCaptionTracksChanged();
2344 } 2342 }
2345 2343
2346 void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement) 2344 void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement)
2347 { 2345 {
2348 ASSERT(trackElement->hasTagName(trackTag));
2349
2350 if (!RuntimeEnabledFeatures::videoTrackEnabled()) 2346 if (!RuntimeEnabledFeatures::videoTrackEnabled())
2351 return; 2347 return;
2352 2348
2353 #if !LOG_DISABLED 2349 #if !LOG_DISABLED
2354 if (trackElement->hasTagName(trackTag)) { 2350 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr);
2355 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); 2351 WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement - 'src' is %s", urlF orLoggingMedia(url).utf8().data());
2356 WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement - 'src' is %s", urlForLoggingMedia(url).utf8().data());
2357 }
2358 #endif 2352 #endif
2359 2353
2360 RefPtr<TextTrack> textTrack = trackElement->track(); 2354 RefPtr<TextTrack> textTrack = trackElement->track();
2361 if (!textTrack) 2355 if (!textTrack)
2362 return; 2356 return;
2363 2357
2364 textTrack->setHasBeenConfigured(false); 2358 textTrack->setHasBeenConfigured(false);
2365 2359
2366 if (!m_textTracks) 2360 if (!m_textTracks)
2367 return; 2361 return;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 2581
2588 NodeVector potentialSourceNodes; 2582 NodeVector potentialSourceNodes;
2589 getChildNodes(*this, potentialSourceNodes); 2583 getChildNodes(*this, potentialSourceNodes);
2590 2584
2591 for (unsigned i = 0; !canUseSourceElement && i < potentialSourceNodes.size() ; ++i) { 2585 for (unsigned i = 0; !canUseSourceElement && i < potentialSourceNodes.size() ; ++i) {
2592 node = potentialSourceNodes[i].get(); 2586 node = potentialSourceNodes[i].get();
2593 if (lookingForStartNode && m_nextChildNodeToConsider != node) 2587 if (lookingForStartNode && m_nextChildNodeToConsider != node)
2594 continue; 2588 continue;
2595 lookingForStartNode = false; 2589 lookingForStartNode = false;
2596 2590
2597 if (!node->hasTagName(sourceTag)) 2591 if (!isHTMLSourceElement(*node))
2598 continue; 2592 continue;
2599 if (node->parentNode() != this) 2593 if (node->parentNode() != this)
2600 continue; 2594 continue;
2601 2595
2602 source = toHTMLSourceElement(node); 2596 source = toHTMLSourceElement(node);
2603 2597
2604 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below 2598 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below
2605 mediaURL = source->getNonEmptyURLAttribute(srcAttr); 2599 mediaURL = source->getNonEmptyURLAttribute(srcAttr);
2606 #if !LOG_DISABLED 2600 #if !LOG_DISABLED
2607 if (shouldLog) 2601 if (shouldLog)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2661 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_cu rrentSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaURL).utf8() .data() : ""); 2655 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_cu rrentSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaURL).utf8() .data() : "");
2662 #endif 2656 #endif
2663 return canUseSourceElement ? mediaURL : KURL(); 2657 return canUseSourceElement ? mediaURL : KURL();
2664 } 2658 }
2665 2659
2666 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) 2660 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source)
2667 { 2661 {
2668 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded(%p)", source); 2662 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded(%p)", source);
2669 2663
2670 #if !LOG_DISABLED 2664 #if !LOG_DISABLED
2671 if (source->hasTagName(sourceTag)) { 2665 KURL url = source->getNonEmptyURLAttribute(srcAttr);
2672 KURL url = source->getNonEmptyURLAttribute(srcAttr); 2666 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLoggi ngMedia(url).utf8().data());
2673 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForL oggingMedia(url).utf8().data());
2674 }
2675 #endif 2667 #endif
2676 2668
2677 // We should only consider a <source> element when there is not src attribut e at all. 2669 // We should only consider a <source> element when there is not src attribut e at all.
2678 if (fastHasAttribute(srcAttr)) 2670 if (fastHasAttribute(srcAttr))
2679 return; 2671 return;
2680 2672
2681 // 4.8.8 - If a source element is inserted as a child of a media element tha t has no src 2673 // 4.8.8 - If a source element is inserted as a child of a media element tha t has no src
2682 // attribute and whose networkState has the value NETWORK_EMPTY, the user ag ent must invoke 2674 // attribute and whose networkState has the value NETWORK_EMPTY, the user ag ent must invoke
2683 // the media element's resource selection algorithm. 2675 // the media element's resource selection algorithm.
2684 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) { 2676 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) {
(...skipping 24 matching lines...) Expand all
2709 // 25. Jump back to the find next candidate step above. 2701 // 25. Jump back to the find next candidate step above.
2710 m_nextChildNodeToConsider = source; 2702 m_nextChildNodeToConsider = source;
2711 scheduleNextSourceChild(); 2703 scheduleNextSourceChild();
2712 } 2704 }
2713 2705
2714 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) 2706 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source)
2715 { 2707 {
2716 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p)", source); 2708 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p)", source);
2717 2709
2718 #if !LOG_DISABLED 2710 #if !LOG_DISABLED
2719 if (source->hasTagName(sourceTag)) { 2711 KURL url = source->getNonEmptyURLAttribute(srcAttr);
2720 KURL url = source->getNonEmptyURLAttribute(srcAttr); 2712 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved - 'src' is %s", urlForLog gingMedia(url).utf8().data());
2721 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved - 'src' is %s", urlFo rLoggingMedia(url).utf8().data());
2722 }
2723 #endif 2713 #endif
2724 2714
2725 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) 2715 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider)
2726 return; 2716 return;
2727 2717
2728 if (source == m_nextChildNodeToConsider) { 2718 if (source == m_nextChildNodeToConsider) {
2729 if (m_currentSourceNode) 2719 if (m_currentSourceNode)
2730 m_nextChildNodeToConsider = m_currentSourceNode->nextSibling(); 2720 m_nextChildNodeToConsider = m_currentSourceNode->nextSibling();
2731 WTF_LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsi der set to %p", m_nextChildNodeToConsider.get()); 2721 WTF_LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsi der set to %p", m_nextChildNodeToConsider.get());
2732 } else if (source == m_currentSourceNode) { 2722 } else if (source == m_currentSourceNode) {
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
3628 { 3618 {
3629 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); 3619 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource));
3630 } 3620 }
3631 3621
3632 bool HTMLMediaElement::isInteractiveContent() const 3622 bool HTMLMediaElement::isInteractiveContent() const
3633 { 3623 {
3634 return fastHasAttribute(controlsAttr); 3624 return fastHasAttribute(controlsAttr);
3635 } 3625 }
3636 3626
3637 } 3627 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698