Firefox can remove "overflow" property wrongly, by horizontal overflow/underflow on a vertical tab bar.

This commit is contained in:
Piro / SHIMODA Hiroshi 2012-01-15 03:42:51 +09:00
parent 17c7280d05
commit c604a72eec

View File

@ -1264,6 +1264,13 @@ TreeStyleTabBrowser.prototype = {
this.updateTabCollapsed(aTab, aTab.getAttribute(this.kCOLLAPSED) == 'true', true); this.updateTabCollapsed(aTab, aTab.getAttribute(this.kCOLLAPSED) == 'true', true);
}, this); }, this);
// for updateTabbarOverflow(), we should reset the "overflow" now.
b.mTabContainer.removeAttribute('overflow');
let (container = this.document.getAnonymousElementByAttribute(b.mTabContainer, 'class', 'tabs-container')) {
if (container)
container.removeAttribute('overflow');
}
this.updateTabbarState(false); this.updateTabbarState(false);
var self = this; var self = this;
@ -1717,36 +1724,30 @@ TreeStyleTabBrowser.prototype = {
var d = this.document; var d = this.document;
var b = this.mTabBrowser; var b = this.mTabBrowser;
b.mTabContainer.removeAttribute('overflow'); b.mTabContainer.removeAttribute('overflow');
var container = d.getAnonymousElementByAttribute(b.mTabContainer, 'class', 'tabs-container'); var container = d.getAnonymousElementByAttribute(b.mTabContainer, 'class', 'tabs-container') || b.mTabContainer;
if (!container) { if (container != b.mTabContainer)
if (this.ownerToolbar) container.removeAttribute('overflow');
container = b.mTabContainer;
else
return;
}
container.removeAttribute('overflow');
var scrollBox = this.scrollBox; var scrollBox = this.scrollBox;
this.window.setTimeout(function() { scrollBox = d.getAnonymousElementByAttribute(scrollBox, 'anonid', 'scrollbox');
scrollBox = d.getAnonymousElementByAttribute(scrollBox, 'anonid', 'scrollbox'); if (scrollBox) scrollBox = d.getAnonymousNodes(scrollBox)[0];
if (scrollBox) scrollBox = d.getAnonymousNodes(scrollBox)[0]; if (
if ( scrollBox &&
scrollBox && (
( scrollBox.boxObject.width > container.boxObject.width ||
scrollBox.boxObject.width > container.boxObject.width || scrollBox.boxObject.height > container.boxObject.height
scrollBox.boxObject.height > container.boxObject.height )
) ) {
) { b.mTabContainer.setAttribute('overflow', true);
b.mTabContainer.setAttribute('overflow', true); if (container != b.mTabContainer)
container.setAttribute('overflow', true); container.setAttribute('overflow', true);
} }
else { else {
b.mTabContainer.removeAttribute('overflow'); b.mTabContainer.removeAttribute('overflow');
if (container != b.mTabContainer)
container.removeAttribute('overflow'); container.removeAttribute('overflow');
} }
}, 100);
}, },
reinitAllTabs : function TSTBrowser_reinitAllTabs(aSouldUpdateCount) reinitAllTabs : function TSTBrowser_reinitAllTabs(aSouldUpdateCount)
@ -4068,13 +4069,22 @@ TreeStyleTabBrowser.prototype = {
if (horizontal) return; if (horizontal) return;
aEvent.stopPropagation(); aEvent.stopPropagation();
this.positionPinnedTabsWithDelay(); this.positionPinnedTabsWithDelay();
if (aEvent.detail == 1) return; if (aEvent.detail == 1) {
if (aEvent.type == 'overflow') { /**
tabs.setAttribute('overflow', 'true'); * By horizontal overflow/underflow, Firefox can wrongly
this.scrollBoxObject.ensureElementIsVisible(tabs.selectedItem); * removes "overflow" attribute for vertical tab bar.
* We have to override the result.
*/
this.updateTabbarOverflow();
} }
else { else {
tabs.removeAttribute('overflow'); if (aEvent.type == 'overflow') {
tabs.setAttribute('overflow', 'true');
this.scrollBoxObject.ensureElementIsVisible(tabs.selectedItem);
}
else {
tabs.removeAttribute('overflow');
}
} }
}, },