Bug 692466 - [highlighter] transitions should be disabled only while scrolling, not when the node is locked; r=msucan,dao

This commit is contained in:
Paul Rouget 2011-11-22 00:11:23 +01:00
parent 0469267b97
commit b134374732
2 changed files with 29 additions and 5 deletions

View File

@ -12,10 +12,10 @@
overflow: hidden;
}
#highlighter-veil-container:not([locked]) > .highlighter-veil,
#highlighter-veil-container:not([locked]) > #highlighter-veil-middlebox,
#highlighter-veil-container:not([locked]) > #highlighter-veil-middlebox > .highlighter-veil,
#highlighter-veil-container:not([locked]) > #highlighter-veil-middlebox > #highlighter-veil-transparentbox {
#highlighter-veil-container:not([disable-transitions]) > .highlighter-veil,
#highlighter-veil-container:not([disable-transitions]) > #highlighter-veil-middlebox,
#highlighter-veil-container:not([disable-transitions]) > #highlighter-veil-middlebox > .highlighter-veil,
#highlighter-veil-container:not([disable-transitions]) > #highlighter-veil-middlebox > #highlighter-veil-transparentbox {
-moz-transition-property: width, height;
-moz-transition-duration: 0.1s;
-moz-transition-timing-function: linear;
@ -51,7 +51,7 @@
position: absolute;
}
#highlighter-nodeinfobar-container:not([locked]) {
#highlighter-nodeinfobar-container:not([disable-transitions]) {
-moz-transition-property: top, left;
-moz-transition-duration: 0.1s;
-moz-transition-timing-function: linear;

View File

@ -155,6 +155,8 @@ Highlighter.prototype = {
this.browser.addEventListener("resize", this, true);
this.browser.addEventListener("scroll", this, true);
this.transitionDisabler = null;
this.handleResize();
},
@ -670,6 +672,7 @@ Highlighter.prototype = {
this.handleMouseMove(aEvent);
break;
case "resize":
this.brieflyDisableTransitions();
this.handleResize(aEvent);
break;
case "dblclick":
@ -679,11 +682,32 @@ Highlighter.prototype = {
aEvent.preventDefault();
break;
case "scroll":
this.brieflyDisableTransitions();
this.highlight();
break;
}
},
/**
* Disable the CSS transitions for a short time to avoid laggy animations
* during scrolling or resizing.
*/
brieflyDisableTransitions: function Highlighter_brieflyDisableTransitions()
{
if (this.transitionDisabler) {
this.IUI.win.clearTimeout(this.transitionDisabler);
} else {
this.veilContainer.setAttribute("disable-transitions", "true");
this.nodeInfo.container.setAttribute("disable-transitions", "true");
}
this.transitionDisabler =
this.IUI.win.setTimeout(function() {
this.veilContainer.removeAttribute("disable-transitions");
this.nodeInfo.container.removeAttribute("disable-transitions");
this.transitionDisabler = null;
}.bind(this), 500);
},
/**
* Handle clicks.
*