Closed Bug 893496 Opened 12 years ago Closed 12 years ago

"Assertion failure: curFlexWeight >= 0.0f (weights are non-negative)"

Categories

(Core :: Layout, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: jruderman, Assigned: dholbert)

References

Details

(Keywords: assertion, testcase)

Attachments

(3 files)

Attached file testcase
Assertion failure: curFlexWeight >= 0.0f (weights are non-negative), at layout/generic/nsFlexContainerFrame.cpp:1361
Attached file stack
Assignee: nobody → dholbert
I can reproduce in my Linux debug build (64-bit).
Status: NEW → ASSIGNED
OS: Mac OS X → All
(I can still reproduce this in trunk debug builds, BTW. Sorry for the non-action here; hoping to look into it soon.)
So what's happening here is: - The flex-shrink property value ends up being parsed as (float)infinity. - When we use that flex-shrink value, we normalize it by multiplying it by the flex-basis, which is 0. - So we end up performing infinity * 0, which produces -nan(0x400000) (according to GDB), which fails our >=0 assertion.
(In reply to Daniel Holbert [:dholbert] from comment #4) > - When we use that flex-shrink value, we normalize it by multiplying it by > the flex-basis, which is 0. (er, technically I meant to say s/flex-basis/flex base size/ there. They're basically the same thing; the flex base size is really just the resolved version of flex-basis, for cases with e.g. "flex-basis:auto".) So anyway -- in cases where we'd get infinity * 0 in this particular multiplication, the reasonable thing to do is to return 0 (as opposed to e.g. returning infinity). That's because the question we're really trying to answer here is "how far is this FlexItem willing to shrink below its flex base size?" -- and the "0" value in the multiplication here actually indicates that we're *already* at 0. We can't shrink beyond that, so we shouldn't volunteer to shrink any further. Patch coming up to do that.
If you're curious, the relevant chunk of the spec here is step 5 under: http://dev.w3.org/csswg/css-flexbox/#resolve-flexible-lengths and here's an MXR link to the code, for more context: http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsFlexContainerFrame.cpp#327 (The spec text used to use the terms "flex weight" & "scaled flex shrink weight", which is why those terms appear in the code comments. Now the spec uses "flex factor" & "scaled flex shrink factor" instead.)
Comment on attachment 8355899 [details] [diff] [review] fix v1: return 0 early, for "multiplying by 0" case, to avoid inf*0 r=mats
Attachment #8355899 - Flags: review?(matspal) → review+
Flags: in-testsuite+
Hardware: x86_64 → All
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: