OLD | NEW |
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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 m_pendingActionFlags &= ~LoadMediaResource; | 704 m_pendingActionFlags &= ~LoadMediaResource; |
705 m_sentEndEvent = false; | 705 m_sentEndEvent = false; |
706 m_sentStalledEvent = false; | 706 m_sentStalledEvent = false; |
707 m_haveFiredLoadedData = false; | 707 m_haveFiredLoadedData = false; |
708 m_completelyLoaded = false; | 708 m_completelyLoaded = false; |
709 m_havePreparedToPlay = false; | 709 m_havePreparedToPlay = false; |
710 m_displayMode = Unknown; | 710 m_displayMode = Unknown; |
711 | 711 |
712 // 1 - Abort any already-running instance of the resource selection algorith
m for this element. | 712 // 1 - Abort any already-running instance of the resource selection algorith
m for this element. |
713 m_loadState = WaitingForSource; | 713 m_loadState = WaitingForSource; |
714 m_currentSourceNode = nullptr; | 714 m_currentSourceElement = nullptr; |
715 | 715 |
716 // 2 - If there are any tasks from the media element's media element event t
ask source in | 716 // 2 - If there are any tasks from the media element's media element event t
ask source in |
717 // one of the task queues, then remove those tasks. | 717 // one of the task queues, then remove those tasks. |
718 cancelPendingEventsAndCallbacks(); | 718 cancelPendingEventsAndCallbacks(); |
719 | 719 |
720 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW
ORK_IDLE, queue | 720 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW
ORK_IDLE, queue |
721 // a task to fire a simple event named abort at the media element. | 721 // a task to fire a simple event named abort at the media element. |
722 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE) | 722 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE) |
723 scheduleEvent(EventTypeNames::abort); | 723 scheduleEvent(EventTypeNames::abort); |
724 | 724 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 enum Mode { attribute, children }; | 819 enum Mode { attribute, children }; |
820 | 820 |
821 // 3 - If the media element has a src attribute, then let mode be attribute. | 821 // 3 - If the media element has a src attribute, then let mode be attribute. |
822 Mode mode = attribute; | 822 Mode mode = attribute; |
823 if (!fastHasAttribute(srcAttr)) { | 823 if (!fastHasAttribute(srcAttr)) { |
824 // Otherwise, if the media element does not have a src attribute but has
a source | 824 // Otherwise, if the media element does not have a src attribute but has
a source |
825 // element child, then let mode be children and let candidate be the fir
st such | 825 // element child, then let mode be children and let candidate be the fir
st such |
826 // source element child in tree order. | 826 // source element child in tree order. |
827 if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstChil
d(*this)) { | 827 if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstChil
d(*this)) { |
828 mode = children; | 828 mode = children; |
829 m_nextChildNodeToConsider = element; | 829 m_nextSourceElement = element; |
830 m_currentSourceNode = nullptr; | 830 m_currentSourceElement = nullptr; |
831 } else { | 831 } else { |
832 // Otherwise the media element has neither a src attribute nor a sou
rce element | 832 // Otherwise the media element has neither a src attribute nor a sou
rce element |
833 // child: set the networkState to NETWORK_EMPTY, and abort these ste
ps; the | 833 // child: set the networkState to NETWORK_EMPTY, and abort these ste
ps; the |
834 // synchronous section ends. | 834 // synchronous section ends. |
835 m_loadState = WaitingForSource; | 835 m_loadState = WaitingForSource; |
836 setShouldDelayLoadEvent(false); | 836 setShouldDelayLoadEvent(false); |
837 m_networkState = NETWORK_EMPTY; | 837 m_networkState = NETWORK_EMPTY; |
838 | 838 |
839 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource, nothing to lo
ad"); | 839 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource, nothing to lo
ad"); |
840 return; | 840 return; |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 if (renderer()) | 1536 if (renderer()) |
1537 renderer()->updateFromElement(); | 1537 renderer()->updateFromElement(); |
1538 } | 1538 } |
1539 | 1539 |
1540 void HTMLMediaElement::noneSupported() | 1540 void HTMLMediaElement::noneSupported() |
1541 { | 1541 { |
1542 WTF_LOG(Media, "HTMLMediaElement::noneSupported"); | 1542 WTF_LOG(Media, "HTMLMediaElement::noneSupported"); |
1543 | 1543 |
1544 stopPeriodicTimers(); | 1544 stopPeriodicTimers(); |
1545 m_loadState = WaitingForSource; | 1545 m_loadState = WaitingForSource; |
1546 m_currentSourceNode = nullptr; | 1546 m_currentSourceElement = nullptr; |
1547 | 1547 |
1548 // 4.8.10.5 | 1548 // 4.8.10.5 |
1549 // 6 - Reaching this step indicates that the media resource failed to load o
r that the given | 1549 // 6 - Reaching this step indicates that the media resource failed to load o
r that the given |
1550 // URL could not be resolved. In one atomic operation, run the following ste
ps: | 1550 // URL could not be resolved. In one atomic operation, run the following ste
ps: |
1551 | 1551 |
1552 // 6.1 - Set the error attribute to a new MediaError object whose code attri
bute is set to | 1552 // 6.1 - Set the error attribute to a new MediaError object whose code attri
bute is set to |
1553 // MEDIA_ERR_SRC_NOT_SUPPORTED. | 1553 // MEDIA_ERR_SRC_NOT_SUPPORTED. |
1554 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); | 1554 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); |
1555 | 1555 |
1556 // 6.2 - Forget the media element's media-resource-specific text tracks. | 1556 // 6.2 - Forget the media element's media-resource-specific text tracks. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 // 3 - Queue a task to fire a simple event named error at the media element. | 1592 // 3 - Queue a task to fire a simple event named error at the media element. |
1593 scheduleEvent(EventTypeNames::error); | 1593 scheduleEvent(EventTypeNames::error); |
1594 | 1594 |
1595 // 4 - Set the element's networkState attribute to the NETWORK_IDLE value. | 1595 // 4 - Set the element's networkState attribute to the NETWORK_IDLE value. |
1596 m_networkState = NETWORK_IDLE; | 1596 m_networkState = NETWORK_IDLE; |
1597 | 1597 |
1598 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. | 1598 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. |
1599 setShouldDelayLoadEvent(false); | 1599 setShouldDelayLoadEvent(false); |
1600 | 1600 |
1601 // 6 - Abort the overall resource selection algorithm. | 1601 // 6 - Abort the overall resource selection algorithm. |
1602 m_currentSourceNode = nullptr; | 1602 m_currentSourceElement = nullptr; |
1603 } | 1603 } |
1604 | 1604 |
1605 void HTMLMediaElement::cancelPendingEventsAndCallbacks() | 1605 void HTMLMediaElement::cancelPendingEventsAndCallbacks() |
1606 { | 1606 { |
1607 WTF_LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks"); | 1607 WTF_LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks"); |
1608 m_asyncEventQueue->cancelAllEvents(); | 1608 m_asyncEventQueue->cancelAllEvents(); |
1609 | 1609 |
1610 for (HTMLSourceElement* source = Traversal<HTMLSourceElement>::firstChild(*t
his); source; source = Traversal<HTMLSourceElement>::nextSibling(*source)) | 1610 for (HTMLSourceElement* source = Traversal<HTMLSourceElement>::firstChild(*t
his); source; source = Traversal<HTMLSourceElement>::nextSibling(*source)) |
1611 source->cancelPendingErrorEvent(); | 1611 source->cancelPendingErrorEvent(); |
1612 } | 1612 } |
1613 | 1613 |
1614 void HTMLMediaElement::mediaPlayerNetworkStateChanged() | 1614 void HTMLMediaElement::mediaPlayerNetworkStateChanged() |
1615 { | 1615 { |
1616 setNetworkState(m_player->networkState()); | 1616 setNetworkState(m_player->networkState()); |
1617 } | 1617 } |
1618 | 1618 |
1619 void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error) | 1619 void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error) |
1620 { | 1620 { |
1621 stopPeriodicTimers(); | 1621 stopPeriodicTimers(); |
1622 | 1622 |
1623 // If we failed while trying to load a <source> element, the movie was never
parsed, and there are more | 1623 // If we failed while trying to load a <source> element, the movie was never
parsed, and there are more |
1624 // <source> children, schedule the next one | 1624 // <source> children, schedule the next one |
1625 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement)
{ | 1625 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement)
{ |
1626 | 1626 |
1627 // resource selection algorithm | 1627 // resource selection algorithm |
1628 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DO
M manipulation task source, to fire a simple event named error at the candidate
element. | 1628 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DO
M manipulation task source, to fire a simple event named error at the candidate
element. |
1629 if (m_currentSourceNode) | 1629 if (m_currentSourceElement) |
1630 m_currentSourceNode->scheduleErrorEvent(); | 1630 m_currentSourceElement->scheduleErrorEvent(); |
1631 else | 1631 else |
1632 WTF_LOG(Media, "HTMLMediaElement::setNetworkState - error event not
sent, <source> was removed"); | 1632 WTF_LOG(Media, "HTMLMediaElement::setNetworkState - error event not
sent, <source> was removed"); |
1633 | 1633 |
1634 // 9.Otherwise.10 - Asynchronously await a stable state. The synchronous
section consists of all the remaining steps of this algorithm until the algorit
hm says the synchronous section has ended. | 1634 // 9.Otherwise.10 - Asynchronously await a stable state. The synchronous
section consists of all the remaining steps of this algorithm until the algorit
hm says the synchronous section has ended. |
1635 | 1635 |
1636 // 9.Otherwise.11 - Forget the media element's media-resource-specific t
racks. | 1636 // 9.Otherwise.11 - Forget the media element's media-resource-specific t
racks. |
1637 forgetResourceSpecificTracks(); | 1637 forgetResourceSpecificTracks(); |
1638 | 1638 |
1639 if (havePotentialSourceChild()) { | 1639 if (havePotentialSourceChild()) { |
1640 WTF_LOG(Media, "HTMLMediaElement::setNetworkState - scheduling next
<source>"); | 1640 WTF_LOG(Media, "HTMLMediaElement::setNetworkState - scheduling next
<source>"); |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 configureTextTrackGroup(otherTracks); | 2823 configureTextTrackGroup(otherTracks); |
2824 | 2824 |
2825 if (hasMediaControls()) | 2825 if (hasMediaControls()) |
2826 mediaControls()->closedCaptionTracksChanged(); | 2826 mediaControls()->closedCaptionTracksChanged(); |
2827 } | 2827 } |
2828 | 2828 |
2829 bool HTMLMediaElement::havePotentialSourceChild() | 2829 bool HTMLMediaElement::havePotentialSourceChild() |
2830 { | 2830 { |
2831 // Stash the current <source> node and next nodes so we can restore them aft
er checking | 2831 // Stash the current <source> node and next nodes so we can restore them aft
er checking |
2832 // to see there is another potential. | 2832 // to see there is another potential. |
2833 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNod
e; | 2833 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceElement = m_currentSource
Element; |
2834 RefPtrWillBeRawPtr<Node> nextNode = m_nextChildNodeToConsider; | 2834 RefPtrWillBeRawPtr<HTMLSourceElement> nextSourceElement = m_nextSourceElemen
t; |
2835 | 2835 |
2836 KURL nextURL = selectNextSourceChild(0, 0, DoNothing); | 2836 KURL nextURL = selectNextSourceChild(0, 0, DoNothing); |
2837 | 2837 |
2838 m_currentSourceNode = currentSourceNode; | 2838 m_currentSourceElement = currentSourceElement; |
2839 m_nextChildNodeToConsider = nextNode; | 2839 m_nextSourceElement = nextSourceElement; |
2840 | 2840 |
2841 return nextURL.isValid(); | 2841 return nextURL.isValid(); |
2842 } | 2842 } |
2843 | 2843 |
2844 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* k
eySystem, InvalidURLAction actionIfInvalid) | 2844 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* k
eySystem, InvalidURLAction actionIfInvalid) |
2845 { | 2845 { |
2846 #if !LOG_DISABLED | 2846 #if !LOG_DISABLED |
2847 // Don't log if this was just called to find out if there are any valid <sou
rce> elements. | 2847 // Don't log if this was just called to find out if there are any valid <sou
rce> elements. |
2848 bool shouldLog = actionIfInvalid != DoNothing; | 2848 bool shouldLog = actionIfInvalid != DoNothing; |
2849 if (shouldLog) | 2849 if (shouldLog) |
2850 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild"); | 2850 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild"); |
2851 #endif | 2851 #endif |
2852 | 2852 |
2853 if (!m_nextChildNodeToConsider) { | 2853 if (!m_nextSourceElement) { |
2854 #if !LOG_DISABLED | 2854 #if !LOG_DISABLED |
2855 if (shouldLog) | 2855 if (shouldLog) |
2856 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild -> 0x0000, \
"\""); | 2856 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild -> 0x0000, \
"\""); |
2857 #endif | 2857 #endif |
2858 return KURL(); | 2858 return KURL(); |
2859 } | 2859 } |
2860 | 2860 |
2861 KURL mediaURL; | 2861 KURL mediaURL; |
2862 Node* node; | 2862 Node* node; |
2863 HTMLSourceElement* source = 0; | 2863 HTMLSourceElement* source = 0; |
2864 String type; | 2864 String type; |
2865 String system; | 2865 String system; |
2866 bool lookingForStartNode = m_nextChildNodeToConsider; | 2866 bool lookingForStartNode = m_nextSourceElement; |
2867 bool canUseSourceElement = false; | 2867 bool canUseSourceElement = false; |
2868 | 2868 |
2869 NodeVector potentialSourceNodes; | 2869 NodeVector potentialSourceNodes; |
2870 getChildNodes(*this, potentialSourceNodes); | 2870 getChildNodes(*this, potentialSourceNodes); |
2871 | 2871 |
2872 for (unsigned i = 0; !canUseSourceElement && i < potentialSourceNodes.size()
; ++i) { | 2872 for (unsigned i = 0; !canUseSourceElement && i < potentialSourceNodes.size()
; ++i) { |
2873 node = potentialSourceNodes[i].get(); | 2873 node = potentialSourceNodes[i].get(); |
2874 if (lookingForStartNode && m_nextChildNodeToConsider != node) | 2874 if (lookingForStartNode && m_nextSourceElement != node) |
2875 continue; | 2875 continue; |
2876 lookingForStartNode = false; | 2876 lookingForStartNode = false; |
2877 | 2877 |
2878 if (!isHTMLSourceElement(*node)) | 2878 if (!isHTMLSourceElement(*node)) |
2879 continue; | 2879 continue; |
2880 if (node->parentNode() != this) | 2880 if (node->parentNode() != this) |
2881 continue; | 2881 continue; |
2882 | 2882 |
2883 source = toHTMLSourceElement(node); | 2883 source = toHTMLSourceElement(node); |
2884 | 2884 |
(...skipping 29 matching lines...) Expand all Loading... |
2914 check_again: | 2914 check_again: |
2915 if (!canUseSourceElement && actionIfInvalid == Complain && source) | 2915 if (!canUseSourceElement && actionIfInvalid == Complain && source) |
2916 source->scheduleErrorEvent(); | 2916 source->scheduleErrorEvent(); |
2917 } | 2917 } |
2918 | 2918 |
2919 if (canUseSourceElement) { | 2919 if (canUseSourceElement) { |
2920 if (contentType) | 2920 if (contentType) |
2921 *contentType = ContentType(type); | 2921 *contentType = ContentType(type); |
2922 if (keySystem) | 2922 if (keySystem) |
2923 *keySystem = system; | 2923 *keySystem = system; |
2924 m_currentSourceNode = source; | 2924 m_currentSourceElement = source; |
2925 m_nextChildNodeToConsider = source->nextSibling(); | 2925 m_nextSourceElement = Traversal<HTMLSourceElement>::nextSibling(*source)
; |
2926 } else { | 2926 } else { |
2927 m_currentSourceNode = nullptr; | 2927 m_currentSourceElement = nullptr; |
2928 m_nextChildNodeToConsider = nullptr; | 2928 m_nextSourceElement = nullptr; |
2929 } | 2929 } |
2930 | 2930 |
2931 #if !LOG_DISABLED | 2931 #if !LOG_DISABLED |
2932 if (shouldLog) | 2932 if (shouldLog) |
2933 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_cu
rrentSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaURL).utf8()
.data() : ""); | 2933 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_cu
rrentSourceElement.get(), canUseSourceElement ? urlForLoggingMedia(mediaURL).utf
8().data() : ""); |
2934 #endif | 2934 #endif |
2935 return canUseSourceElement ? mediaURL : KURL(); | 2935 return canUseSourceElement ? mediaURL : KURL(); |
2936 } | 2936 } |
2937 | 2937 |
2938 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) | 2938 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) |
2939 { | 2939 { |
2940 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded(%p)", source); | 2940 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded(%p)", source); |
2941 | 2941 |
2942 #if !LOG_DISABLED | 2942 #if !LOG_DISABLED |
2943 KURL url = source->getNonEmptyURLAttribute(srcAttr); | 2943 KURL url = source->getNonEmptyURLAttribute(srcAttr); |
2944 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLoggi
ngMedia(url).utf8().data()); | 2944 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLoggi
ngMedia(url).utf8().data()); |
2945 #endif | 2945 #endif |
2946 | 2946 |
2947 // We should only consider a <source> element when there is not src attribut
e at all. | 2947 // We should only consider a <source> element when there is not src attribut
e at all. |
2948 if (fastHasAttribute(srcAttr)) | 2948 if (fastHasAttribute(srcAttr)) |
2949 return; | 2949 return; |
2950 | 2950 |
2951 // 4.8.8 - If a source element is inserted as a child of a media element tha
t has no src | 2951 // 4.8.8 - If a source element is inserted as a child of a media element tha
t has no src |
2952 // attribute and whose networkState has the value NETWORK_EMPTY, the user ag
ent must invoke | 2952 // attribute and whose networkState has the value NETWORK_EMPTY, the user ag
ent must invoke |
2953 // the media element's resource selection algorithm. | 2953 // the media element's resource selection algorithm. |
2954 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) { | 2954 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) { |
2955 scheduleDelayedAction(LoadMediaResource); | 2955 scheduleDelayedAction(LoadMediaResource); |
2956 m_nextChildNodeToConsider = source; | 2956 m_nextSourceElement = source; |
2957 return; | 2957 return; |
2958 } | 2958 } |
2959 | 2959 |
2960 if (m_currentSourceNode && source == m_currentSourceNode->nextSibling()) { | 2960 if (m_currentSourceElement && source == Traversal<HTMLSourceElement>::nextSi
bling(*m_currentSourceElement)) { |
2961 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded - <source> inserted imm
ediately after current source"); | 2961 WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded - <source> inserted imm
ediately after current source"); |
2962 m_nextChildNodeToConsider = source; | 2962 m_nextSourceElement = source; |
2963 return; | 2963 return; |
2964 } | 2964 } |
2965 | 2965 |
2966 if (m_nextChildNodeToConsider) | 2966 if (m_nextSourceElement) |
2967 return; | 2967 return; |
2968 | 2968 |
2969 // 4.8.9.5, resource selection algorithm, source elements section: | 2969 // 4.8.9.5, resource selection algorithm, source elements section: |
2970 // 21. Wait until the node after pointer is a node other than the end of the
list. (This step might wait forever.) | 2970 // 21. Wait until the node after pointer is a node other than the end of the
list. (This step might wait forever.) |
2971 // 22. Asynchronously await a stable state... | 2971 // 22. Asynchronously await a stable state... |
2972 // 23. Set the element's delaying-the-load-event flag back to true (this del
ays the load event again, in case | 2972 // 23. Set the element's delaying-the-load-event flag back to true (this del
ays the load event again, in case |
2973 // it hasn't been fired yet). | 2973 // it hasn't been fired yet). |
2974 setShouldDelayLoadEvent(true); | 2974 setShouldDelayLoadEvent(true); |
2975 | 2975 |
2976 // 24. Set the networkState back to NETWORK_LOADING. | 2976 // 24. Set the networkState back to NETWORK_LOADING. |
2977 m_networkState = NETWORK_LOADING; | 2977 m_networkState = NETWORK_LOADING; |
2978 | 2978 |
2979 // 25. Jump back to the find next candidate step above. | 2979 // 25. Jump back to the find next candidate step above. |
2980 m_nextChildNodeToConsider = source; | 2980 m_nextSourceElement = source; |
2981 scheduleNextSourceChild(); | 2981 scheduleNextSourceChild(); |
2982 } | 2982 } |
2983 | 2983 |
2984 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) | 2984 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
2985 { | 2985 { |
2986 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p)", source); | 2986 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p)", source); |
2987 | 2987 |
2988 #if !LOG_DISABLED | 2988 #if !LOG_DISABLED |
2989 KURL url = source->getNonEmptyURLAttribute(srcAttr); | 2989 KURL url = source->getNonEmptyURLAttribute(srcAttr); |
2990 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved - 'src' is %s", urlForLog
gingMedia(url).utf8().data()); | 2990 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved - 'src' is %s", urlForLog
gingMedia(url).utf8().data()); |
2991 #endif | 2991 #endif |
2992 | 2992 |
2993 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) | 2993 if (source != m_currentSourceElement && source != m_nextSourceElement) |
2994 return; | 2994 return; |
2995 | 2995 |
2996 if (source == m_nextChildNodeToConsider) { | 2996 if (source == m_nextSourceElement) { |
2997 if (m_currentSourceNode) | 2997 if (m_currentSourceElement) |
2998 m_nextChildNodeToConsider = m_currentSourceNode->nextSibling(); | 2998 m_nextSourceElement = Traversal<HTMLSourceElement>::nextSibling(*m_c
urrentSourceElement); |
2999 WTF_LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsi
der set to %p", m_nextChildNodeToConsider.get()); | 2999 WTF_LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextSourceElement se
t to %p", m_nextSourceElement.get()); |
3000 } else if (source == m_currentSourceNode) { | 3000 } else if (source == m_currentSourceElement) { |
3001 // Clear the current source node pointer, but don't change the movie as
the spec says: | 3001 // Clear the current source element pointer, but don't change the movie
as the spec says: |
3002 // 4.8.8 - Dynamically modifying a source element and its attribute when
the element is already | 3002 // 4.8.8 - Dynamically modifying a source element and its attribute when
the element is already |
3003 // inserted in a video or audio element will have no effect. | 3003 // inserted in a video or audio element will have no effect. |
3004 m_currentSourceNode = nullptr; | 3004 m_currentSourceElement = nullptr; |
3005 WTF_LOG(Media, "HTMLMediaElement::sourceRemoved - m_currentSourceNode se
t to 0"); | 3005 WTF_LOG(Media, "HTMLMediaElement::sourceRemoved - m_currentSourceElement
set to 0"); |
3006 } | 3006 } |
3007 } | 3007 } |
3008 | 3008 |
3009 void HTMLMediaElement::mediaPlayerTimeChanged() | 3009 void HTMLMediaElement::mediaPlayerTimeChanged() |
3010 { | 3010 { |
3011 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerTimeChanged"); | 3011 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerTimeChanged"); |
3012 | 3012 |
3013 updateActiveTextTrackCues(currentTime()); | 3013 updateActiveTextTrackCues(currentTime()); |
3014 | 3014 |
3015 invalidateCachedTime(); | 3015 invalidateCachedTime(); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3358 m_networkState = NETWORK_EMPTY; | 3358 m_networkState = NETWORK_EMPTY; |
3359 scheduleEvent(EventTypeNames::emptied); | 3359 scheduleEvent(EventTypeNames::emptied); |
3360 } | 3360 } |
3361 else | 3361 else |
3362 m_networkState = NETWORK_IDLE; | 3362 m_networkState = NETWORK_IDLE; |
3363 | 3363 |
3364 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. | 3364 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. |
3365 setShouldDelayLoadEvent(false); | 3365 setShouldDelayLoadEvent(false); |
3366 | 3366 |
3367 // 6 - Abort the overall resource selection algorithm. | 3367 // 6 - Abort the overall resource selection algorithm. |
3368 m_currentSourceNode = nullptr; | 3368 m_currentSourceElement = nullptr; |
3369 | 3369 |
3370 // Reset m_readyState since m_player is gone. | 3370 // Reset m_readyState since m_player is gone. |
3371 m_readyState = HAVE_NOTHING; | 3371 m_readyState = HAVE_NOTHING; |
3372 updateMediaController(); | 3372 updateMediaController(); |
3373 updateActiveTextTrackCues(0); | 3373 updateActiveTextTrackCues(0); |
3374 } | 3374 } |
3375 | 3375 |
3376 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin
g() | 3376 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin
g() |
3377 { | 3377 { |
3378 #if ENABLE(WEB_AUDIO) | 3378 #if ENABLE(WEB_AUDIO) |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3907 if (hasMediaControls()) | 3907 if (hasMediaControls()) |
3908 mediaControls()->mediaElementFocused(); | 3908 mediaControls()->mediaElementFocused(); |
3909 } | 3909 } |
3910 HTMLElement::defaultEventHandler(event); | 3910 HTMLElement::defaultEventHandler(event); |
3911 } | 3911 } |
3912 | 3912 |
3913 void HTMLMediaElement::trace(Visitor* visitor) | 3913 void HTMLMediaElement::trace(Visitor* visitor) |
3914 { | 3914 { |
3915 visitor->trace(m_asyncEventQueue); | 3915 visitor->trace(m_asyncEventQueue); |
3916 visitor->trace(m_error); | 3916 visitor->trace(m_error); |
3917 visitor->trace(m_currentSourceNode); | 3917 visitor->trace(m_currentSourceElement); |
3918 visitor->trace(m_nextChildNodeToConsider); | 3918 visitor->trace(m_nextSourceElement); |
3919 visitor->trace(m_audioTracks); | 3919 visitor->trace(m_audioTracks); |
3920 visitor->trace(m_videoTracks); | 3920 visitor->trace(m_videoTracks); |
3921 visitor->trace(m_textTracks); | 3921 visitor->trace(m_textTracks); |
3922 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3922 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
3923 visitor->trace(m_mediaController); | 3923 visitor->trace(m_mediaController); |
3924 #if ENABLE(WEB_AUDIO) | 3924 #if ENABLE(WEB_AUDIO) |
3925 visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakM
embers>(this); | 3925 visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakM
embers>(this); |
3926 #endif | 3926 #endif |
3927 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); | 3927 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); |
3928 HTMLElement::trace(visitor); | 3928 HTMLElement::trace(visitor); |
(...skipping 29 matching lines...) Expand all Loading... |
3958 | 3958 |
3959 #if ENABLE(WEB_AUDIO) | 3959 #if ENABLE(WEB_AUDIO) |
3960 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3960 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3961 { | 3961 { |
3962 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 3962 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
3963 audioSourceProvider()->setClient(0); | 3963 audioSourceProvider()->setClient(0); |
3964 } | 3964 } |
3965 #endif | 3965 #endif |
3966 | 3966 |
3967 } | 3967 } |
OLD | NEW |