Bug 473847, progressmeters with large max don't work properly, caused by multiplication overflow, r+sr=dbaron

This commit is contained in:
Neil Deakin 2009-01-23 10:02:31 -05:00
parent 9157343457
commit cbee03cb58
4 changed files with 19 additions and 2 deletions

View File

@ -0,0 +1,8 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox height="40">
<spacer flex="6000" style="background-color: red;"/>
<spacer style="background-color: blue;"/>
</hbox>
</window>

View File

@ -0,0 +1,8 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox height="40">
<spacer flex="60000" style="background-color: red;"/>
<spacer style="background-color: blue;"/>
</hbox>
</window>

View File

@ -1021,6 +1021,7 @@ fails == 461512-1.html 461512-1-ref.html # Bug 461512
== 471356-1.html 471356-1-ref.html
== 471594-1.xhtml 471594-1-ref.html
== 472500-1.xul 472500-1-ref.xul
== 473847-1.xul 473847-1-ref.xul
== 474336-1.xul 474336-1-ref.xul
== 474417-1.html 474417-1-ref.html
== 474472-1.html 474472-1-ref.html

View File

@ -1255,7 +1255,7 @@ nsSprocketLayout::ComputeChildSizes(nsIBox* aBox,
// ----- look at our min and max limits make sure we aren't too small or too big -----
if (!computedBoxSizes->valid) {
PRInt32 newSize = pref + sizeRemaining*flex/spacerConstantsRemaining; //NSToCoordRound(float((sizeRemaining*flex)/spacerConstantsRemaining));
PRInt32 newSize = pref + PRInt32(PRInt64(sizeRemaining) * flex / spacerConstantsRemaining);
if (newSize<=min) {
computedBoxSizes->size = min;
@ -1297,7 +1297,7 @@ nsSprocketLayout::ComputeChildSizes(nsIBox* aBox,
flex = boxSizes->flex;
if (!computedBoxSizes->valid) {
computedBoxSizes->size = pref + flex*sizeRemaining/spacerConstantsRemaining; //NSToCoordFloor(float((flex*sizeRemaining)/spacerConstantsRemaining));
computedBoxSizes->size = pref + PRInt32(PRInt64(sizeRemaining) * flex / spacerConstantsRemaining);
computedBoxSizes->valid = PR_TRUE;
}