backing out bug 590742, bug 591147, bug 592586, a=dietrich

This commit is contained in:
Dietrich Ayala 2010-09-07 00:28:01 +07:00
parent 3166349755
commit 30c934075c
9 changed files with 176 additions and 141 deletions

View File

@ -777,7 +777,7 @@ window.GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
this.topChild = null;
var box = new Rect(this.expanded.bounds);
box.inset(8, 8);
Items.arrange(this._children, box, Utils.extend({}, options, {z: 99999}));
Items.arrange(this._children, box, Utils.extend({}, options, {padding: 8, z: 99999}));
} else {
var bb = this.getContentBounds();
var count = this._children.length;
@ -1407,6 +1407,21 @@ window.GroupItems = {
return sane;
},
// ----------
// Function: getGroupItemWithTitle
// Returns the <GroupItem> that has the given title, or null if none found.
// TODO: what if there are multiple groupItems with the same title??
// Right now, looks like it'll return the last one. Bug 586557
getGroupItemWithTitle: function(title) {
var result = null;
this.groupItems.forEach(function(groupItem) {
if (groupItem.getTitle() == title)
result = groupItem;
});
return result;
},
// ----------
// Function: register
// Adds the given <GroupItem> to the list of groupItems we're tracking.

View File

@ -915,11 +915,7 @@ window.Items = {
return rects;
var columns = 1;
// We'll assume for the time being that all the items have the same styling
// and that the margin is the same width around.
var itemMargin = items && items.length ?
parseInt(iQ(items[0].container).css('margin-left')) : 0;
var padding = itemMargin * 2;
var padding = options.padding || 0;
var yScale = 1.1; // to allow for titles
var rows;
var tabWidth;
@ -928,9 +924,9 @@ window.Items = {
function figure() {
rows = Math.ceil(count / columns);
tabWidth = (bounds.width - (padding * columns)) / columns;
tabWidth = (bounds.width - (padding * (columns - 1))) / columns;
tabHeight = tabWidth * tabAspect;
totalHeight = (tabHeight * yScale * rows) + (padding * rows);
totalHeight = (tabHeight * yScale * rows) + (padding * (rows - 1));
}
figure();
@ -941,7 +937,8 @@ window.Items = {
}
if (rows == 1) {
tabWidth = Math.min(tabWidth, (bounds.height - 2 * itemMargin) / tabAspect);
var maxWidth = Math.max(TabItems.tabWidth, bounds.width / 2);
tabWidth = Math.min(Math.min(maxWidth, bounds.width / count), bounds.height / tabAspect);
tabHeight = tabWidth * tabAspect;
}

View File

@ -59,7 +59,7 @@ window.TabItem = function(tab) {
// ___ set up div
var $div = iQ('<div>')
.addClass('tab')
.html("<div class='thumb'>" +
.html("<div class='thumb'><div class='thumb-shadow'></div>" +
"<img class='cached-thumb' style='display:none'/><canvas/></div>" +
"<div class='favicon'><img/></div>" +
"<span class='tab-title'>&nbsp;</span>"
@ -489,14 +489,17 @@ window.TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// Function: makeActive
// Updates this item to visually indicate that it's active.
makeActive: function() {
iQ(this.container).addClass("focus");
iQ(this.container).find("canvas").addClass("focus");
iQ(this.container).find("img.cached-thumb").addClass("focus");
},
// ----------
// Function: makeDeactive
// Updates this item to visually indicate that it's not active.
makeDeactive: function() {
iQ(this.container).removeClass("focus");
iQ(this.container).find("canvas").removeClass("focus");
iQ(this.container).find("img.cached-thumb").removeClass("focus");
},
// ----------

View File

@ -52,6 +52,10 @@ body {
height: 100%;
}
.thumb-shadow {
position: absolute;
}
.favicon {
position: absolute;
}
@ -69,7 +73,8 @@ body {
position: absolute;
}
.stacked .tab-title {
.stacked .tab-title,
.stacked .thumb-shadow {
display: none;
}

View File

@ -929,6 +929,11 @@ var UIManager = {
code: function() {
self._saveAll();
}
}, {
name: "group sites",
code: function() {
self._arrangeBySite();
}
}];
var count = commands.length;
@ -992,6 +997,56 @@ var UIManager = {
GroupItems.saveAll();
TabItems.saveAll();
},
// ----------
// Function: _arrangeBySite
// Blows away all existing groupItems and organizes the tabs into new groupItems based
// on domain.
_arrangeBySite: function() {
function putInGroupItem(set, key) {
var groupItem = GroupItems.getGroupItemWithTitle(key);
if (groupItem) {
set.forEach(function(el) {
groupItem.add(el);
});
} else
new GroupItem(set, { dontPush: true, dontArrange: true, title: key });
}
GroupItems.removeAll();
var groupItems = [];
var leftovers = [];
var items = TabItems.getItems();
items.forEach(function(item) {
var url = item.tab.linkedBrowser.currentURI.spec;
var domain = url.split('/')[2];
if (!domain)
leftovers.push(item.container);
else {
var domainParts = domain.split(".");
var mainDomain = domainParts[domainParts.length - 2];
if (groupItems[mainDomain])
groupItems[mainDomain].push(item.container);
else
groupItems[mainDomain] = [item.container];
}
});
for (key in groupItems) {
var set = groupItems[key];
if (set.length > 1) {
putInGroupItem(set, key);
} else
leftovers.push(set[0]);
}
if (leftovers.length)
putInGroupItem(leftovers, "mixed");
GroupItems.arrange();
},
};
// ----------

View File

@ -3,6 +3,7 @@
*/
body {
background-color: transparent;
font-family: Tahoma, sans-serif !important;
color: rgba(0,0,0,0.4);
font-size: 12px;
@ -18,15 +19,11 @@ body {
.tab {
padding: 4px 6px 6px 4px;
background-color: #D7D7D7;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(245,245,245,1);
-moz-border-radius: 0.4em;
-moz-box-shadow: 0 1px 0 #FFFFFF inset,
0 -1px 1px rgba(255, 255, 255, 0.4) inset,
1px 0 1px rgba(255, 255, 255, 0.4) inset,
-1px 0 1px rgba(255, 255, 255, 0.4) inset,
0 1px 2px rgba(0, 0, 0, 0.4);
-moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px;
cursor: pointer;
margin: 4px;
}
.tab canvas,
@ -34,23 +31,26 @@ body {
border: 1px solid rgba(0,0,0,0.2);
}
.thumb {
-moz-box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.2);
.thumb-shadow {
border-bottom: 5px solid rgba(0,0,0,0.05);
margin-right: -12px;
bottom: 2px;
width: 94.5%;
}
.favicon {
background-color: #D7D7D7;
background-color: rgba(245,245,245,1);
-moz-border-radius-bottomright: 0.4em;
-moz-box-shadow:
0 -1px 0 rgba(225, 225, 225, 0.8) inset,
-1px 0 0 rgba(225, 225, 225, 0.8) inset;
inset rgba(255, 255, 255, 0.6) 0 -2px 0px,
inset rgba(255, 255, 255, 0.6) -2px 0px 0px;
padding: 4px 6px 6px 4px;
top: 4px;
left: 4px;
border-right: 1px solid rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
height: 16px;
width: 16px;
border-right: 1px solid rgba(0,0,0,0.2);
border-bottom: 1px solid rgba(0,0,0,0.2);
height: 17px;
width: 17px;
}
.favicon img {
@ -73,7 +73,7 @@ body {
}
.expander {
bottom: 8px;
bottom: 6px;
right: 6px;
width: 16px;
height: 16px;
@ -85,13 +85,6 @@ body {
opacity: 1.0;
}
.close:hover,
.expander:hover {
-moz-transition-property: opacity;
-moz-transition-duration: 0.5s;
-moz-transition-timing-function: ease-out;
}
.favicon img:hover,
.close img:hover,
.expander img:hover {

View File

@ -5,7 +5,7 @@
body {
background-color: transparent;
font-family: Tahoma, sans-serif !important;
color: rgba(0, 0, 0, 0.6);
color: rgba(0,0,0,0.4);
font-size: 12px;
line-height: 16px;
}
@ -19,36 +19,38 @@ body {
.tab {
padding: 4px 6px 6px 4px;
background-color: #D7D7D7;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(245,245,245,1);
-moz-border-radius: 0.4em;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0.5);
-moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px;
cursor: pointer;
margin: 8px;
}
.tab canvas,
.cached-thumb {
border: 1px solid rgba(0, 0, 0, 0.3);
border: 1px solid rgba(0,0,0,0.2);
}
.thumb {
-moz-box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.2);
.thumb-shadow {
border-bottom: 5px solid rgba(0,0,0,0.05);
margin-right: -12px;
bottom: 2px;
width: 94.5%;
}
.favicon {
background-color: #D7D7D7;
background-color: rgba(245,245,245,1);
-moz-border-radius-bottomright: 0.4em;
-moz-box-shadow:
0 -1px 0 rgba(225, 225, 225, 0.8) inset,
-1px 0 0 rgba(225, 225, 225, 0.8) inset;
inset rgba(255, 255, 255, 0.6) 0 -2px 0px,
inset rgba(255, 255, 255, 0.6) -2px 0px 0px;
padding: 4px 6px 6px 4px;
top: 4px;
left: 4px;
border-right: 1px solid rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
height: 16px;
width: 16px;
border-right: 1px solid rgba(0,0,0,0.2);
border-bottom: 1px solid rgba(0,0,0,0.2);
height: 17px;
width: 17px;
}
.favicon img {
@ -62,30 +64,24 @@ body {
right: 6px;
width: 16px;
height: 16px;
background: url(chrome://global/skin/icons/closetab.png) no-repeat;
-moz-transition-property: opacity;
-moz-transition-duration: 0.5s;
-moz-transition-timing-function: ease-out;
opacity: 0.2;
background: url(chrome://global/skin/icons/closetab.png) no-repeat;
}
.close:hover {
opacity: 1.0;
}
.expander {
bottom: 8px;
bottom: 6px;
right: 6px;
width: 16px;
height: 16px;
background: url(chrome://global/skin/icons/resizer.png) no-repeat;
-moz-transition-property: opacity;
-moz-transition-duration: 0.5s;
-moz-transition-timing-function: ease-out;
opacity: 0.2;
}
.close:hover,
.expander:hover {
-moz-transition-property: opacity;
-moz-transition-duration: 0.5s;
-moz-transition-timing-function: ease-out;
opacity: 1.0;
}
@ -97,12 +93,11 @@ body {
}
.tab-title {
bottom: -20px;
top: 100%;
text-align: center;
width: 94.5%;
white-space: nowrap;
overflow: hidden;
text-shadow: 0 1px rgba(255, 255, 255, 0.6);
}
.stacked {
@ -123,9 +118,8 @@ body {
-moz-box-shadow: none !important;
}
.tab.focus {
-moz-box-shadow: 0 0 8px -moz-mac-menuselect/*#0060D6*/;
border: 1px solid rgba(255, 255, 255, 0.6);
.focus {
-moz-box-shadow: rgba(54,79,225,1) 0px 0px 5px -1px !important;
}
/* Tab: Zooming
@ -139,34 +133,26 @@ body {
display: none;
}
.front .thumb {
.front .focus {
-moz-box-shadow: none !important;
}
.front.focus {
-moz-box-shadow: none !important;
border: none !important;
}
/* Tab GroupItem
----------------------------------*/
.tabInGroupItem {
-moz-box-shadow: none;
border-color: transparent;
background-color: transparent;
}
.tabInGroupItem .favicon {
background-color: #EBEBEB;
border: none;
-moz-box-shadow: none !important;
}
.groupItem {
cursor: move;
background-color: #EBEBEB;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(248,248,248,1);
-moz-border-radius: 0.4em;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
border: 1px solid rgba(255, 255, 255, 0.5);
-moz-box-shadow:
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0,0.2) 1px 1px 4px;
}
.groupItem.activeGroupItem {
@ -175,7 +161,7 @@ body {
}
.phantom {
border: 1px solid rgba(255, 255, 255, 0.5);
border: 1px solid rgba(190,190,190,1);
}
.overlay {
@ -354,4 +340,4 @@ input.defaultName {
height: 12px;
right: 1px;
bottom: 1px;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -3,14 +3,15 @@
*/
body {
background-color: transparent;
font-family: Tahoma, sans-serif !important;
color: rgba(0, 0, 0, 0.6);
font-size: 13px;
color: rgba(0,0,0,0.4);
font-size: 12px;
line-height: 16px;
}
#bg {
background: url("chrome://browser/skin/tabview/grain.png") repeat scroll center top, -moz-linear-gradient(center top , #CCD9EA, #C7D5E7) repeat scroll 0 0 transparent;
background: -moz-linear-gradient(top,#F1F5FB,#EDF4FB);
}
/* Tabs
@ -18,35 +19,36 @@ body {
.tab {
padding: 4px 6px 6px 4px;
background-color: #E0EAF5;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(245,245,245,1);
-moz-border-radius: 0.4em;
-moz-box-shadow:
0 1px 0 #FFFFFF inset,
0 -1px 1px rgba(255, 255, 255, 0.8) inset,
1px 0 1px rgba(255, 255, 255, 0.8) inset,
-1px 0 1px rgba(255, 255, 255, 0.8) inset,
0 1px 2px rgba(4, 38, 60, 0.4);
-moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px;
cursor: pointer;
margin: 4px;
}
.tab canvas,
.cached-thumb {
border: 1px solid rgba(73, 99, 119, 0.3);
border: 1px solid rgba(0,0,0,0.2);
}
.thumb {
-moz-box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.1);
.thumb-shadow {
border-bottom: 5px solid rgba(0,0,0,0.05);
margin-right: -12px;
bottom: 2px;
width: 94.5%;
}
.favicon {
background-color: #E0EAF5;
background-color: rgba(245,245,245,1);
-moz-border-radius-bottomright: 0.4em;
-moz-box-shadow:
inset rgba(255, 255, 255, 0.6) 0 -2px 0px,
inset rgba(255, 255, 255, 0.6) -2px 0px 0px;
padding: 4px 6px 6px 4px;
top: 4px;
left: 4px;
border-right: 1px solid rgba(73, 99, 119, 0.3);
border-bottom: 1px solid rgba(73, 99, 119, 0.3);
border-right: 1px solid rgba(0,0,0,0.2);
border-bottom: 1px solid rgba(0,0,0,0.2);
height: 17px;
width: 17px;
}
@ -62,11 +64,12 @@ body {
right: 6px;
width: 16px;
height: 16px;
background: url(chrome://global/skin/icons/Close.gif) no-repeat;
-moz-transition-property: opacity;
-moz-transition-duration: 0.5s;
-moz-transition-timing-function: ease-out;
opacity: 0.2;
background: url(chrome://global/skin/icons/Close.gif) no-repeat;
}
.close:hover {
opacity: 1.0;
}
.expander {
@ -75,17 +78,10 @@ body {
width: 16px;
height: 16px;
background: url(chrome://global/skin/icons/resizer.png) no-repeat;
-moz-transition-property: opacity;
-moz-transition-duration: 0.5s;
-moz-transition-timing-function: ease-out;
opacity: 0.2;
}
.close:hover,
.expander:hover {
-moz-transition-property: opacity;
-moz-transition-duration: 0.5s;
-moz-transition-timing-function: ease-out;
opacity: 1.0;
}
@ -97,12 +93,11 @@ body {
}
.tab-title {
bottom: -20px;
top: 100%;
text-align: center;
width: 94.5%;
white-space: nowrap;
overflow: hidden;
text-shadow: 0 1px rgba(255, 255, 255, 0.6);
}
.stacked {
@ -123,13 +118,8 @@ body {
-moz-box-shadow: none !important;
}
.tab.focus {
-moz-box-shadow:
0 1px 0 #FFFFFF inset,
0 -1px 1px #FFFFFF inset,
1px 0 1px #FFFFFF inset,
-1px 0 1px #FFFFFF inset,
0 0 8px #007ECE;
.focus {
-moz-box-shadow: rgba(54,79,225,1) 0px 0px 5px -1px !important;
}
/* Tab: Zooming
@ -143,11 +133,7 @@ body {
display: none;
}
.front .thumb {
-moz-box-shadow: none !important;
}
.front.focus {
.front .focus {
-moz-box-shadow: none !important;
}
@ -155,24 +141,18 @@ body {
----------------------------------*/
.tabInGroupItem {
-moz-box-shadow: none;
background-color: #E0EAF5;
}
.tabInGroupItem .favicon {
background-color: #E0EAF5;
border: none;
-moz-box-shadow: none !important;
}
.groupItem {
cursor: move;
background-color: #E0EAF5;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(248,248,248,1);
-moz-border-radius: 0.4em;
-moz-box-shadow:
0 1px 0 #FFFFFF inset,
0 -1px 1px rgba(255, 255, 255, 0.8) inset,
1px 0 1px rgba(255, 255, 255, 0.8) inset,
-1px 0 1px rgba(255, 255, 255, 0.8) inset,
0 1px 4px rgba(4, 38, 60, 0.6);
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0,0.2) 1px 1px 4px;
}
.groupItem.activeGroupItem {
@ -181,6 +161,7 @@ body {
}
.phantom {
border: 1px solid rgba(190,190,190,1);
}
.overlay {