Bug 1531101 - Add method for stopping visual cloning of a video, and a read-only property to check cloning state. r=jya,Ehsan
☠☠ backed out by b9b0378c5e0b ☠ ☠
authorMike Conley <mconley@mozilla.com>
Mon, 11 Mar 2019 22:45:44 +0000
changeset 521442 13a0c61ed4fc
parent 521441 cc930a52098b
child 521443 5887b55233c2
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, Ehsan
bugs1531101
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531101 - Add method for stopping visual cloning of a video, and a read-only property to check cloning state. r=jya,Ehsan Differential Revision: https://phabricator.services.mozilla.com/D22160
dom/html/HTMLVideoElement.cpp
dom/html/HTMLVideoElement.h
dom/webidl/HTMLVideoElement.webidl
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -479,16 +479,22 @@ void HTMLVideoElement::CloneElementVisua
     return;
   }
 
   aTargetVideo.SetMediaInfo(mMediaInfo);
 
   MaybeBeginCloningVisually();
 }
 
+void HTMLVideoElement::StopCloningElementVisually() {
+  if (mVisualCloneTarget) {
+    EndCloningVisually();
+  }
+}
+
 void HTMLVideoElement::MaybeBeginCloningVisually() {
   if (!mVisualCloneTarget) {
     return;
   }
 
   if (mDecoder) {
     MediaDecoderStateMachine* mdsm = mDecoder->GetStateMachine();
     VideoFrameContainer* container =
--- a/dom/html/HTMLVideoElement.h
+++ b/dom/html/HTMLVideoElement.h
@@ -134,16 +134,20 @@ class HTMLVideoElement final : public HT
   }
 
   bool MozIsOrientationLocked() const { return mIsOrientationLocked; }
 
   void SetMozIsOrientationLocked(bool aLock) { mIsOrientationLocked = aLock; }
 
   void CloneElementVisually(HTMLVideoElement& aTarget, ErrorResult& rv);
 
+  void StopCloningElementVisually();
+
+  bool IsCloningElementVisually() const { return !!mVisualCloneTarget; }
+
  protected:
   virtual ~HTMLVideoElement();
 
   virtual JSObject* WrapNode(JSContext* aCx,
                              JS::Handle<JSObject*> aGivenProto) override;
 
   /**
    * We create video wakelock when the video is playing and release it when
--- a/dom/webidl/HTMLVideoElement.webidl
+++ b/dom/webidl/HTMLVideoElement.webidl
@@ -54,15 +54,25 @@ partial interface HTMLVideoElement {
   [Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBLOrUAWidget"]
     attribute boolean mozIsOrientationLocked;
 
   // Clones the frames playing in this <video> to the target. Cloning
   // when either node is removed from their DOM trees. Throws if one or
   // both <video> elements are not attached to a DOM tree.
   [Throws, Func="IsChromeOrXBLOrUAWidget"]
     void cloneElementVisually(HTMLVideoElement target);
+
+  // Stops a <video> from cloning visually. Does nothing if the <video>
+  // wasn't cloning in the first place.
+  [Func="IsChromeOrXBLOrUAWidget"]
+    void stopCloningElementVisually();
+
+  // Returns true if the <video> is being cloned visually to another
+  // <video> element (see cloneElementVisually).
+  [Func="IsChromeOrXBLOrUAWidget"]
+    readonly attribute boolean isCloningElementVisually;
 };
 
 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement
 partial interface HTMLVideoElement {
   [Func="mozilla::dom::MediaSource::Enabled", NewObject]
   VideoPlaybackQuality getVideoPlaybackQuality();
 };