Chromium Code Reviews| Index: chrome/browser/resources/new_new_tab.js |
| =================================================================== |
| --- chrome/browser/resources/new_new_tab.js (revision 22541) |
| +++ chrome/browser/resources/new_new_tab.js (working copy) |
| @@ -898,8 +898,6 @@ |
| OptionMenu.prototype = { |
| show: function() { |
| - windowTooltip.hide(); |
| - |
| this.menu.style.display = 'block'; |
| this.button.focus(); |
| @@ -1137,12 +1135,19 @@ |
| WindowTooltip.prototype = { |
| timer: 0, |
| handleMouseOver: function(e, linkEl, tabs) { |
| - document.addEventListener('mousemove', WindowTooltip.trackMouseMove_); |
| + this.linkEl_ = linkEl; |
| + if (e.type == 'mouseover') { |
| + this.linkEl_.addEventListener('mousemove', WindowTooltip.trackMouseMove_); |
| + this.linkEl_.addEventListener('mouseout', this.boundHandleMouseOut_); |
| + } else { // focus |
|
Glen Murphy
2009/08/06 00:05:27
two spaces before //, I think
arv (Not doing code reviews)
2009/08/06 00:18:50
I've never seen that in any style guide. There is
|
| + this.linkEl_.addEventListener('blur', this.boundHide_); |
| + } |
| this.timer = window.setTimeout(bind(this.show, this, e.type, linkEl, tabs), |
| 300); |
| }, |
| show: function(type, linkEl, tabs) { |
| - document.removeEventListener('mousemove', WindowTooltip.trackMouseMove_); |
| + this.linkEl_.removeEventListener('mousemove', |
| + WindowTooltip.trackMouseMove_); |
| clearTimeout(this.timer); |
| processData('#window-tooltip', tabs); |
| @@ -1166,12 +1171,6 @@ |
| this.tooltipEl.style.top = 20 + WindowTooltip.clientY + bodyRect.top + |
| 'px'; |
| } |
| - |
| - if (type == 'focus') { |
| - linkEl.onblur = this.boundHide_; |
| - } else { // mouseover |
| - linkEl.onmouseout = this.boundHandleMouseOut_; |
| - } |
| }, |
| handleMouseOut: function(e) { |
| // Don't hide when move to another item in the link. |
| @@ -1186,7 +1185,12 @@ |
| }, |
| hide: function() { |
| window.clearTimeout(this.timer); |
| - document.removeEventListener('mousemove', WindowTooltip.trackMouseMove_); |
| + this.linkEl_.removeEventListener('mousemove', |
| + WindowTooltip.trackMouseMove_); |
| + this.linkEl_.removeEventListener('mouseout', this.boundHandleMouseOut_); |
| + this.linkEl_.removeEventListener('blur', this.boundHide_); |
| + this.linkEl_ = null; |
| + |
| this.tooltipEl.style.display = 'none'; |
| } |
| }; |