Bug 689387 - Video controls should use new mouseenter/mouseleave events. r=dolske

This commit is contained in:
Martijn Gerrits 2012-01-13 16:26:49 -08:00
Родитель 161ae20b7c
Коммит 917b7b274f
1 изменённых файлов: 6 добавлений и 19 удалений

Просмотреть файл

@ -819,21 +819,15 @@
}, },
onMouseInOut : function (event) { onMouseInOut : function (event) {
if (this.isTouchControl)
return;
// If the controls are static, don't change anything. // If the controls are static, don't change anything.
if (!this.dynamicControls) if (!this.dynamicControls)
return; return;
clearTimeout(this._hideControlsTimeout); 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 // Suppress fading out the controls until the video has rendered
// its first frame. But since autoplay videos start off with no // its first frame. But since autoplay videos start off with no
@ -1280,7 +1274,8 @@
this.muteButton.addEventListener("command", function() { self.toggleMute(); }, false); this.muteButton.addEventListener("command", function() { self.toggleMute(); }, false);
this.playButton.addEventListener("command", function() { self.togglePause(); }, false); this.playButton.addEventListener("command", function() { self.togglePause(); }, false);
this.fullscreenButton.addEventListener("command", function() { self.toggleFullscreen(); }, 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) { this.controlsSpacer.addEventListener("click", function spacerClickHandler(e) {
if (e.button != 0 || self.hasError()) if (e.button != 0 || self.hasError())
return; return;
@ -1318,14 +1313,6 @@
</implementation> </implementation>
<handlers> <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"> <handler event="mousemove">
if (!this.isTouchControl) if (!this.isTouchControl)
this.Utils.onMouseMove(event); this.Utils.onMouseMove(event);