46 init:
function tabPreviews_init() {
47 this.
width = Math.ceil(screen.availWidth / 5.75);
48 this.
height = Math.round(this.
width * this.aspectRatio);
50 gBrowser.tabContainer.addEventListener(
"TabSelect",
this,
false);
51 gBrowser.tabContainer.addEventListener(
"SSTabRestored",
this,
false);
53 uninit:
function tabPreviews_uninit() {
54 gBrowser.tabContainer.removeEventListener(
"TabSelect",
this,
false);
55 gBrowser.tabContainer.removeEventListener(
"SSTabRestored",
this,
false);
56 this._selectedTab =
null;
58 get:
function tabPreviews_get(
aTab) {
59 if (
aTab.__thumbnail_lastURI &&
60 aTab.__thumbnail_lastURI !=
aTab.linkedBrowser.currentURI.spec) {
64 return aTab.__thumbnail || this.capture(
aTab, !
aTab.hasAttribute(
"busy"));
66 capture:
function tabPreviews_capture(
aTab, aStore) {
67 var thumbnail = document.createElementNS(
"http://www.w3.org/1999/xhtml",
"canvas");
68 thumbnail.mozOpaque =
true;
69 thumbnail.height = this.
height;
70 thumbnail.width = this.
width;
72 var ctx = thumbnail.getContext(
"2d");
73 var
win =
aTab.linkedBrowser.contentWindow;
74 var snippetWidth = win.innerWidth * .6;
75 var scale = this.
width / snippetWidth;
76 ctx.scale(scale, scale);
77 ctx.drawWindow(win, win.scrollX, win.scrollY,
78 snippetWidth, snippetWidth *
this.aspectRatio,
"rgb(255,255,255)");
81 aTab.__thumbnail = thumbnail;
82 aTab.__thumbnail_lastURI =
aTab.linkedBrowser.currentURI.spec;
86 handleEvent:
function tabPreviews_handleEvent(
event) {
89 if (this._selectedTab &&
90 this._selectedTab.parentNode &&
91 !
this._pendingUpdate) {
96 this._pendingUpdate =
true;
98 self._pendingUpdate =
false;
99 if (
aTab.parentNode && !
aTab.hasAttribute(
"busy"))
100 self.capture(
aTab,
true);
101 }, 2000,
this, this._selectedTab);
103 this._selectedTab =
event.target;
105 case "SSTabRestored":
106 this.capture(
event.target,
true);
113 opening:
function (host) {
114 host.panel.hidden =
false;
116 var
handler = this._generateHandler(host);
117 host.panel.addEventListener(
"popupshown", handler,
false);
118 host.panel.addEventListener(
"popuphiding", handler,
false);
119 host.panel.addEventListener(
"popuphidden", handler,
false);
121 host._prevFocus = document.commandDispatcher.focusedElement;
123 _generateHandler:
function (host) {
125 return function (
event) {
126 if (
event.target == host.panel) {
127 host.panel.removeEventListener(
event.type,
arguments.callee,
false);
128 self[
"_" +
event.type](host);
132 _popupshown:
function (host) {
133 if (
"setupGUI" in host)
136 _popuphiding:
function (host) {
137 if (
"suspendGUI" in host)
140 if (host._prevFocus) {
141 Cc[
"@mozilla.org/focus-manager;1"]
142 .getService(
Ci.nsIFocusManager)
143 .setFocus(host._prevFocus,
Ci.nsIFocusManager.FLAG_NOSCROLL);
144 host._prevFocus =
null;
146 gBrowser.selectedBrowser.focus();
148 if (host.tabToSelect) {
149 gBrowser.selectedTab = host.tabToSelect;
150 host.tabToSelect =
null;
153 _popuphidden:
function (host) {
156 host.panel.hidden =
true;
166 return this.panel = document.getElementById(
"ctrlTab-panel");
168 get showAllButton () {
169 delete this.showAllButton;
170 return this.showAllButton = document.getElementById(
"ctrlTab-showAll");
173 delete this.previews;
174 return this.previews = this.panel.getElementsByClassName(
"ctrlTab-preview");
176 get recentlyUsedLimit () {
177 delete this.recentlyUsedLimit;
178 return this.recentlyUsedLimit =
gPrefService.getIntPref(
"browser.ctrlTab.recentlyUsedLimit");
182 [
"close",
"find",
"selectAll"].forEach(
function (
key) {
183 keys[
key] = document.getElementById(
"key_" +
key)
185 .toLocaleLowerCase().charCodeAt(0);
188 return this.keys = keys;
191 get selected () this._selectedIndex < 0 ?
192 document.activeElement :
193 this.previews.item(this._selectedIndex),
194 get isOpen () this.panel.state ==
"open" || this.panel.state ==
"showing" || this.
_timer,
195 get tabCount () this.tabList.length,
196 get tabPreviewCount () Math.min(this.previews.length - 1,
this.tabCount),
198 Math.ceil(screen.availWidth * .85 /
this.tabPreviewCount)),
199 get canvasHeight () Math.round(this.canvasWidth *
tabPreviews.aspectRatio),
203 return this._tabList;
205 var list =
Array.slice(gBrowser.mTabs);
208 this.detachTab(this._closing, list);
210 for (let
i = 0;
i < gBrowser.tabContainer.selectedIndex;
i++)
211 list.push(list.shift());
213 if (this.recentlyUsedLimit != 0) {
214 let recentlyUsedTabs = this._recentlyUsedTabs;
215 if (this.recentlyUsedLimit > 0)
216 recentlyUsedTabs = this._recentlyUsedTabs.slice(0, this.recentlyUsedLimit);
217 for (let
i = recentlyUsedTabs.length - 1;
i >= 0;
i--) {
218 list.splice(list.indexOf(recentlyUsedTabs[
i]), 1);
219 list.unshift(recentlyUsedTabs[i]);
223 return this._tabList = list;
226 init:
function ctrlTab_init() {
227 if (!this._recentlyUsedTabs) {
228 this._recentlyUsedTabs = [gBrowser.selectedTab];
233 uninit:
function ctrlTab_uninit() {
234 this._recentlyUsedTabs =
null;
238 prefName:
"browser.ctrlTab.previews",
239 readPref:
function ctrlTab_readPref() {
242 (!
gPrefService.prefHasUserValue(
"browser.ctrlTab.disallowForScreenReaders") ||
243 !
gPrefService.getBoolPref(
"browser.ctrlTab.disallowForScreenReaders"));
250 observe:
function (aSubject, aTopic, aPrefName) {
254 updatePreviews:
function ctrlTab_updatePreviews() {
255 for (let
i = 0;
i < this.previews.length;
i++)
256 this.updatePreview(this.previews[
i], this.tabList[i]);
259 this.showAllButton.label =
260 PluralForm.get(this.tabCount, showAllLabel).replace(
"#1", this.tabCount);
263 updatePreview:
function ctrlTab_updatePreview(aPreview,
aTab) {
264 if (aPreview == this.showAllButton)
267 if ((aPreview._tab ||
null) !=
aTab) {
269 aPreview._tab.removeEventListener(
"DOMAttrModified",
this,
false);
270 aPreview._tab =
aTab;
272 aTab.addEventListener(
"DOMAttrModified",
this,
false);
275 if (aPreview.firstChild)
276 aPreview.removeChild(aPreview.firstChild);
278 let canvasWidth = this.canvasWidth;
279 let canvasHeight = this.canvasHeight;
281 aPreview.setAttribute(
"label",
aTab.label);
282 aPreview.setAttribute(
"tooltiptext",
aTab.label);
283 aPreview.setAttribute(
"crop",
aTab.crop);
284 aPreview.setAttribute(
"canvaswidth", canvasWidth);
285 aPreview.setAttribute(
"canvasstyle",
286 "max-width:" + canvasWidth +
"px;" +
287 "min-width:" + canvasWidth +
"px;" +
288 "max-height:" + canvasHeight +
"px;" +
289 "min-height:" + canvasHeight +
"px;");
291 aPreview.setAttribute(
"image",
aTab.image);
293 aPreview.removeAttribute(
"image");
294 aPreview.hidden =
false;
296 aPreview.hidden =
true;
297 aPreview.removeAttribute(
"label");
298 aPreview.removeAttribute(
"tooltiptext");
299 aPreview.removeAttribute(
"image");
303 advanceFocus:
function ctrlTab_advanceFocus(aForward) {
304 if (this.panel.state ==
"open") {
306 document.commandDispatcher.advanceFocus();
308 document.commandDispatcher.rewindFocus();
311 this._selectedIndex += aForward ? 1 : -1;
312 if (this._selectedIndex < 0)
313 this._selectedIndex = this.previews.length - 1;
314 else if (this._selectedIndex >= this.previews.length)
315 this._selectedIndex = 0;
316 }
while (this.selected.hidden);
320 clearTimeout(this.
_timer);
326 _mouseOverFocus:
function ctrlTab_mouseOverFocus(aPreview) {
327 if (this._trackMouseOver)
331 pick:
function ctrlTab_pick(aPreview) {
335 var
select = (aPreview || this.selected);
337 if (select == this.showAllButton)
340 this.close(select._tab);
343 showAllTabs:
function ctrlTab_showAllTabs(aPreview) {
345 document.getElementById(
"Browser:ShowAllTabs").doCommand();
348 remove:
function ctrlTab_remove(aPreview) {
350 gBrowser.removeTab(aPreview._tab);
353 attachTab:
function ctrlTab_attachTab(
aTab, aPos) {
355 this._recentlyUsedTabs.unshift(
aTab);
357 this._recentlyUsedTabs.splice(aPos, 0,
aTab);
359 this._recentlyUsedTabs.push(
aTab);
361 detachTab:
function ctrlTab_detachTab(
aTab,
aTabs) {
362 var
tabs =
aTabs || this._recentlyUsedTabs;
363 var
i = tabs.indexOf(
aTab);
368 open:
function ctrlTab_open() {
374 document.addEventListener(
"keyup",
this,
true);
376 this.updatePreviews();
377 this._selectedIndex = 1;
387 _openPanel:
function ctrlTab_openPanel() {
390 this.panel.width = Math.min(screen.availWidth * .99,
391 this.canvasWidth * 1.25 *
this.tabPreviewCount);
392 var estimateHeight = this.canvasHeight * 1.25 + 75;
393 this.panel.openPopupAtScreen(screen.availLeft + (screen.availWidth -
this.panel.width) / 2,
394 screen.availTop + (screen.availHeight - estimateHeight) / 2,
398 close:
function ctrlTab_close(aTabToSelect) {
403 clearTimeout(this.
_timer);
407 gBrowser.selectedTab = aTabToSelect;
411 this.tabToSelect = aTabToSelect;
412 this.panel.hidePopup();
415 setupGUI:
function ctrlTab_setupGUI() {
416 this.selected.focus();
417 this._selectedIndex = -1;
421 this._trackMouseOver =
false;
424 self._trackMouseOver =
true;
428 suspendGUI:
function ctrlTab_suspendGUI() {
429 document.removeEventListener(
"keyup",
this,
true);
431 Array.forEach(this.previews,
function (preview) {
432 this.updatePreview(preview,
null);
435 this._tabList =
null;
438 onKeyPress:
function ctrlTab_onKeyPress(
event) {
439 var isOpen = this.isOpen;
442 event.preventDefault();
443 event.stopPropagation();
446 switch (
event.keyCode) {
447 case event.DOM_VK_TAB:
450 this.advanceFocus(!
event.shiftKey);
451 }
else if (!
event.shiftKey) {
452 event.preventDefault();
453 event.stopPropagation();
454 if (gBrowser.mTabs.length > 2) {
456 }
else if (gBrowser.mTabs.length == 2) {
457 gBrowser.selectedTab = gBrowser.selectedTab.nextSibling ||
458 gBrowser.selectedTab.previousSibling;
464 if (isOpen &&
event.ctrlKey) {
466 this.
remove(this.selected);
469 switch (
event.charCode) {
470 case this.keys.close:
471 this.
remove(this.selected);
474 case this.keys.selectAll:
482 removeClosingTabFromUI:
function ctrlTab_removeClosingTabFromUI(
aTab) {
483 if (this.tabCount == 2) {
488 this._closing =
aTab;
489 this._tabList =
null;
490 this.updatePreviews();
491 this._closing =
null;
493 if (this.selected.hidden)
494 this.advanceFocus(
false);
495 if (this.selected == this.showAllButton)
496 this.advanceFocus(
false);
499 if (
aTab == gBrowser.selectedTab &&
this.panel.state ==
"open") {
502 }, 0, this.selected);
506 handleEvent:
function ctrlTab_handleEvent(
event) {
507 switch (
event.type) {
508 case "DOMAttrModified":
510 for (let
i = this.previews.length - 1;
i >= 0;
i--) {
511 if (this.previews[
i]._tab && this.previews[
i]._tab ==
event.target) {
512 this.updatePreview(this.previews[
i],
event.target);
518 this.detachTab(
event.target);
519 this.attachTab(
event.target, 0);
522 this.attachTab(
event.target, 1);
525 this.detachTab(
event.target);
527 this.removeClosingTabFromUI(
event.target);
530 this.onKeyPress(
event);
539 _init:
function ctrlTab__init(enable) {
540 var toggleEventListener = enable ?
"addEventListener" :
"removeEventListener";
543 tabContainer[toggleEventListener](
"TabOpen",
this,
false);
544 tabContainer[toggleEventListener](
"TabSelect",
this,
false);
545 tabContainer[toggleEventListener](
"TabClose",
this,
false);
547 document[toggleEventListener](
"keypress",
this,
false);
548 gBrowser.mTabBox.handleCtrlTab = !enable;
552 document.getElementById(
"menu_showAllTabs").hidden = !enable;
563 return this.panel = document.getElementById(
"allTabs-panel");
566 delete this.filterField;
567 return this.filterField = document.getElementById(
"allTabs-filter");
570 delete this.container;
571 return this.container = document.getElementById(
"allTabs-container");
573 get tabCloseButton () {
574 delete this.tabCloseButton;
575 return this.tabCloseButton = document.getElementById(
"allTabs-tab-close-button");
577 get _browserCommandSet () {
578 delete this._browserCommandSet;
579 return this._browserCommandSet = document.getElementById(
"mainCommandSet");
581 get isOpen () this.panel.state ==
"open" || this.panel.state ==
"showing",
583 init:
function allTabs_init() {
586 this._initiated =
true;
588 Array.forEach(gBrowser.mTabs, function (
tab) {
589 this._addPreview(
tab);
592 gBrowser.tabContainer.addEventListener(
"TabOpen",
this,
false);
593 gBrowser.tabContainer.addEventListener(
"TabMove",
this,
false);
594 gBrowser.tabContainer.addEventListener(
"TabClose",
this,
false);
597 uninit:
function allTabs_uninit() {
598 if (!this._initiated)
601 gBrowser.tabContainer.removeEventListener(
"TabOpen",
this,
false);
602 gBrowser.tabContainer.removeEventListener(
"TabMove",
this,
false);
603 gBrowser.tabContainer.removeEventListener(
"TabClose",
this,
false);
605 while (this.container.hasChildNodes())
606 this.container.removeChild(
this.container.firstChild);
608 this._initiated =
false;
611 prefName:
"browser.allTabs.previews",
612 readPref:
function allTabs_readPref() {
613 var allTabsButton = document.getAnonymousElementByAttribute(
614 gBrowser.tabContainer,
"anonid",
"alltabs-button");
616 allTabsButton.removeAttribute(
"type");
617 allTabsButton.setAttribute(
"command",
"Browser:ShowAllTabs");
619 allTabsButton.setAttribute(
"type",
"menu");
620 allTabsButton.removeAttribute(
"command");
621 allTabsButton.removeAttribute(
"oncommand");
624 observe:
function (aSubject, aTopic, aPrefName) {
628 pick:
function allTabs_pick(aPreview) {
630 aPreview = this._firstVisiblePreview;
632 this.tabToSelect = aPreview._tab;
637 closeTab:
function allTabs_closeTab(
event) {
638 this.filterField.focus();
639 gBrowser.removeTab(
event.currentTarget._targetPreview._tab);
642 filter:
function allTabs_filter() {
643 if (this._currentFilter == this.filterField.value)
646 this._currentFilter = this.filterField.value;
648 var
filter = this._currentFilter.split(/\s+/g);
650 Array.forEach(this.container.childNodes, function (preview) {
651 var
tab = preview._tab;
654 let tabstring = tab.linkedBrowser.currentURI.spec;
656 tabstring = decodeURI(tabstring);
658 tabstring =
tab.label +
" " +
tab.label.toLocaleLowerCase() +
" " + tabstring;
659 for (let
i = 0;
i < filter.length;
i++)
660 matches += tabstring.indexOf(filter[
i]) > -1;
662 if (matches <
filter.length) {
663 preview.hidden =
true;
664 tab.removeEventListener(
"DOMAttrModified",
this,
false);
668 this._updatePreview(preview);
669 preview.hidden =
false;
670 tab.addEventListener(
"DOMAttrModified",
this,
false);
677 open:
function allTabs_open() {
687 this.panel.popupBoxObject.setConsumeRollupEvent(
Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
688 var estimateHeight = (this._maxHeight + parseInt(this.container.maxHeight) + 50) / 2;
689 this.panel.openPopupAtScreen(screen.availLeft + (screen.availWidth -
this._maxWidth) / 2,
690 screen.availTop + (screen.availHeight - estimateHeight) / 2,
694 close:
function allTabs_close() {
695 this.panel.hidePopup();
698 setupGUI:
function allTabs_setupGUI() {
699 this.filterField.focus();
700 this.filterField.setAttribute(
"emptytext", this.filterField.tooltipText);
702 this.panel.addEventListener(
"keypress",
this,
false);
703 this.panel.addEventListener(
"keypress",
this,
true);
704 this._browserCommandSet.addEventListener(
"command",
this,
false);
707 suspendGUI:
function allTabs_suspendGUI() {
708 Array.forEach(this.container.childNodes, function (preview) {
709 preview._tab.removeEventListener(
"DOMAttrModified",
this,
false);
712 this.filterField.removeAttribute(
"emptytext");
713 this.filterField.value =
"";
714 this._currentFilter =
null;
716 this._updateTabCloseButton();
718 this.panel.removeEventListener(
"keypress",
this,
false);
719 this.panel.removeEventListener(
"keypress",
this,
true);
720 this._browserCommandSet.removeEventListener(
"command",
this,
false);
723 handleEvent:
function allTabs_handleEvent(
event) {
724 switch (
event.type) {
725 case "DOMAttrModified":
727 this._updatePreview(this._getPreview(
event.target));
732 this._addPreview(
event.target);
735 if (
event.target.nextSibling)
736 this.container.insertBefore(this._getPreview(
event.target),
737 this._getPreview(
event.target.nextSibling));
739 this.container.appendChild(this._getPreview(
event.target));
742 this._removePreview(this._getPreview(
event.target));
745 this._onKeyPress(
event);
748 if (
event.target.id !=
"Browser:ShowAllTabs") {
757 _currentFilter:
null,
758 get _maxWidth () screen.availWidth * .9,
759 get _maxHeight () screen.availHeight * .75,
762 return this._stack = document.getElementById(
"allTabs-stack");
764 get _previewLabelHeight () {
765 delete this._previewLabelHeight;
766 return this._previewLabelHeight = parseInt(getComputedStyle(this.container.firstChild,
"").lineHeight);
769 get _visiblePreviews ()
772 get _firstVisiblePreview () {
773 if (this._visible == 0)
775 var previews = this.container.childNodes;
776 for (let
i = 0;
i < previews.length;
i++) {
777 if (!previews[
i].hidden)
783 _reflow:
function allTabs_reflow() {
784 this._updateTabCloseButton();
787 const REL_PREVIEW_THUMBNAIL = 1.2;
789 var maxHeight = this._maxHeight;
790 var maxWidth = this._maxWidth;
792 var rows, previewHeight, previewWidth, outerHeight;
793 var previewMaxWidth =
tabPreviews.width * REL_PREVIEW_THUMBNAIL;
794 this.
_columns = Math.floor(maxWidth / previewMaxWidth);
796 rows = Math.ceil(this._visible / this.
_columns);
797 previewWidth = Math.min(previewMaxWidth, Math.round(maxWidth /
this._columns));
798 previewHeight = Math.round(previewWidth * rel);
799 outerHeight = previewHeight + this._previewLabelHeight;
800 }
while (rows * outerHeight > maxHeight && ++this.
_columns);
802 var outerWidth = previewWidth;
804 let innerWidth = Math.ceil(previewWidth / REL_PREVIEW_THUMBNAIL);
805 let innerHeight = Math.ceil(previewHeight / REL_PREVIEW_THUMBNAIL);
806 var canvasStyle =
"max-width:" + innerWidth +
"px;" +
807 "min-width:" + innerWidth +
"px;" +
808 "max-height:" + innerHeight +
"px;" +
809 "min-height:" + innerHeight +
"px;";
812 Array.forEach(this.container.childNodes, function (preview) {
813 preview.setAttribute(
"minwidth", outerWidth);
814 preview.setAttribute(
"height", outerHeight);
815 preview.setAttribute(
"canvasstyle", canvasStyle);
816 preview.removeAttribute(
"closebuttonhover");
819 this._stack.width = maxWidth;
820 this.container.width = Math.ceil(outerWidth * Math.min(
this._columns,
this._visible));
821 this.container.left = Math.round((maxWidth - this.container.width) / 2);
822 this.container.maxWidth = maxWidth - this.container.left;
823 this.container.maxHeight = rows * outerHeight;
826 _addPreview:
function allTabs_addPreview(
aTab) {
827 var preview = document.createElement(
"button");
828 preview.className =
"allTabs-preview";
830 return this.container.appendChild(preview);
833 _removePreview:
function allTabs_removePreview(aPreview) {
834 var updateUI = (this.isOpen && !aPreview.hidden);
835 aPreview._tab.removeEventListener(
"DOMAttrModified",
this,
false);
836 aPreview._tab =
null;
837 this.container.removeChild(aPreview);
841 this.filterField.focus();
845 _getPreview:
function allTabs_getPreview(
aTab) {
846 var previews = this.container.childNodes;
847 for (let
i = 0;
i < previews.length;
i++)
848 if (previews[
i]._tab ==
aTab)
853 _updateTabCloseButton:
function allTabs_updateTabCloseButton(
event) {
854 if (
event &&
event.target ==
this.tabCloseButton)
857 if (this.tabCloseButton._targetPreview) {
858 if (
event &&
event.target ==
this.tabCloseButton._targetPreview)
861 this.tabCloseButton._targetPreview.removeAttribute(
"closebuttonhover");
865 event.target.parentNode ==
this.container &&
866 (
event.target._tab.previousSibling ||
event.target._tab.nextSibling)) {
867 let preview =
event.target.getBoundingClientRect();
868 let container = this.container.getBoundingClientRect();
869 let tabCloseButton = this.tabCloseButton.getBoundingClientRect();
870 let alignLeft = getComputedStyle(this.panel,
"").direction ==
"rtl";
872 alignLeft = !alignLeft;
874 this.tabCloseButton.left = preview.left -
876 parseInt(this.container.left) +
878 preview.width - tabCloseButton.width);
879 this.tabCloseButton.top = preview.top - container.top;
880 this.tabCloseButton._targetPreview =
event.target;
881 this.tabCloseButton.style.visibility =
"visible";
882 event.target.setAttribute(
"closebuttonhover",
"true");
884 this.tabCloseButton.style.visibility =
"hidden";
885 this.tabCloseButton.left = this.tabCloseButton.top = 0;
886 this.tabCloseButton._targetPreview =
null;
890 _updatePreview:
function allTabs_updatePreview(aPreview) {
891 aPreview.setAttribute(
"label", aPreview._tab.label);
892 aPreview.setAttribute(
"tooltiptext", aPreview._tab.label);
893 aPreview.setAttribute(
"crop", aPreview._tab.crop);
894 if (aPreview._tab.image)
895 aPreview.setAttribute(
"image", aPreview._tab.image);
897 aPreview.removeAttribute(
"image");
900 if (aPreview.firstChild) {
901 if (aPreview.firstChild == thumbnail)
903 aPreview.removeChild(aPreview.firstChild);
905 aPreview.appendChild(thumbnail);
908 _onKeyPress:
function allTabs_onKeyPress(
event) {
909 if (
event.eventPhase ==
event.CAPTURING_PHASE) {
910 this._onCapturingKeyPress(
event);
916 event.preventDefault();
917 event.stopPropagation();
921 if (
event.target ==
this.filterField) {
922 switch (
event.keyCode) {
923 case event.DOM_VK_UP:
925 let previews = this._visiblePreviews;
926 let
columns = Math.min(previews.length,
this._columns);
927 previews[Math.floor(previews.length / columns) * columns - 1].focus();
928 event.preventDefault();
929 event.stopPropagation();
932 case event.DOM_VK_DOWN:
934 this._firstVisiblePreview.focus();
935 event.preventDefault();
936 event.stopPropagation();
943 _onCapturingKeyPress:
function allTabs_onCapturingKeyPress(
event) {
944 switch (
event.keyCode) {
945 case event.DOM_VK_UP:
946 case event.DOM_VK_DOWN:
947 if (
event.target !=
this.filterField)
948 this._advanceFocusVertically(
event);
950 case event.DOM_VK_RETURN:
951 if (
event.target ==
this.filterField) {
954 event.preventDefault();
955 event.stopPropagation();
961 _advanceFocusVertically:
function allTabs_advanceFocusVertically(
event) {
962 var preview = document.activeElement;
963 if (!preview || preview.parentNode !=
this.container)
966 event.stopPropagation();
968 var up = (
event.keyCode ==
event.DOM_VK_UP);
969 var previews = this._visiblePreviews;
971 if (up && preview == previews[0]) {
972 this.filterField.focus();
976 var
i = previews.indexOf(preview);
977 var columns = Math.min(previews.length,
this._columns);
979 var row = Math.floor(i / columns);
981 function newIndex() row * columns + column;
982 function outOfBounds() newIndex() >= previews.length;
987 let rows = Math.ceil(previews.length / columns);
996 if (column == columns - 1) {
997 this.filterField.focus();
1004 previews[newIndex()].focus();
var tabPreviewPanelHelper
sbDeviceFirmwareAutoCheckForUpdate prototype _timer
BogusChannel prototype open
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
return!aWindow arguments!aWindow arguments[0]
_replaceLoadingTitle aTab
_getSelectedPageStyle s i
Array filter(tab.attributes, function(aAttr){return(_this.xulAttributes.indexOf(aAttr.name) >-1);}).forEach(tab.removeAttribute
restoreHistoryPrecursor aTabs
sbDeviceFirmwareAutoCheckForUpdate prototype observe