on Minefield, the tab bar was never shown by keyboard shortcuts.

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-01-10 01:40:24 +09:00
parent e24ee77e71
commit bcfc9dc413
3 changed files with 89 additions and 21 deletions

View File

@ -961,14 +961,34 @@ var TreeStyleTabService = {
/* PUBLIC API */ /* PUBLIC API */
var b = this.browser; var b = this.browser;
var event = b.ownerDocument.createEvent('Events'); var event = b.ownerDocument.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN, true, false);
event.sourceEvent = aEvent; var event = b.ownerDocument.createEvent('XULCommandEvents');
event.initCommandEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN,
true,
false,
b.ownerDocument.defaultView,
0,
aEvent.ctrlKey,
aEvent.altKey,
aEvent.shiftKey,
aEvent.metaKey,
aEvent
);
b.dispatchEvent(event); b.dispatchEvent(event);
// for backward compatibility // for backward compatibility
event = b.ownerDocument.createEvent('Events'); event = b.ownerDocument.createEvent('XULCommandEvents');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN.replace(/^nsDOM/, ''), true, false); event.initCommandEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN.replace(/^nsDOM/, ''),
event.sourceEvent = aEvent; true,
false,
b.ownerDocument.defaultView,
0,
aEvent.ctrlKey,
aEvent.altKey,
aEvent.shiftKey,
aEvent.metaKey,
aEvent
);
b.dispatchEvent(event); b.dispatchEvent(event);
}, },
accelKeyPressed : false, accelKeyPressed : false,
@ -1001,6 +1021,12 @@ var TreeStyleTabService = {
var onlyShiftKey = (!aEvent.shiftKey && aEvent.keyCode == 16 && (aEvent.type == 'keyup' || aEvent.charCode == 0)); var onlyShiftKey = (!aEvent.shiftKey && aEvent.keyCode == 16 && (aEvent.type == 'keyup' || aEvent.charCode == 0));
var detailFlags = 0;
if (scrollDown) detailFlags |= this.kTAB_FOCUS_SWITCHING_SCROLL_DOWN;
if (scrollUp) detailFlags |= this.kTAB_FOCUS_SWITCHING_SCROLL_UP;
if (standBy) detailFlags |= this.kTAB_FOCUS_SWITCHING_STAND_BY;
if (onlyShiftKey) detailFlags |= this.kTAB_FOCUS_SWITCHING_ONLY_SHIFT_KEY;
if ( if (
scrollDown || scrollDown ||
scrollUp || scrollUp ||
@ -1009,23 +1035,42 @@ var TreeStyleTabService = {
) )
) { ) {
/* PUBLIC API */ /* PUBLIC API */
let event = b.ownerDocument.createEvent('Events'); let event = b.ownerDocument.createEvent('XULCommandEvents');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START, true, false); event.initCommandEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START,
true,
false,
b.ownerDocument.defaultView,
detailFlags,
aEvent.ctrlKey,
aEvent.altKey,
aEvent.shiftKey,
aEvent.metaKey,
aEvent
);
/* for backward compatibility */
event.scrollDown = scrollDown; event.scrollDown = scrollDown;
event.scrollUp = scrollUp; event.scrollUp = scrollUp;
event.standBy = standBy; event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey; event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event); b.dispatchEvent(event);
// for backward compatibility // for backward compatibility
event = b.ownerDocument.createEvent('Events'); event = b.ownerDocument.createEvent('XULCommandEvents');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START.replace(/^nsDOM/, ''), true, false); event.initCommandEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START.replace(/^nsDOM/, ''),
true,
false,
b.ownerDocument.defaultView,
detailFlags,
aEvent.ctrlKey,
aEvent.altKey,
aEvent.shiftKey,
aEvent.metaKey,
aEvent
);
event.scrollDown = scrollDown; event.scrollDown = scrollDown;
event.scrollUp = scrollUp; event.scrollUp = scrollUp;
event.standBy = standBy; event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey; event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event); b.dispatchEvent(event);
return; return;
@ -1035,23 +1080,42 @@ var TreeStyleTabService = {
/* PUBLIC API */ /* PUBLIC API */
let (event) { let (event) {
event = document.createEvent('Events'); event = b.ownerDocument.createEvent('XULCommandEvents');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END, true, false); event.initCommandEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END,
true,
false,
b.ownerDocument.defaultView,
detailFlags,
aEvent.ctrlKey,
aEvent.altKey,
aEvent.shiftKey,
aEvent.metaKey,
aEvent
);
/* for backward compatibility */
event.scrollDown = scrollDown; event.scrollDown = scrollDown;
event.scrollUp = scrollUp; event.scrollUp = scrollUp;
event.standBy = standBy; event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey; event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event); b.dispatchEvent(event);
// for backward compatibility // for backward compatibility
event = document.createEvent('Events'); event = b.ownerDocument.createEvent('XULCommandEvents');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END.replace(/^nsDOM/, ''), true, false); event.initCommandEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END.replace(/^nsDOM/, ''),
true,
false,
b.ownerDocument.defaultView,
detailFlags,
aEvent.ctrlKey,
aEvent.altKey,
aEvent.shiftKey,
aEvent.metaKey,
aEvent
);
event.scrollDown = scrollDown; event.scrollDown = scrollDown;
event.scrollUp = scrollUp; event.scrollUp = scrollUp;
event.standBy = standBy; event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey; event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event); b.dispatchEvent(event);
} }

View File

@ -1126,12 +1126,12 @@ AutoHideBrowser.prototype = {
if (this.enabled && if (this.enabled &&
this.treeStyleTab.getTreePref('tabbar.autoShow.tabSwitch') && this.treeStyleTab.getTreePref('tabbar.autoShow.tabSwitch') &&
( (
aEvent.scrollDown || aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_SCROLL_DOWN ||
aEvent.scrollUp || aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_SCROLL_UP ||
( // when you release "shift" key ( // when you release "shift" key
this.expanded && this.expanded &&
aEvent.standBy && aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_STAND_BY &&
aEvent.onlyShiftKey aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_ONLY_SHIFT_KEY
) )
)) ))
this.show(this.kSHOWN_BY_SHORTCUT); this.show(this.kSHOWN_BY_SHORTCUT);

View File

@ -122,6 +122,10 @@ var TreeStyleTabUtils = {
kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN : 'nsDOMTreeStyleTabFocusSwitchingKeyDown', kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN : 'nsDOMTreeStyleTabFocusSwitchingKeyDown',
kEVENT_TYPE_TAB_FOCUS_SWITCHING_START : 'nsDOMTreeStyleTabFocusSwitchingStart', kEVENT_TYPE_TAB_FOCUS_SWITCHING_START : 'nsDOMTreeStyleTabFocusSwitchingStart',
kEVENT_TYPE_TAB_FOCUS_SWITCHING_END : 'nsDOMTreeStyleTabFocusSwitchingEnd', kEVENT_TYPE_TAB_FOCUS_SWITCHING_END : 'nsDOMTreeStyleTabFocusSwitchingEnd',
kTAB_FOCUS_SWITCHING_SCROLL_DOWN : (1 << 0),
kTAB_FOCUS_SWITCHING_SCROLL_UP : (1 << 1),
kTAB_FOCUS_SWITCHING_STAND_BY : (1 << 2),
kTAB_FOCUS_SWITCHING_ONLY_SHIFT_KEY : (1 << 3),
kEVENT_TYPE_SUBTREE_CLOSING : 'nsDOMTreeStyleTabSubtreeClosing', kEVENT_TYPE_SUBTREE_CLOSING : 'nsDOMTreeStyleTabSubtreeClosing',
kEVENT_TYPE_SUBTREE_CLOSED : 'nsDOMTreeStyleTabSubtreeClosed', kEVENT_TYPE_SUBTREE_CLOSED : 'nsDOMTreeStyleTabSubtreeClosed',
kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED : 'nsDOMTreeStyleTabCollapsedStateChange', kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED : 'nsDOMTreeStyleTabCollapsedStateChange',