Closed Bug 969 Opened 26 years ago Closed 25 years ago

[BLOCK] min-width, max-width and min/max-height properties buggy

Categories

(Core :: Layout, defect, P2)

x86
Windows 95
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: angus, Assigned: buster)

References

()

Details

This is a requirement to do better contraints stuff in HTML. buster said it
would be straightforward to hook this up for TD's; I'm filing on Kipp since
there would be additional work involved to hook it up to all elements (DIVs,
etc.)

It grew out of a post I made to mozilla-layout, and David's reply:

"L. David Baron" wrote:
  >From: angus@netscape.com (Angus Davis)
  >I need to be able to do something like:
  >
  ><td style="width: 100%; minimum-width: 100px;">
  >
  >Thoughts? Is there some other way to accomplish this? (CSS geeks - speak
  >up!)
  >-angus

  This is part of the CSS2 spec, except the properties are called
  "min-width" and "max-width".  It is described in detail in
  http://www.w3.org/TR/REC-CSS2/visudet.html#min-max-widths
  (That whole part of the spec is probably worth reading, as it has
  describes quite thoroughly how to handle some rather difficult
  situations.)
  - David Baron
Assignee: kipp → peterl
Component: Layout → Style System
I'm taking this bug until I get these properties hooked up to the style context.
Then I'll give it back :-)
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: peterl → kipp
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 26 years ago26 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Status: REOPENED → ASSIGNED
Resolution: FIXED → ---
Summary: min-width, max-width properties not implemented → min-width, max-width and min/max-height properties buggy
These have been implemented, but they're buggy.  I'm changing the title
appropriately.

First, you're not handling the min/max conflict resolution as described in
http://www.w3.org/TR/REC-CSS2/visudet.html (CSS2, section 10.4 and 10.7)

  If the computed value of 'min-width' is greater than the value of 'max-
  width', 'max-width' is set to the value of 'min-width'.

  (you're doing it backwards)

Second, if max-width is greater than width, you're setting width to max-width.
Same for min-width.  (That is, you're enforcing the constraint as if it were
on both sides!!!)

The bugs for max/min-height are exactly the same.

See test cases:
width:   http://www.fas.harvard.edu/~dbaron/csstest/sec1004.html
height:  http://www.fas.harvard.edu/~dbaron/csstest/sec1007.html
Assignee: kipp → troy
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
To say that they're implemented but buggy is giving us way more credit
than we deserve. Layout hasn't been changed yet to support these properties. :-)
Setting all current Open/Normal to M4.
Component: Style System → Layout
per leger, assigning QA contacts to all open bugs without QA contacts according
to list at http://bugzilla.mozilla.org/describecomponents.cgi?product=Browser
troy - I'm not sure what you mean.  They are reflected in layout, at least on
my system (as I describe above).
What I mean is that Peter is processing the information, and it's included in
the nsStylePosition information. But the frame class code (in particular the
nsHTMLReflowState code) isn't using that information when calculating the
computed width/height yet
Bug #3504 will be cleared up (hopefully) when this gets fixed. Don't want to mark
it as a dup because I want to keep it as a placeholder/reminder.

Adding myself to the cc list.
Summary: min-width, max-width and min/max-height properties buggy → [BLOCK] min-width, max-width and min/max-height properties buggy
Marking blocked because it blocks M4 tasks.
Assignee: troy → kipp
Status: ASSIGNED → NEW
Kipp, the HTML reflow state code has been changed to calculate the computed
values for the min/max properties, and apply them when it can

David Baron's "width" test works, and there's only one problem with the "height"
test (the URL above). That's the case where the block-level element has
'height:auto' and a 'min-height' value. Because the height is shrink-wrap, we
can't apply the 'min-height' constraint until _after_ we do the reflow
QA Contact: 4144 → 4110
Status: ASSIGNED → RESOLVED
Closed: 26 years ago25 years ago
Resolution: --- → FIXED
I've fixed the block element code to honor these properties now; david barons
(simple) css tests for min-width/max-width and min-height/max-height pass now.

If there are bugs with specific elements not honoring the properties, please
either re-open this bug and reassign it to the elements owners (e.g. form
elements are chris karnazes; images are mine, everything else is troys... :-)
or create a new bug per element that has problems (better IMHO)
I'm now unblocked wrt toolbars, and my own bug related to this, 3504, has been
closed because it works as far as i can tell. Thanks Kipp!!
Status: RESOLVED → VERIFIED
Using 3/29 build on Win 95, Win 98, Win NT, Mac8.5 and Linux, verifying bug
fixed.
Sorry, guys, but when using external stylesheets, min/max-width tag is ignored
for table.[class] {}.  Using Fx in WinXP, no SP: Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3.  I recommend you
change the status to REOPENED.
You need to log in before you can comment on or make changes to this bug.