Break too long line in group tabs
This commit is contained in:
parent
5d0f792b03
commit
696bda9e8d
@ -272,6 +272,11 @@ GroupTab.prototype = inherit(TreeStyleTabBase, {
|
||||
case 'TabSelect':
|
||||
return this.onTabSelect(aEvent);
|
||||
|
||||
case 'overflow':
|
||||
return this.onOverflow(aEvent);
|
||||
case 'underflow':
|
||||
return this.onUnderflow(aEvent);
|
||||
|
||||
case this.kEVENT_TYPE_ATTACHED:
|
||||
return this.onTabAttached(aEvent);
|
||||
case this.kEVENT_TYPE_DETACHED:
|
||||
@ -293,6 +298,8 @@ GroupTab.prototype = inherit(TreeStyleTabBase, {
|
||||
this.window.addEventListener('unload', this, false);
|
||||
this.window.addEventListener('click', this, false);
|
||||
this.window.addEventListener('dblclick', this, false);
|
||||
this.window.addEventListener('overflow', this, false);
|
||||
this.window.addEventListener('underflow', this, false);
|
||||
|
||||
tab.addEventListener('TabSelect', this, false);
|
||||
tab.addEventListener('TabClose', this, false);
|
||||
@ -324,6 +331,8 @@ GroupTab.prototype = inherit(TreeStyleTabBase, {
|
||||
this.window.removeEventListener('unload', this, false);
|
||||
this.window.removeEventListener('click', this, false);
|
||||
this.window.removeEventListener('dblclick', this, false);
|
||||
this.window.removeEventListener('overflow', this, false);
|
||||
this.window.removeEventListener('underflow', this, false);
|
||||
|
||||
tab.removeEventListener('TabSelect', this, false);
|
||||
tab.removeEventListener('TabClose', this, false);
|
||||
@ -394,6 +403,22 @@ GroupTab.prototype = inherit(TreeStyleTabBase, {
|
||||
this.shouldUpdate = false;
|
||||
},
|
||||
|
||||
onOverflow : function GT_onOverflow(aEvent)
|
||||
{
|
||||
var target = aEvent.originalTarget;
|
||||
if (target.className != PseudoTreeBuilder.kTREEITEM)
|
||||
return;
|
||||
target.style.minHeight = target.lastChild.boxObject.height + 'px';
|
||||
},
|
||||
|
||||
onUnderflow : function GT_onUnderflow(aEvent)
|
||||
{
|
||||
var target = aEvent.originalTarget;
|
||||
if (target.className != PseudoTreeBuilder.kTREEITEM)
|
||||
return;
|
||||
target.style.minHeight = '';
|
||||
},
|
||||
|
||||
onTabAttached : function GT_onTabAttached(aEvent)
|
||||
{
|
||||
var tab = aEvent.detail.parentTab;
|
||||
|
@ -96,30 +96,37 @@ var PseudoTreeBuilder = {
|
||||
var w = doc.defaultView;
|
||||
|
||||
var item = doc.createElement('hbox');
|
||||
item.setAttribute('class', this.kTREEROW);
|
||||
item.setAttribute('class', this.kTREEITEM);
|
||||
item.setAttribute('flex', 1);
|
||||
|
||||
var favicon = item.appendChild(doc.createElement('image'));
|
||||
favicon.setAttribute('src', aTab.getAttribute('image') || 'chrome://mozapps/skin/places/defaultFavicon.png');
|
||||
favicon.setAttribute('class', this.kFAVICON);
|
||||
|
||||
var label = item.appendChild(doc.createElement('label'));
|
||||
label.setAttribute('value', aTab.label);
|
||||
label.setAttribute('flex', 1);
|
||||
label.textContent = aTab.label;
|
||||
var tooltip = aTab.label;
|
||||
var uri = aTab.linkedBrowser.currentURI.spec;
|
||||
if (w.isBlankPageURL ? !w.isBlankPageURL(uri) : (uri != 'about:blank')) tooltip += '\n' + uri;
|
||||
label.setAttribute('tooltiptext', tooltip);
|
||||
label.setAttribute('class', 'text-link '+this.kTREEITEM);
|
||||
label.setAttribute('class', 'text-link');
|
||||
label.setAttribute('tab-id', TreeStyleTabBase.getTabValue(aTab, TreeStyleTabBase.kID));
|
||||
|
||||
var row = doc.createElement('hbox');
|
||||
row.setAttribute('class', this.kTREEROW);
|
||||
row.setAttribute('flex', 1);
|
||||
row.appendChild(item);
|
||||
|
||||
var children = this.createTabChildren(aTab);
|
||||
if (children) {
|
||||
let container = doc.createElement('vbox');
|
||||
container.appendChild(item);
|
||||
container.appendChild(row);
|
||||
container.appendChild(children);
|
||||
return container;
|
||||
}
|
||||
else {
|
||||
return item;
|
||||
return row;
|
||||
}
|
||||
},
|
||||
|
||||
@ -132,11 +139,11 @@ var PseudoTreeBuilder = {
|
||||
return null;
|
||||
|
||||
var container = doc.createElement('vbox');
|
||||
container.setAttribute('class', this.kTREECHILDREN);
|
||||
for (let i = 0, maxi = children.length; i < maxi; i++)
|
||||
{
|
||||
container.appendChild(this.createTabItem(children[i]));
|
||||
}
|
||||
container.setAttribute('class', this.kTREECHILDREN);
|
||||
return container;
|
||||
}
|
||||
};
|
||||
|
@ -66,3 +66,7 @@
|
||||
.treestyletab-pseudo-tree-root-item {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.treestyletab-pseudo-tree-item {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user