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 */
var b = this.browser;
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);
// for backward compatibility
event = b.ownerDocument.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN.replace(/^nsDOM/, ''), true, false);
event.sourceEvent = aEvent;
event = b.ownerDocument.createEvent('XULCommandEvents');
event.initCommandEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_KEY_DOWN.replace(/^nsDOM/, ''),
true,
false,
b.ownerDocument.defaultView,
0,
aEvent.ctrlKey,
aEvent.altKey,
aEvent.shiftKey,
aEvent.metaKey,
aEvent
);
b.dispatchEvent(event);
},
accelKeyPressed : false,
@ -1001,6 +1021,12 @@ var TreeStyleTabService = {
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 (
scrollDown ||
scrollUp ||
@ -1009,23 +1035,42 @@ var TreeStyleTabService = {
)
) {
/* PUBLIC API */
let event = b.ownerDocument.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START, true, false);
let event = b.ownerDocument.createEvent('XULCommandEvents');
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.scrollUp = scrollUp;
event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event);
// for backward compatibility
event = b.ownerDocument.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START.replace(/^nsDOM/, ''), true, false);
event = b.ownerDocument.createEvent('XULCommandEvents');
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.scrollUp = scrollUp;
event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event);
return;
@ -1035,23 +1080,42 @@ var TreeStyleTabService = {
/* PUBLIC API */
let (event) {
event = document.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END, true, false);
event = b.ownerDocument.createEvent('XULCommandEvents');
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.scrollUp = scrollUp;
event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event);
// for backward compatibility
event = document.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END.replace(/^nsDOM/, ''), true, false);
event = b.ownerDocument.createEvent('XULCommandEvents');
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.scrollUp = scrollUp;
event.standBy = standBy;
event.onlyShiftKey = onlyShiftKey;
event.sourceEvent = aEvent;
b.dispatchEvent(event);
}

View File

@ -1126,12 +1126,12 @@ AutoHideBrowser.prototype = {
if (this.enabled &&
this.treeStyleTab.getTreePref('tabbar.autoShow.tabSwitch') &&
(
aEvent.scrollDown ||
aEvent.scrollUp ||
aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_SCROLL_DOWN ||
aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_SCROLL_UP ||
( // when you release "shift" key
this.expanded &&
aEvent.standBy &&
aEvent.onlyShiftKey
aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_STAND_BY &&
aEvent.detail & this.treeStyleTab.kTAB_FOCUS_SWITCHING_ONLY_SHIFT_KEY
)
))
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_START : 'nsDOMTreeStyleTabFocusSwitchingStart',
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_CLOSED : 'nsDOMTreeStyleTabSubtreeClosed',
kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED : 'nsDOMTreeStyleTabCollapsedStateChange',