Bug 1311279, add a chrome-only setCapture method that can ignore the allowed state, r=smaug
authorNeil Deakin <neil@mozilla.com>
Thu, 17 Nov 2016 09:56:43 -0500
changeset 323103 23ec12a251ee2bcfdd0082961497a2b7399b209d
parent 323102 7aba2499cb40fc8b0572f5f5c6cc997bcf234bdf
child 323104 aba885aafee0210b1f063a423b1c0b3ce28d15f7
push id30967
push userphilringnalda@gmail.com
push dateFri, 18 Nov 2016 03:21:38 +0000
treeherdermozilla-central@8e476f8bd52d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1311279
milestone53.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 1311279, add a chrome-only setCapture method that can ignore the allowed state, r=smaug
dom/base/Element.h
dom/webidl/Element.webidl
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -768,16 +768,24 @@ public:
     // If there is already an active capture, ignore this request. This would
     // occur if a splitter, frame resizer, etc had already captured and we don't
     // want to override those.
     if (!nsIPresShell::GetCapturingContent()) {
       nsIPresShell::SetCapturingContent(this, CAPTURE_PREVENTDRAG |
         (aRetargetToElement ? CAPTURE_RETARGETTOELEMENT : 0));
     }
   }
+
+  void SetCaptureAlways(bool aRetargetToElement)
+  {
+    nsIPresShell::SetCapturingContent(this,
+        CAPTURE_PREVENTDRAG | CAPTURE_IGNOREALLOWED |
+        (aRetargetToElement ? CAPTURE_RETARGETTOELEMENT : 0));
+  }
+
   void ReleaseCapture()
   {
     if (nsIPresShell::GetCapturingContent() == this) {
       nsIPresShell::SetCapturingContent(nullptr, 0);
     }
   }
 
   void RequestFullscreen(ErrorResult& aError);
--- a/dom/webidl/Element.webidl
+++ b/dom/webidl/Element.webidl
@@ -126,16 +126,22 @@ interface Element : Node {
   void setCapture(optional boolean retargetToElement = false);
 
   /**
    * If this element has captured the mouse, release the capture. If another
    * element has captured the mouse, this method has no effect.
    */
   void releaseCapture();
 
+  /*
+   * Chrome-only version of setCapture that works outside of a mousedown event.
+   */
+  [ChromeOnly]
+  void setCaptureAlways(optional boolean retargetToElement = false);
+
   // Mozilla extensions
 
   // Obsolete methods.
   Attr? getAttributeNode(DOMString name);
   [Throws]
   Attr? setAttributeNode(Attr newAttr);
   [Throws]
   Attr? removeAttributeNode(Attr oldAttr);