Bug 394666 - prefpane height is incorrect when animateFadeIn is true and some other edgecases. r=mconnor, a1.9=mconnor

This commit is contained in:
rob_strong%exchangecode.com 2007-09-17 19:18:17 +00:00
Родитель 9fb2d4c31b
Коммит a111226247
2 изменённых файлов: 24 добавлений и 12 удалений

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

@ -49,7 +49,7 @@
<overlay id="TabsPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneTabs" helpTopic="prefs-tabs" helpURI="chrome://browser/locale/help/help.rdf" flex="1">
<prefpane id="paneTabs" helpTopic="prefs-tabs" helpURI="chrome://browser/locale/help/help.rdf">
<preferences id="tabsPreferences">
<preference id="browser.link.open_external" name="browser.link.open_external" type="int"/>
@ -75,8 +75,8 @@
<separator id="tabsSeparator"/>
<!-- XXX flex below and on prefpane is a hack because wrapping checkboxes don't
reflow properly; see bug 349098 -->
<!-- XXX flex below is a hack because wrapping checkboxes don't reflow
properly; see bug 349098 -->
<vbox id="tabPrefsBox" align="start" flex="1">
<checkbox id="warnCloseMultiple" label="&warnCloseMultipleTabs.label;"
accesskey="&warnCloseMultipleTabs.accesskey;"

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

@ -575,6 +575,9 @@
}
var panes = this.preferencePanes;
if (this._shouldAnimate)
this.style.minHeight = 0;
var lastPane = null;
if (this.lastSelected) {
lastPane = document.getElementById(this.lastSelected);
@ -735,23 +738,28 @@
this._paneDeck.selectedIndex = i;
if (this.type != "child") {
// Calling sizeToContent after the first prefpane is loaded
// will size the windows contents so style information is
// available to calculate correct sizing.
if (!this._initialized)
window.sizeToContent();
var oldPane = this.lastSelected ? document.getElementById(this.lastSelected) : this.preferencePanes[0];
oldPane.selected = !(aPaneElement.selected = true);
this.lastSelected = aPaneElement.id;
this.currentPane = aPaneElement;
this._initialized = true;
// Only animate if we've switched between prefpanes
if (this._shouldAnimate && oldPane.id != aPaneElement.id) {
// Don't let the new pane content flex to the current window
// height if we're animating
aPaneElement.removeAttribute("flex");
aPaneElement.style.opacity = 0.0;
this.animate(oldPane, aPaneElement);
}
else if (this._initialized && !this._shouldAnimate) {
else if (!this._shouldAnimate) {
var targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer, "").height);
targetHeight -= parseInt(window.getComputedStyle(this, "").paddingTop);
targetHeight -= parseInt(window.getComputedStyle(this, "").paddingBottom);
if (aPaneElement.contentHeight > targetHeight) {
var verticalPadding = parseInt(window.getComputedStyle(aPaneElement, "").paddingTop);
verticalPadding += parseInt(window.getComputedStyle(aPaneElement, "").paddingBottom);
if (aPaneElement.contentHeight > targetHeight - verticalPadding) {
// To workaround the bottom border of a groupbox from being
// cutoff an hbox with a class of bottomBox may enclose it.
// This needs to include its padding to resize properly.
@ -760,10 +768,14 @@
var bottomBox = aPaneElement.getElementsByAttribute("class", "bottomBox")[0];
if (bottomBox)
bottomPadding = parseInt(window.getComputedStyle(bottomBox, "").paddingBottom);
window.innerHeight += bottomPadding + aPaneElement.contentHeight - targetHeight;
window.innerHeight += bottomPadding + verticalPadding + aPaneElement.contentHeight - targetHeight;
}
// XXX rstrong - extend the contents of the prefpane to
// prevent elements from being cutoff (see bug 349098).
if (aPaneElement.contentHeight + verticalPadding < targetHeight)
aPaneElement._content.style.height = targetHeight - verticalPadding + "px";
}
this._initialized = true;
}
break;
}