Closed Bug 550889 Opened 14 years ago Closed 14 years ago

"ASSERTION: Invalid computed height: 'aComputedHeight >= 0'" with negative margins and display:block in XUL

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(2 files, 1 obsolete file)

311 bytes, application/vnd.mozilla.xul+xml
Details
1.27 KB, patch
bzbarsky
: review+
Details | Diff | Splinter Review
Attached file testcase (obsolete) —
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a3pre) Gecko/20100307 Minefield/3.7a3pre

Loading the testcase causes nsFrame::BoxReflow to pass negative values to SetComputedHeight.

I'm hitting this assertion in bug 547787 because I'm using ::before and ::after with negative margins. (I need to set display: block on them because display: -moz-box will give me the warning "XUL box for _moz_generated_content_before element contained an inline #text child, forcing all its children to be wrapped in a block.")
Attached file testcase
the other testcase was wrong
Attachment #431103 - Attachment is obsolete: true
> Loading the testcase causes nsFrame::BoxReflow to pass negative values to
> SetComputedHeight.

Sounds like a bug in nsFrame::BoxReflow.  Want to fix?
I'm not sure how to. Why does it add the margins to the width / height at all?
Possibly because in the XUL box model there's really no good place to put the margins?  One of the neils might know better...
Neil, do you know what to do here?
Ah, some lines further down there's this code:

 computedHeight = NS_MAX(computedHeight, 0);
 reflowState.SetComputedHeight(computedHeight); 

Should we just do the same here?
That should generally be done at SetComputedHeight callsites that can't guarantee non-negative numbers, yes.
Attached patch v1Splinter Review
Assignee: nobody → mstange
Status: NEW → ASSIGNED
Attachment #438255 - Flags: review?(bzbarsky)
Comment on attachment 438255 [details] [diff] [review]
v1

r=bzbarsky.  Sorry for the terrible lag here...
Attachment #438255 - Flags: review?(bzbarsky) → review+
http://hg.mozilla.org/mozilla-central/rev/985cdfad1c7e
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: