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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « Source/core/html/HTMLLIElement.cpp ('k') | Source/core/html/HTMLMeterElement.cpp » ('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) 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 configureMediaControls(); 602 configureMediaControls();
603 if (m_networkState > NETWORK_EMPTY) 603 if (m_networkState > NETWORK_EMPTY)
604 pause(); 604 pause();
605 } 605 }
606 } 606 }
607 607
608 void HTMLMediaElement::attach(const AttachContext& context) 608 void HTMLMediaElement::attach(const AttachContext& context)
609 { 609 {
610 HTMLElement::attach(context); 610 HTMLElement::attach(context);
611 611
612 if (renderer()) 612 if (layoutObject())
613 renderer()->updateFromElement(); 613 layoutObject()->updateFromElement();
614 } 614 }
615 615
616 void HTMLMediaElement::didRecalcStyle(StyleRecalcChange) 616 void HTMLMediaElement::didRecalcStyle(StyleRecalcChange)
617 { 617 {
618 if (renderer()) 618 if (layoutObject())
619 renderer()->updateFromElement(); 619 layoutObject()->updateFromElement();
620 } 620 }
621 621
622 void HTMLMediaElement::scheduleDelayedAction(DelayedActionType actionType) 622 void HTMLMediaElement::scheduleDelayedAction(DelayedActionType actionType)
623 { 623 {
624 WTF_LOG(Media, "HTMLMediaElement::scheduleDelayedAction(%p)", this); 624 WTF_LOG(Media, "HTMLMediaElement::scheduleDelayedAction(%p)", this);
625 625
626 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe source)) { 626 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe source)) {
627 prepareForLoad(); 627 prepareForLoad();
628 m_pendingActionFlags |= LoadMediaResource; 628 m_pendingActionFlags |= LoadMediaResource;
629 } 629 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 startPlayerLoad(); 995 startPlayerLoad();
996 } 996 }
997 } else { 997 } else {
998 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 998 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
999 } 999 }
1000 1000
1001 // If there is no poster to display, allow the media engine to render video frames as soon as 1001 // If there is no poster to display, allow the media engine to render video frames as soon as
1002 // they are available. 1002 // they are available.
1003 updateDisplayState(); 1003 updateDisplayState();
1004 1004
1005 if (renderer()) 1005 if (layoutObject())
1006 renderer()->updateFromElement(); 1006 layoutObject()->updateFromElement();
1007 } 1007 }
1008 1008
1009 void HTMLMediaElement::startPlayerLoad() 1009 void HTMLMediaElement::startPlayerLoad()
1010 { 1010 {
1011 // Filter out user:pass as those two URL components aren't 1011 // Filter out user:pass as those two URL components aren't
1012 // considered for media resource fetches (including for the CORS 1012 // considered for media resource fetches (including for the CORS
1013 // use-credentials mode.) That behavior aligns with Gecko, with IE 1013 // use-credentials mode.) That behavior aligns with Gecko, with IE
1014 // being more restrictive and not allowing fetches to such URLs. 1014 // being more restrictive and not allowing fetches to such URLs.
1015 // 1015 //
1016 // Spec reference: http://whatwg.org/c/#concept-media-load-resource 1016 // Spec reference: http://whatwg.org/c/#concept-media-load-resource
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 m_loadState = WaitingForSource; 1213 m_loadState = WaitingForSource;
1214 1214
1215 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N O_SOURCE value 1215 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N O_SOURCE value
1216 m_networkState = NETWORK_NO_SOURCE; 1216 m_networkState = NETWORK_NO_SOURCE;
1217 1217
1218 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop s delaying the load event. 1218 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop s delaying the load event.
1219 setShouldDelayLoadEvent(false); 1219 setShouldDelayLoadEvent(false);
1220 1220
1221 updateDisplayState(); 1221 updateDisplayState();
1222 1222
1223 if (renderer()) 1223 if (layoutObject())
1224 renderer()->updateFromElement(); 1224 layoutObject()->updateFromElement();
1225 } 1225 }
1226 1226
1227 void HTMLMediaElement::noneSupported() 1227 void HTMLMediaElement::noneSupported()
1228 { 1228 {
1229 WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this); 1229 WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this);
1230 1230
1231 stopPeriodicTimers(); 1231 stopPeriodicTimers();
1232 m_loadState = WaitingForSource; 1232 m_loadState = WaitingForSource;
1233 m_currentSourceNode = nullptr; 1233 m_currentSourceNode = nullptr;
1234 1234
(...skipping 17 matching lines...) Expand all
1252 closeMediaSource(); 1252 closeMediaSource();
1253 1253
1254 // 8 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. 1254 // 8 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event.
1255 setShouldDelayLoadEvent(false); 1255 setShouldDelayLoadEvent(false);
1256 1256
1257 // 9 - Abort these steps. Until the load() method is invoked or the src attr ibute is changed, 1257 // 9 - Abort these steps. Until the load() method is invoked or the src attr ibute is changed,
1258 // the element won't attempt to load another resource. 1258 // the element won't attempt to load another resource.
1259 1259
1260 updateDisplayState(); 1260 updateDisplayState();
1261 1261
1262 if (renderer()) 1262 if (layoutObject())
1263 renderer()->updateFromElement(); 1263 layoutObject()->updateFromElement();
1264 } 1264 }
1265 1265
1266 void HTMLMediaElement::mediaEngineError(PassRefPtrWillBeRawPtr<MediaError> err) 1266 void HTMLMediaElement::mediaEngineError(PassRefPtrWillBeRawPtr<MediaError> err)
1267 { 1267 {
1268 ASSERT(m_readyState >= HAVE_METADATA); 1268 ASSERT(m_readyState >= HAVE_METADATA);
1269 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca st<int>(err->code())); 1269 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca st<int>(err->code()));
1270 1270
1271 // 1 - The user agent should cancel the fetching process. 1271 // 1 - The user agent should cancel the fetching process.
1272 stopPeriodicTimers(); 1272 stopPeriodicTimers();
1273 m_loadState = WaitingForSource; 1273 m_loadState = WaitingForSource;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 1492
1493 if (m_mediaController) { 1493 if (m_mediaController) {
1494 if (jumped && initialPlaybackPosition > m_mediaController->currentTi me()) 1494 if (jumped && initialPlaybackPosition > m_mediaController->currentTi me())
1495 m_mediaController->setCurrentTime(initialPlaybackPosition); 1495 m_mediaController->setCurrentTime(initialPlaybackPosition);
1496 else 1496 else
1497 seek(m_mediaController->currentTime()); 1497 seek(m_mediaController->currentTime());
1498 } 1498 }
1499 1499
1500 if (mediaControls()) 1500 if (mediaControls())
1501 mediaControls()->reset(); 1501 mediaControls()->reset();
1502 if (renderer()) 1502 if (layoutObject())
1503 renderer()->updateFromElement(); 1503 layoutObject()->updateFromElement();
1504 } 1504 }
1505 1505
1506 bool shouldUpdateDisplayState = false; 1506 bool shouldUpdateDisplayState = false;
1507 1507
1508 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_ haveFiredLoadedData) { 1508 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_ haveFiredLoadedData) {
1509 m_haveFiredLoadedData = true; 1509 m_haveFiredLoadedData = true;
1510 shouldUpdateDisplayState = true; 1510 shouldUpdateDisplayState = true;
1511 scheduleEvent(EventTypeNames::loadeddata); 1511 scheduleEvent(EventTypeNames::loadeddata);
1512 setShouldDelayLoadEvent(false); 1512 setShouldDelayLoadEvent(false);
1513 } 1513 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 if (m_networkState != NETWORK_LOADING) 1559 if (m_networkState != NETWORK_LOADING)
1560 return; 1560 return;
1561 1561
1562 double time = WTF::currentTime(); 1562 double time = WTF::currentTime();
1563 double timedelta = time - m_previousProgressTime; 1563 double timedelta = time - m_previousProgressTime;
1564 1564
1565 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) { 1565 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) {
1566 scheduleEvent(EventTypeNames::progress); 1566 scheduleEvent(EventTypeNames::progress);
1567 m_previousProgressTime = time; 1567 m_previousProgressTime = time;
1568 m_sentStalledEvent = false; 1568 m_sentStalledEvent = false;
1569 if (renderer()) 1569 if (layoutObject())
1570 renderer()->updateFromElement(); 1570 layoutObject()->updateFromElement();
1571 } else if (timedelta > 3.0 && !m_sentStalledEvent) { 1571 } else if (timedelta > 3.0 && !m_sentStalledEvent) {
1572 scheduleEvent(EventTypeNames::stalled); 1572 scheduleEvent(EventTypeNames::stalled);
1573 m_sentStalledEvent = true; 1573 m_sentStalledEvent = true;
1574 setShouldDelayLoadEvent(false); 1574 setShouldDelayLoadEvent(false);
1575 } 1575 }
1576 } 1576 }
1577 1577
1578 void HTMLMediaElement::addPlayedRange(double start, double end) 1578 void HTMLMediaElement::addPlayedRange(double start, double end)
1579 { 1579 {
1580 WTF_LOG(Media, "HTMLMediaElement::addPlayedRange(%p, %f, %f)", this, start, end); 1580 WTF_LOG(Media, "HTMLMediaElement::addPlayedRange(%p, %f, %f)", this, start, end);
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 // Abort if duration unchanged. 2735 // Abort if duration unchanged.
2736 if (m_duration == duration) 2736 if (m_duration == duration)
2737 return; 2737 return;
2738 2738
2739 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p) : %f -> %f", this, m_d uration, duration); 2739 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p) : %f -> %f", this, m_d uration, duration);
2740 m_duration = duration; 2740 m_duration = duration;
2741 scheduleEvent(EventTypeNames::durationchange); 2741 scheduleEvent(EventTypeNames::durationchange);
2742 2742
2743 if (mediaControls()) 2743 if (mediaControls())
2744 mediaControls()->reset(); 2744 mediaControls()->reset();
2745 if (renderer()) 2745 if (layoutObject())
2746 renderer()->updateFromElement(); 2746 layoutObject()->updateFromElement();
2747 2747
2748 if (requestSeek) 2748 if (requestSeek)
2749 seek(duration); 2749 seek(duration);
2750 } 2750 }
2751 2751
2752 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() 2752 void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
2753 { 2753 {
2754 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this ); 2754 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this );
2755 2755
2756 if (!webMediaPlayer()) 2756 if (!webMediaPlayer())
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 mediaControls()->stoppedCasting(); 2804 mediaControls()->stoppedCasting();
2805 } 2805 }
2806 2806
2807 // MediaPlayerPresentation methods 2807 // MediaPlayerPresentation methods
2808 void HTMLMediaElement::mediaPlayerRepaint() 2808 void HTMLMediaElement::mediaPlayerRepaint()
2809 { 2809 {
2810 if (m_webLayer) 2810 if (m_webLayer)
2811 m_webLayer->invalidate(); 2811 m_webLayer->invalidate();
2812 2812
2813 updateDisplayState(); 2813 updateDisplayState();
2814 if (renderer()) 2814 if (layoutObject())
2815 renderer()->setShouldDoFullPaintInvalidation(); 2815 layoutObject()->setShouldDoFullPaintInvalidation();
2816 } 2816 }
2817 2817
2818 void HTMLMediaElement::mediaPlayerSizeChanged() 2818 void HTMLMediaElement::mediaPlayerSizeChanged()
2819 { 2819 {
2820 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged(%p)", this); 2820 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged(%p)", this);
2821 2821
2822 ASSERT(hasVideo()); // "resize" makes no sense absent video. 2822 ASSERT(hasVideo()); // "resize" makes no sense absent video.
2823 if (m_readyState > HAVE_NOTHING && isHTMLVideoElement()) 2823 if (m_readyState > HAVE_NOTHING && isHTMLVideoElement())
2824 scheduleEvent(EventTypeNames::resize); 2824 scheduleEvent(EventTypeNames::resize);
2825 2825
2826 if (renderer()) 2826 if (layoutObject())
2827 renderer()->updateFromElement(); 2827 layoutObject()->updateFromElement();
2828 } 2828 }
2829 2829
2830 PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::buffered() const 2830 PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::buffered() const
2831 { 2831 {
2832 if (m_mediaSource) 2832 if (m_mediaSource)
2833 return m_mediaSource->buffered(); 2833 return m_mediaSource->buffered();
2834 2834
2835 if (!webMediaPlayer()) 2835 if (!webMediaPlayer())
2836 return TimeRanges::create(); 2836 return TimeRanges::create();
2837 2837
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 2955
2956 if (couldPlayIfEnoughData()) 2956 if (couldPlayIfEnoughData())
2957 prepareToPlay(); 2957 prepareToPlay();
2958 2958
2959 if (mediaControls()) 2959 if (mediaControls())
2960 mediaControls()->playbackStopped(); 2960 mediaControls()->playbackStopped();
2961 } 2961 }
2962 2962
2963 updateMediaController(); 2963 updateMediaController();
2964 2964
2965 if (renderer()) 2965 if (layoutObject())
2966 renderer()->updateFromElement(); 2966 layoutObject()->updateFromElement();
2967 } 2967 }
2968 2968
2969 void HTMLMediaElement::stopPeriodicTimers() 2969 void HTMLMediaElement::stopPeriodicTimers()
2970 { 2970 {
2971 m_progressEventTimer.stop(); 2971 m_progressEventTimer.stop();
2972 m_playbackProgressTimer.stop(); 2972 m_playbackProgressTimer.stop();
2973 } 2973 }
2974 2974
2975 void HTMLMediaElement::userCancelledLoad() 2975 void HTMLMediaElement::userCancelledLoad()
2976 { 2976 {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 if (m_playing && m_initialPlayWithoutUserGestures) 3061 if (m_playing && m_initialPlayWithoutUserGestures)
3062 gesturelessInitialPlayHalted(); 3062 gesturelessInitialPlayHalted();
3063 3063
3064 userCancelledLoad(); 3064 userCancelledLoad();
3065 3065
3066 // Stop the playback without generating events 3066 // Stop the playback without generating events
3067 m_playing = false; 3067 m_playing = false;
3068 m_paused = true; 3068 m_paused = true;
3069 m_seeking = false; 3069 m_seeking = false;
3070 3070
3071 if (renderer()) 3071 if (layoutObject())
3072 renderer()->updateFromElement(); 3072 layoutObject()->updateFromElement();
3073 3073
3074 stopPeriodicTimers(); 3074 stopPeriodicTimers();
3075 cancelPendingEventsAndCallbacks(); 3075 cancelPendingEventsAndCallbacks();
3076 3076
3077 m_asyncEventQueue->close(); 3077 m_asyncEventQueue->close();
3078 3078
3079 // Ensure that hasPendingActivity() is not preventing garbage collection, si nce otherwise this 3079 // Ensure that hasPendingActivity() is not preventing garbage collection, si nce otherwise this
3080 // media element will simply leak. 3080 // media element will simply leak.
3081 ASSERT(!hasPendingActivity()); 3081 ASSERT(!hasPendingActivity());
3082 } 3082 }
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3595 3595
3596 #if ENABLE(WEB_AUDIO) 3596 #if ENABLE(WEB_AUDIO)
3597 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3597 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3598 { 3598 {
3599 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 3599 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3600 audioSourceProvider()->setClient(nullptr); 3600 audioSourceProvider()->setClient(nullptr);
3601 } 3601 }
3602 #endif 3602 #endif
3603 3603
3604 } 3604 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLLIElement.cpp ('k') | Source/core/html/HTMLMeterElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698