Bug 893496: Avoid doing bogus infinity*0 multiplication when producing a flex weight from huge flex-shrink and 0 flex-basis. r=mats

This commit is contained in:
Daniel Holbert 2014-01-05 20:18:12 -08:00
parent b4da63a774
commit 15caa9885d
3 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<body>
<div style="display: flex;">
<div style="padding: calc(50%);"></div>
<div style="padding: 4px; flex: 0 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;"></div>
</div>
</body>
</html>

View File

@ -514,6 +514,7 @@ needs-focus pref(accessibility.browsewithcaret,true) load 868906.html
load 866547-1.html
asserts(1-4) load 876074-1.html # bug 876749
load 885009-1.html
load 893496-1.html
load 893523.html
test-pref(layout.css.sticky.enabled,true) load 914891.html
test-pref(layout.css.sticky.enabled,true) load 915475.xhtml

View File

@ -335,9 +335,19 @@ public:
return 0.0f;
}
return aIsUsingFlexGrow ?
mFlexGrow :
mFlexShrink * mFlexBaseSize;
if (aIsUsingFlexGrow) {
return mFlexGrow;
}
// We're using flex-shrink --> return mFlexShrink * mFlexBaseSize
if (mFlexBaseSize == 0) {
// Special-case for mFlexBaseSize == 0 -- we have no room to shrink, so
// regardless of mFlexShrink, we should just return 0.
// (This is really a special-case for when mFlexShrink is infinity, to
// avoid performing mFlexShrink * mFlexBaseSize = inf * 0 = undefined.)
return 0.0f;
}
return mFlexShrink * mFlexBaseSize;
}
// Getters for margin: