Comment 33 for bug 327863

Revision history for this message
In , Zack Weinberg (zackw) wrote :

Created attachment 373011
patch part 2 (works now): just clamp computed border/padding to containing box

Here is a fully working patch - no inappropriate scrollbars, no pres shell assertions - that doesn't need to touch styles at all and (I think) gets to the real root of the problem. Basically, when we set up a reflow-state object, we were already clamping the computed height and width to the containing block's height and width, but we also need to do the same to the 'mComputedBorderPadding' and 'mComputedPadding' margin objects, when even they do not fit. I have not been able to write a HTML-only test case for this -- a HTML box's size seems to be bounded below by the size of its border+padding, even if there are explicit width:/height: settings in CSS. In the scenario that triggers the bug, the bad borders are coming from the native theme and do not go through whatever calculation forces a larger size. (Which is as it should be, since nsGfxScrollFrame needs to be able to force a scrollbar's dimensions to zero no matter what the theme wants.)

We really do need all of the logic I added to nsHTMLReflowState; under some (unclear to me) conditions, the box is smaller than its border+padding but not of zero size.