From 75dc1da17d089eca96877aea37652079f493837d Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Mon, 13 Jun 2011 02:03:50 +0900 Subject: [PATCH] while dragging, auto-hidden tab bar should be expanded automatically --- modules/autoHide.js | 59 ++++++++++++++++++++++++++++-------- modules/tabbarDNDObserver.js | 2 -- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/modules/autoHide.js b/modules/autoHide.js index bad39d0d..49dda2b5 100644 --- a/modules/autoHide.js +++ b/modules/autoHide.js @@ -184,6 +184,8 @@ AutoHideBrowser.prototype = { b.addEventListener('mousedown', this, true); b.addEventListener('mouseup', this, true); + b.addEventListener('dragover', this, true); + b.addEventListener('dragleave', this, true); if (sv.isFloating) { sv.tabStrip.addEventListener('mousedown', this, true); sv.tabStrip.addEventListener('mouseup', this, true); @@ -219,6 +221,8 @@ AutoHideBrowser.prototype = { b.removeEventListener('mousedown', this, true); b.removeEventListener('mouseup', this, true); + b.removeEventListener('dragover', this, true); + b.removeEventListener('dragleave', this, true); if (sv.isFloating) { sv.tabStrip.removeEventListener('mousedown', this, true); sv.tabStrip.removeEventListener('mouseup', this, true); @@ -1022,22 +1026,18 @@ AutoHideBrowser.prototype = { switch (aEvent.type) { case 'mousedown': - this.onMouseDown(aEvent); - return; + return this.onMouseDown(aEvent); case 'mouseup': - this.onMouseUp(aEvent); - return; + return this.onMouseUp(aEvent); case 'mousemove': if (this.handleMouseMove(aEvent)) return; case 'resize': - this.onResize(aEvent); - return; + return this.onResize(aEvent); case 'scroll': - this.onScroll(aEvent); - return; + return this.onScroll(aEvent); case 'load': if (this.shouldRedraw) @@ -1046,8 +1046,7 @@ AutoHideBrowser.prototype = { case 'TabOpen': case 'TabClose': - this.showForFeedback(); - return; + return this.showForFeedback(); case 'TabMove': if (!this.treeStyleTab.subTreeMovingCount && !this.treeStyleTab.internallyTabMovingCount) @@ -1061,6 +1060,12 @@ AutoHideBrowser.prototype = { this.showForFeedback(); return; + case 'dragover': + return this.onDragOver(aEvent); + + case 'dragleave': + return this.onDragLeave(aEvent); + case this.treeStyleTab.kEVENT_TYPE_TABBAR_POSITION_CHANGING: this.isResizing = false; this.clearBG(); /* legacy feature for Firefox 3.6 or olders */ @@ -1078,8 +1083,7 @@ AutoHideBrowser.prototype = { return; case this.treeStyleTab.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN: - this.onKeyDown(aEvent.getData('sourceEvent')); - return; + return this.onKeyDown(aEvent.getData('sourceEvent')); case this.treeStyleTab.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START: this.cancelDelayedShowForShortcut(); @@ -1258,6 +1262,37 @@ AutoHideBrowser.prototype = { this.redrawContentArea(); }, + onDragOver : function AHB_onDragOver(aEvent) + { + if (this.expanded) + return; + + var draggedTabs = this.window['piro.sakura.ne.jp'].tabsDragUtils.getSelectedTabs(aEvent); + if (draggedTabs.length || + this.treeStyleTab.tabbarDNDObserver.retrieveURLFromDataTransfer(aEvent.dataTransfer)) { + this.show(this.kSHOWN_BY_MOUSEMOVE); + + if (this._autoHideOnDragLeaveTimer) { + this.window.clearTimeout(this._autoHideOnDragLeaveTimer); + delete this._autoHideOnDragLeaveTimer; + } + } + }, + + onDragLeave : function AHB_onDragLeave(aEvent) + { + if (!this.expanded) + return; + + if (this._autoHideOnDragLeaveTimer) + this.window.clearTimeout(this._autoHideOnDragLeaveTimer); + + this._autoHideOnDragLeaveTimer = this.window.setTimeout(function(aSelf) { + delete aSelf._autoHideOnDragLeaveTimer; + aSelf.hide(aSelf.kSHOWN_BY_MOUSEMOVE); + }, 100, this); + }, + onKeyDown : function AHB_onKeyDown(aEvent) { var sv = this.treeStyleTab; diff --git a/modules/tabbarDNDObserver.js b/modules/tabbarDNDObserver.js index fe2592ce..7f7b6b07 100644 --- a/modules/tabbarDNDObserver.js +++ b/modules/tabbarDNDObserver.js @@ -798,8 +798,6 @@ catch(e) { if (!this.canDrop(aEvent)) { dt.effectAllowed = dt.dropEffect = 'none'; return; - - } var tab = aEvent.target;