diff options
author | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 00:20:32 +0000 |
---|---|---|
committer | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 00:20:32 +0000 |
commit | 9d0fdfca1cee6043db158979423c59a49aee06fd (patch) | |
tree | dfc61ef5acf149297ca8d0bffa5b9e8f1e304d28 /chrome/browser | |
parent | f4ec0c0da336599cf5b05e231b49b73ae4a83a8c (diff) | |
download | chromium_src-9d0fdfca1cee6043db158979423c59a49aee06fd.zip chromium_src-9d0fdfca1cee6043db158979423c59a49aee06fd.tar.gz chromium_src-9d0fdfca1cee6043db158979423c59a49aee06fd.tar.bz2 |
NNTP: Fix window tooltip so that it is not shown out of place.
BUG=18529
TEST=The bug is hard to reproduce but it involved moving the mouse
fast over the link.
Review URL: http://codereview.chromium.org/164012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/resources/new_new_tab.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index e944003..58c1c31 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -898,8 +898,6 @@ function OptionMenu(button, menu) { OptionMenu.prototype = { show: function() { - windowTooltip.hide(); - this.menu.style.display = 'block'; this.button.focus(); @@ -1137,12 +1135,19 @@ WindowTooltip.trackMouseMove_ = function(e) { 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 + 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 @@ WindowTooltip.prototype = { 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 @@ WindowTooltip.prototype = { }, 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'; } }; |