Bug 1347892 part 1 - initialize a media element's mVisibilityState to be UNTRACKED; r?jwwang
MozReview-Commit-ID: Bkkh6hvCNu4
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -3719,17 +3719,17 @@ HTMLMediaElement::HTMLMediaElement(alrea
mAudioChannel(AudioChannelService::GetDefaultAudioChannel()),
mDisableVideo(false),
mHasUserInteraction(false),
mFirstFrameLoaded(false),
mDefaultPlaybackStartPosition(0.0),
mIsAudioTrackAudible(false),
mHasSuspendTaint(false),
mMediaTracksConstructed(false),
- mVisibilityState(Visibility::APPROXIMATELY_NONVISIBLE),
+ mVisibilityState(Visibility::UNTRACKED),
mErrorSink(new ErrorSink(this)),
mAudioChannelWrapper(new AudioChannelAgentCallback(this, mAudioChannel))
{
ErrorResult rv;
double defaultVolume = Preferences::GetFloat("media.default_volume", 1.0);
SetVolume(defaultVolume, rv);
@@ -4541,16 +4541,17 @@ HTMLMediaElement::ReportTelemetry()
}
}
}
void HTMLMediaElement::UnbindFromTree(bool aDeep,
bool aNullParent)
{
mUnboundFromTree = true;
+ mVisibilityState = Visibility::UNTRACKED;
if (OwnerDoc()) {
OwnerDoc()->RemoveMediaContent(this);
}
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
MOZ_ASSERT(IsHidden());
NotifyDecoderActivityChanges();
@@ -7198,17 +7199,17 @@ HTMLMediaElement::NotifyCueDisplayStates
}
mTextTrackManager->DispatchUpdateCueDisplay();
}
void
HTMLMediaElement::MarkAsContentSource(CallerAPI aAPI)
{
- const bool isVisible = mVisibilityState != Visibility::APPROXIMATELY_NONVISIBLE;
+ const bool isVisible = mVisibilityState == Visibility::APPROXIMATELY_VISIBLE;
if (isVisible) {
// 0 = ALL_VISIBLE
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 0);
} else {
// 1 = ALL_INVISIBLE
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 1);