Closed
Bug 893496
Opened 12 years ago
Closed 12 years ago
"Assertion failure: curFlexWeight >= 0.0f (weights are non-negative)"
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: jruderman, Assigned: dholbert)
References
Details
(Keywords: assertion, testcase)
Attachments
(3 files)
Assertion failure: curFlexWeight >= 0.0f (weights are non-negative), at layout/generic/nsFlexContainerFrame.cpp:1361
Reporter | ||
Comment 1•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → dholbert
Assignee | ||
Comment 2•12 years ago
|
||
I can reproduce in my Linux debug build (64-bit).
Status: NEW → ASSIGNED
OS: Mac OS X → All
Assignee | ||
Comment 3•12 years ago
|
||
(I can still reproduce this in trunk debug builds, BTW. Sorry for the non-action here; hoping to look into it soon.)
Assignee | ||
Comment 4•12 years ago
|
||
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.
Assignee | ||
Comment 5•12 years ago
|
||
(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.
Assignee | ||
Comment 6•12 years ago
|
||
Attachment #8355899 -
Flags: review?(matspal)
Assignee | ||
Comment 7•12 years ago
|
||
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 8•12 years ago
|
||
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+
Assignee | ||
Comment 9•12 years ago
|
||
Assignee | ||
Comment 10•12 years ago
|
||
Flags: in-testsuite+
Hardware: x86_64 → All
Comment 11•12 years ago
|
||
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.
Description
•