while dragging, auto-hidden tab bar should be expanded automatically

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-06-13 02:03:50 +09:00
parent f86ac91786
commit 75dc1da17d
2 changed files with 47 additions and 14 deletions

View File

@ -184,6 +184,8 @@ AutoHideBrowser.prototype = {
b.addEventListener('mousedown', this, true); b.addEventListener('mousedown', this, true);
b.addEventListener('mouseup', this, true); b.addEventListener('mouseup', this, true);
b.addEventListener('dragover', this, true);
b.addEventListener('dragleave', this, true);
if (sv.isFloating) { if (sv.isFloating) {
sv.tabStrip.addEventListener('mousedown', this, true); sv.tabStrip.addEventListener('mousedown', this, true);
sv.tabStrip.addEventListener('mouseup', this, true); sv.tabStrip.addEventListener('mouseup', this, true);
@ -219,6 +221,8 @@ AutoHideBrowser.prototype = {
b.removeEventListener('mousedown', this, true); b.removeEventListener('mousedown', this, true);
b.removeEventListener('mouseup', this, true); b.removeEventListener('mouseup', this, true);
b.removeEventListener('dragover', this, true);
b.removeEventListener('dragleave', this, true);
if (sv.isFloating) { if (sv.isFloating) {
sv.tabStrip.removeEventListener('mousedown', this, true); sv.tabStrip.removeEventListener('mousedown', this, true);
sv.tabStrip.removeEventListener('mouseup', this, true); sv.tabStrip.removeEventListener('mouseup', this, true);
@ -1022,22 +1026,18 @@ AutoHideBrowser.prototype = {
switch (aEvent.type) switch (aEvent.type)
{ {
case 'mousedown': case 'mousedown':
this.onMouseDown(aEvent); return this.onMouseDown(aEvent);
return;
case 'mouseup': case 'mouseup':
this.onMouseUp(aEvent); return this.onMouseUp(aEvent);
return;
case 'mousemove': case 'mousemove':
if (this.handleMouseMove(aEvent)) return; if (this.handleMouseMove(aEvent)) return;
case 'resize': case 'resize':
this.onResize(aEvent); return this.onResize(aEvent);
return;
case 'scroll': case 'scroll':
this.onScroll(aEvent); return this.onScroll(aEvent);
return;
case 'load': case 'load':
if (this.shouldRedraw) if (this.shouldRedraw)
@ -1046,8 +1046,7 @@ AutoHideBrowser.prototype = {
case 'TabOpen': case 'TabOpen':
case 'TabClose': case 'TabClose':
this.showForFeedback(); return this.showForFeedback();
return;
case 'TabMove': case 'TabMove':
if (!this.treeStyleTab.subTreeMovingCount && !this.treeStyleTab.internallyTabMovingCount) if (!this.treeStyleTab.subTreeMovingCount && !this.treeStyleTab.internallyTabMovingCount)
@ -1061,6 +1060,12 @@ AutoHideBrowser.prototype = {
this.showForFeedback(); this.showForFeedback();
return; return;
case 'dragover':
return this.onDragOver(aEvent);
case 'dragleave':
return this.onDragLeave(aEvent);
case this.treeStyleTab.kEVENT_TYPE_TABBAR_POSITION_CHANGING: case this.treeStyleTab.kEVENT_TYPE_TABBAR_POSITION_CHANGING:
this.isResizing = false; this.isResizing = false;
this.clearBG(); /* legacy feature for Firefox 3.6 or olders */ this.clearBG(); /* legacy feature for Firefox 3.6 or olders */
@ -1078,8 +1083,7 @@ AutoHideBrowser.prototype = {
return; return;
case this.treeStyleTab.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN: case this.treeStyleTab.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN:
this.onKeyDown(aEvent.getData('sourceEvent')); return this.onKeyDown(aEvent.getData('sourceEvent'));
return;
case this.treeStyleTab.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START: case this.treeStyleTab.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START:
this.cancelDelayedShowForShortcut(); this.cancelDelayedShowForShortcut();
@ -1258,6 +1262,37 @@ AutoHideBrowser.prototype = {
this.redrawContentArea(); 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) onKeyDown : function AHB_onKeyDown(aEvent)
{ {
var sv = this.treeStyleTab; var sv = this.treeStyleTab;

View File

@ -798,8 +798,6 @@ catch(e) {
if (!this.canDrop(aEvent)) { if (!this.canDrop(aEvent)) {
dt.effectAllowed = dt.dropEffect = 'none'; dt.effectAllowed = dt.dropEffect = 'none';
return; return;
} }
var tab = aEvent.target; var tab = aEvent.target;