Bug 1803834 - part1 : rename mAutoplaying to 'mCanAutoplayFlag'. r=media-playback-reviewers,padenot

Our current attribute `mAutoplaying` seems be equal to the `can
autoplay flag` defined in the spec, so rename it to the spec name.

https://html.spec.whatwg.org/multipage/media.html#can-autoplay-flag

Differential Revision: https://phabricator.services.mozilla.com/D163741
This commit is contained in:
alwu
2022-12-06 18:21:39 +00:00
parent 00064d977f
commit d124f21b3c
2 changed files with 18 additions and 19 deletions

View File

@@ -2283,7 +2283,7 @@ void HTMLMediaElement::AbortExistingLoads() {
mCurrentPlayRangeStart = -1.0;
mPlayed = new TimeRanges(ToSupports(OwnerDoc()));
mLoadedDataFired = false;
mAutoplaying = true;
mCanAutoplayFlag = true;
mIsLoadingFromSourceChildren = false;
mSuspendedAfterFirstFrame = false;
mAllowSuspendAfterFirstFrame = true;
@@ -2345,7 +2345,7 @@ void HTMLMediaElement::AbortExistingLoads() {
mMediaControlKeyListener->StopIfNeeded();
// We may have changed mPaused, mAutoplaying, and other
// We may have changed mPaused, mCanAutoplayFlag, and other
// things which can affect AddRemoveSelfReference
AddRemoveSelfReference();
@@ -3343,8 +3343,11 @@ void HTMLMediaElement::PauseInternal() {
}
bool oldPaused = mPaused;
mPaused = true;
mAutoplaying = false;
// We changed mPaused and mAutoplaying which can affect AddRemoveSelfReference
// Step 1,
// https://html.spec.whatwg.org/multipage/media.html#internal-pause-steps
mCanAutoplayFlag = false;
// We changed mPaused and mCanAutoplayFlag which can affect
// AddRemoveSelfReference
AddRemoveSelfReference();
UpdateSrcMediaStreamPlaying();
if (mAudioChannelWrapper) {
@@ -4505,10 +4508,12 @@ void HTMLMediaElement::PlayInternal(bool aHandlingUserInput) {
const bool oldPaused = mPaused;
mPaused = false;
mAutoplaying = false;
// Step 5,
// https://html.spec.whatwg.org/multipage/media.html#internal-play-steps
mCanAutoplayFlag = false;
// We changed mPaused and mAutoplaying which can affect AddRemoveSelfReference
// and our preload status.
// We changed mPaused and mCanAutoplayFlag which can affect
// AddRemoveSelfReference and our preload status.
AddRemoveSelfReference();
UpdatePreloadAction();
UpdateSrcMediaStreamPlaying();
@@ -5530,7 +5535,7 @@ void HTMLMediaElement::PlaybackEnded() {
if (mSrcStream) {
// A MediaStream that goes from inactive to active shall be eligible for
// autoplay again according to the mediacapture-main spec.
mAutoplaying = true;
mCanAutoplayFlag = true;
}
if (StaticPrefs::media_mediacontrol_stopcontrol_aftermediaends()) {
@@ -6033,7 +6038,7 @@ bool HTMLMediaElement::CanActivateAutoplay() {
return false;
}
if (!mAutoplaying) {
if (!mCanAutoplayFlag) {
return false;
}