Closed
Bug 216303
Opened 21 years ago
Closed 20 years ago
[FIX]percentage heights don't work for auto-width floats
Categories
(Core :: Layout: Floats, defect, P1)
Core
Layout: Floats
Tracking
()
RESOLVED
FIXED
mozilla1.8beta1
People
(Reporter: timo, Assigned: bzbarsky)
References
()
Details
Attachments
(2 files, 2 obsolete files)
(deleted),
application/xhtml+xml; charset=UTF-8
|
Details | |
(deleted),
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
In the page at http://www.cs.helsinki.fi/u/tksuoran/div_height_percentage.html,
the three <div> elements should usually have the same size due to CSS height:
90% property. I believe that Mozilla does not support percentages in this case.
I tried to put the divs inside a div of different class which had fixed pixel
height but the problem remained.
Reproducible: Always
Steps to Reproduce:
1.Go to http://www.cs.helsinki.fi/u/tksuoran/div_height_percentage.html
2.
3.
Actual Results:
The <div> elements appear as their height property would be auto.
Expected Results:
The <div> elements should appear as their height property would 90%, which
usually makes the three elements the same height.
Comment 1•21 years ago
|
||
http://www.w3.org/TR/CSS21/visudet.html#the-height-property says:
<percentage>
Specifies a percentage height. The percentage is calculated with respect to
the height of the generated box's containing block. If the height of the
containing block is not specified explicitly (i.e., it depends on content
height), and this element is not positioned, the value is interpreted like 'auto'.
Sometimes things like:
html, body { height: 100%; }
do what you want, although they may have other side-effects.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 2•21 years ago
|
||
Originally I did not have the html, body { height: 100%; } in my style. I had
the bug before that and now that I removed it I still have the bug. Someone
suggested it as a fix but it did not work. However at that time I forgot to
remove it.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 3•21 years ago
|
||
The problem is that percentage heights don't seem to be working for auto-width
floats.
Assignee: other → float
Status: UNCONFIRMED → NEW
Component: Layout → Layout: Floats
Ever confirmed: true
Summary: div { height: 90%; } percentages for CSS height property appears to be ignored. → percentage heights don't work for auto-width floats
Comment 4•21 years ago
|
||
Updated•21 years ago
|
Severity: trivial → major
Comment on attachment 144940 [details]
another test case.
my apologies, this test case seems to be bettter suited for Bug #208602.
(Browser:Layout:Block and Inline)
Attachment #144940 -
Attachment is obsolete: true
Assignee | ||
Comment 7•20 years ago
|
||
Still need to run the regression tests on this.
Assignee: layout.floats → bzbarsky
Status: NEW → ASSIGNED
Assignee | ||
Updated•20 years ago
|
Priority: -- → P1
Summary: percentage heights don't work for auto-width floats → [FIX]percentage heights don't work for auto-width floats
Target Milestone: --- → mozilla1.8beta
Assignee | ||
Comment 8•20 years ago
|
||
I ran this through the regression tests, and it passed...
Attachment #170980 -
Attachment is obsolete: true
Attachment #170988 -
Flags: superreview?(dbaron)
Attachment #170988 -
Flags: review?(dbaron)
Comment 9•20 years ago
|
||
Comment on attachment 170988 [details] [diff] [review]
Fix the assert
I'm hoping the logic you're moving doesn't actually do anything useful, but
r+sr=dbaron.
The assertion doesn't seem bulletproof, though, since widthUnit can be set to
auto if aContainingBlockWidth is NS_UNCONSTRAINEDSIZE. You might want to see
if you can get the assertion to fire and maybe test to see if the behavior in
that case changes at all...
Attachment #170988 -
Flags: superreview?(dbaron)
Attachment #170988 -
Flags: superreview+
Attachment #170988 -
Flags: review?(dbaron)
Attachment #170988 -
Flags: review+
Assignee | ||
Comment 10•20 years ago
|
||
widthUnit will be auto only if the actual unit is auto or if the actual unit is
percent and NS_UNCONSTRAINEDSIZE == aContainingBlockWidth, as you say. But the
assert I added is in the else branch of:
if ((NS_UNCONSTRAINEDSIZE == aContainingBlockWidth) &&
(eStyleUnit_Percent == mStylePosition->mWidth.GetUnit())) {
} else if (NS_STYLE_DISPLAY_TABLE == mStyleDisplay->mDisplay) {
} else {
}
(the first condition just didn't make the context, for which I apologize). So
the assertion looks correct to me...
Comment 11•20 years ago
|
||
ah, ok. Never mind, then.
Assignee | ||
Comment 12•20 years ago
|
||
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago → 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•