Bug 1555946 - Remove HTMLMediaElement::mUnboundFromTree and use nsINode::IsInComposedDoc() instead. r=emilio

HTMLMediaElement::mUnboundFromTree was added in bug 1239899, and I'm pretty
sure its behaviour is intended to be the same as what IsInComposedDocument()
gives us, so we can just use that instead.

Differential Revision: https://phabricator.services.mozilla.com/D35295
This commit is contained in:
Chris Pearce
2019-06-19 22:37:56 +00:00
parent 3e522923e8
commit b173baa97b
3 changed files with 28 additions and 25 deletions

View File

@@ -386,13 +386,13 @@ void HTMLVideoElement::ReleaseVideoWakeLockIfExists() {
bool HTMLVideoElement::SetVisualCloneTarget(
HTMLVideoElement* aVisualCloneTarget) {
MOZ_DIAGNOSTIC_ASSERT(
!aVisualCloneTarget || !aVisualCloneTarget->mUnboundFromTree,
!aVisualCloneTarget || aVisualCloneTarget->IsInComposedDoc(),
"Can't set the clone target to a disconnected video "
"element.");
MOZ_DIAGNOSTIC_ASSERT(!mVisualCloneSource,
"Can't clone a video element that is already a clone.");
if (!aVisualCloneTarget ||
(!aVisualCloneTarget->mUnboundFromTree && !mVisualCloneSource)) {
(aVisualCloneTarget->IsInComposedDoc() && !mVisualCloneSource)) {
mVisualCloneTarget = aVisualCloneTarget;
return true;
}
@@ -402,14 +402,14 @@ bool HTMLVideoElement::SetVisualCloneTarget(
bool HTMLVideoElement::SetVisualCloneSource(
HTMLVideoElement* aVisualCloneSource) {
MOZ_DIAGNOSTIC_ASSERT(
!aVisualCloneSource || !aVisualCloneSource->mUnboundFromTree,
!aVisualCloneSource || aVisualCloneSource->IsInComposedDoc(),
"Can't set the clone source to a disconnected video "
"element.");
MOZ_DIAGNOSTIC_ASSERT(!mVisualCloneTarget,
"Can't clone a video element that is already a "
"clone.");
if (!aVisualCloneSource ||
(!aVisualCloneSource->mUnboundFromTree && !mVisualCloneTarget)) {
(aVisualCloneSource->IsInComposedDoc() && !mVisualCloneTarget)) {
mVisualCloneSource = aVisualCloneSource;
return true;
}
@@ -452,11 +452,11 @@ double HTMLVideoElement::TotalPlayTime() const {
void HTMLVideoElement::CloneElementVisually(HTMLVideoElement& aTargetVideo,
ErrorResult& rv) {
MOZ_ASSERT(!mUnboundFromTree,
MOZ_ASSERT(IsInComposedDoc(),
"Can't clone a video that's not bound to a DOM tree.");
MOZ_ASSERT(!aTargetVideo.mUnboundFromTree,
MOZ_ASSERT(aTargetVideo.IsInComposedDoc(),
"Can't clone to a video that's not bound to a DOM tree.");
if (mUnboundFromTree || aTargetVideo.mUnboundFromTree) {
if (!IsInComposedDoc() || !aTargetVideo.IsInComposedDoc()) {
rv.Throw(NS_ERROR_UNEXPECTED);
return;
}