This commit is contained in:
Rob Campbell 2011-08-25 15:31:27 -03:00
Родитель 1b6221fb6c deaad8d8ef
Коммит 2e704d8caf
8 изменённых файлов: 145 добавлений и 25 удалений

Просмотреть файл

@ -713,7 +713,6 @@ let UI = {
if (data == "enter" || data == "exit") {
hideSearch();
self._privateBrowsing.transitionMode = data;
self.storageBusy();
}
} else if (topic == "private-browsing-transition-complete") {
// We use .transitionMode here, as aData is empty.
@ -722,7 +721,6 @@ let UI = {
self.showTabView(false);
self._privateBrowsing.transitionMode = "";
self.storageReady();
}
}
@ -869,8 +867,12 @@ let UI = {
this._currentTab = tab;
if (this.isTabViewVisible()) {
if (!this.restoredClosedTab && this._lastOpenedTab == tab &&
tab._tabViewTabItem) {
// We want to zoom in if:
// 1) we didn't just restore a tab via Ctrl+Shift+T
// 2) we're not in the middle of switching from/to private browsing
// 3) the currently selected tab is the last created tab and has a tabItem
if (!this.restoredClosedTab && !this._privateBrowsing.transitionMode &&
this._lastOpenedTab == tab && tab._tabViewTabItem) {
tab._tabViewTabItem.zoomIn(true);
this._lastOpenedTab = null;
return;
@ -1130,18 +1132,26 @@ let UI = {
function getClosestTabBy(norm) {
if (!self.getActiveTab())
return null;
let centers =
[[item.bounds.center(), item]
for each(item in TabItems.getItems()) if (!item.parent || !item.parent.hidden)];
let myCenter = self.getActiveTab().bounds.center();
let matches = centers
.filter(function(item){return norm(item[0], myCenter)})
.sort(function(a,b){
return myCenter.distance(a[0]) - myCenter.distance(b[0]);
});
if (matches.length > 0)
return matches[0][1];
return null;
let activeTab = self.getActiveTab();
let activeTabGroup = activeTab.parent;
let myCenter = activeTab.bounds.center();
let match;
TabItems.getItems().forEach(function (item) {
if (!item.parent.hidden &&
(!activeTabGroup.expanded || activeTabGroup.id == item.parent.id)) {
let itemCenter = item.bounds.center();
if (norm(itemCenter, myCenter)) {
let itemDist = myCenter.distance(itemCenter);
if (!match || match[0] > itemDist)
match = [itemDist, item];
}
}
});
return match && match[1];
}
let preventDefault = true;
@ -1613,11 +1623,15 @@ let UI = {
getFavIconUrlForTab: function UI_getFavIconUrlForTab(tab) {
let url;
// use the tab image if it doesn't start with http e.g. data:image/png, chrome://
if (tab.image && !(/^https?:/.test(tab.image)))
url = tab.image;
else
if (tab.image) {
// if starts with http/https, fetch icon from favicon service via the moz-anno protocal
if (/^https?:/.test(tab.image))
url = gFavIconService.getFaviconLinkForIcon(gWindow.makeURI(tab.image)).spec;
else
url = tab.image;
} else {
url = gFavIconService.getFaviconImageForPage(tab.linkedBrowser.currentURI).spec;
}
return url;
},

Просмотреть файл

@ -120,6 +120,7 @@ _BROWSER_FILES = \
browser_tabview_bug628061.js \
browser_tabview_bug628165.js \
browser_tabview_bug628270.js \
browser_tabview_bug628887.js \
browser_tabview_bug629189.js \
browser_tabview_bug629195.js \
browser_tabview_bug630102.js \
@ -154,6 +155,7 @@ _BROWSER_FILES = \
browser_tabview_bug669694.js \
browser_tabview_bug673196.js \
browser_tabview_bug673729.js \
browser_tabview_bug679853.js \
browser_tabview_click_group.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

Просмотреть файл

@ -40,8 +40,18 @@ function onTabViewWindowLoaded() {
// fired, a delay is used here to avoid the test code run before the browser
// code.
executeSoon(function() {
is($icon.attr("src"), fi.defaultFavicon.spec,
"The icon is showing the default fav icon");
let iconSrc = $icon.attr("src");
let hasData = true;
try {
fi.getFaviconDataAsDataURL(iconSrc);
} catch(e) {
hasData = false;
}
ok(!hasData, "The icon src doesn't return any data");
// with moz-anno:favicon automatically redirects to the default favIcon
// if the given url is invalid
ok(/^moz-anno:favicon:/.test(iconSrc),
"The icon url starts with moz-anno:favicon so the default fav icon would be displayed");
// clean up
gBrowser.removeTab(newTab);

Просмотреть файл

@ -0,0 +1,50 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
newWindowWithTabView(function(win) {
registerCleanupFunction(function() win.close());
let cw = win.TabView.getContentWindow();
let groupItemOne = cw.GroupItems.groupItems[0];
let groupItemTwo = createGroupItemWithBlankTabs(win, 100, 100, 40, 2);
ok(groupItemTwo.isStacked(), "groupItem is now stacked");
is(win.gBrowser.tabs.length, 3, "There are three tabs");
// the focus should remain within the group after it's expanded
groupItemTwo.addSubscriber("expanded", function onExpanded() {
groupItemTwo.removeSubscriber("expanded", onExpanded);
ok(groupItemTwo.expanded, "groupItemTwo is expanded");
is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
"The first tab item in group item two is active in expanded mode");
EventUtils.synthesizeKey("VK_DOWN", {}, cw);
is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
"The first tab item is still active after pressing down key");
// the focus should goes to other group if the down arrow is pressed
groupItemTwo.addSubscriber("collapsed", function onExpanded() {
groupItemTwo.removeSubscriber("collapsed", onExpanded);
ok(!groupItemTwo.expanded, "groupItemTwo is not expanded");
is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
"The first tab item is active in group item two in collapsed mode");
EventUtils.synthesizeKey("VK_DOWN", {}, cw);
is(cw.UI.getActiveTab(), groupItemOne.getChild(0),
"The first tab item in group item one is active after pressing down key");
finish();
});
groupItemTwo.collapse();
});
groupItemTwo.expand();
});
}

Просмотреть файл

@ -0,0 +1,32 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
// clean up after ourselves
registerCleanupFunction(function () {
while (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
hideTabView();
});
// select the new tab
gBrowser.selectedTab = gBrowser.addTab();
showTabView(function () {
// enter private browsing mode
togglePrivateBrowsing(function () {
ok(!TabView.isVisible(), "tabview is hidden");
showTabView(function () {
// leave private browsing mode
togglePrivateBrowsing(function () {
ok(TabView.isVisible(), "tabview is visible");
hideTabView(finish);
});
});
});
});
}

Просмотреть файл

@ -0,0 +1,3 @@
%define WINSTRIPE_AERO
%include selectAddons.css
%undef WINSTRIPE_AERO

Просмотреть файл

@ -188,12 +188,21 @@
#footer {
padding: 15px 12px;
background-color: #f1f5fb;
box-shadow: 0px 1px 2px rgb(204,214,234) inset;
}
.progress-label,
#footer-label {
%ifdef WINSTRIPE_AERO
font-style: italic;
%endif
color: GrayText;
}
%ifdef WINSTRIPE_AERO
@media all and (-moz-windows-default-theme) {
#footer {
background-color: #f1f5fb;
box-shadow: 0px 1px 2px rgb(204,214,234) inset;
}
}
%endif

Просмотреть файл

@ -86,7 +86,7 @@ toolkit.jar:
skin/classic/aero/mozapps/extensions/about.css (extensions/about.css)
skin/classic/aero/mozapps/extensions/blocklist.css (extensions/blocklist.css)
* skin/classic/aero/mozapps/extensions/extensions.css (extensions/extensions-aero.css)
* skin/classic/aero/mozapps/extensions/selectAddons.css (extensions/selectAddons.css)
* skin/classic/aero/mozapps/extensions/selectAddons.css (extensions/selectAddons-aero.css)
skin/classic/aero/mozapps/extensions/update.css (extensions/update.css)
skin/classic/aero/mozapps/extensions/extensions.svg (extensions/extensions.svg)
skin/classic/aero/mozapps/extensions/themeGeneric.png (extensions/themeGeneric-aero.png)