Back out 4ac407704d74 (bug 689387) for causing or exposing or whatevering bug 718411
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 16 Jan 2012 18:31:02 -0800
changeset 85788 12091526e9d07038eeb31a9ff459156c57c53d84
parent 85787 62df2afae1c77e322169381aa2766fb02f1d03f5
child 85831 34572943a3e44c327984dd4d671df580eb521223
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs689387, 718411
milestone12.0a1
backs out4ac407704d74cf979e346a267eed3dbd6c589100
Back out 4ac407704d74 (bug 689387) for causing or exposing or whatevering bug 718411
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -814,25 +814,31 @@
                     // since the controls span the width of the video and are always located
                     // at the bottom of the video.
                     if (event.clientY < this.controlBar.getBoundingClientRect().top) {
                         this._hideControlsTimeout = setTimeout(this._hideControlsFn, this.HIDE_CONTROLS_TIMEOUT_MS);
                     }
                 },
 
                 onMouseInOut : function (event) {
-                    if (this.isTouchControl)
-                        return;
-
                     // If the controls are static, don't change anything.
                     if (!this.dynamicControls)
                         return;
 
                     clearTimeout(this._hideControlsTimeout);
-                    var isMouseOver = (event.type == "mouseenter");
+
+                    // Ignore events caused by transitions between child nodes.
+                    // Note that the videocontrols element is the same
+                    // size as the *content area* of the video element,
+                    // but this is not the same as the video element's
+                    // border area if the video has border or padding.
+                    if (this.isEventWithin(event, this.videocontrols))
+                        return;
+
+                    var isMouseOver = (event.type == "mouseover");
 
                     // Suppress fading out the controls until the video has rendered
                     // its first frame. But since autoplay videos start off with no
                     // controls, let them fade-out so the controls don't get stuck on.
                     if (!this.firstFrameShown && !isMouseOver &&
                         !(this.video.autoplay && this.video.mozAutoplayEnabled))
                         return;
 
@@ -1269,18 +1275,17 @@
                     // from the <source> children, which don't bubble.
                     for each (let event in this.videoEvents)
                         this.video.addEventListener(event, this, (event == "error") ? true : false);
 
                     var self = this;
                     this.muteButton.addEventListener("command", function() { self.toggleMute(); }, false);
                     this.playButton.addEventListener("command", function() { self.togglePause(); }, false);
                     this.fullscreenButton.addEventListener("command", function() { self.toggleFullscreen(); }, false );
-                    this.video.addEventListener("mouseenter", function(e) { self.onMouseInOut(e) }, false, true);
-                    this.video.addEventListener("mouseleave", function(e) { self.onMouseInOut(e) }, false, true);
+
                     this.controlsSpacer.addEventListener("click", function spacerClickHandler(e) {
                       if (e.button != 0 || self.hasError())
                         return;
                       // Read defaultPrevented asynchronously, since Web content
                       // may want to consume the "click" event but will only
                       // receive it after us (bug 693014).
                       setTimeout(function togglePauseCallback() {
                         if (!e.defaultPrevented)
@@ -1308,16 +1313,24 @@
             }) ]]>
         </field>
 
         <field readonly="true" name="isTouchControl">false</field>
 
     </implementation>
 
     <handlers>
+        <handler event="mouseover">
+            if (!this.isTouchControl)
+                this.Utils.onMouseInOut(event);
+        </handler>
+        <handler event="mouseout">
+            if (!this.isTouchControl)
+                this.Utils.onMouseInOut(event);
+        </handler>
         <handler event="mousemove">
             if (!this.isTouchControl)
                 this.Utils.onMouseMove(event);
         </handler>
     </handlers>
   </binding>
   
   <binding id="touchControls" extends="chrome://global/content/bindings/videocontrols.xml#videoControls">