Closed Bug 240571 Opened 20 years ago Closed 20 years ago

[FIX]Children of fieldset elements sized using % units inherit an height proportional to that of their parents.

Categories

(Core :: Layout: Block and Inline, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: sl, Assigned: bzbarsky)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 StumbleUpon/1.908
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 StumbleUpon/1.908

When using a percentage unit to specify the height of a fieldset element,     
this element's children's height are multiplied by the height of the    
fieldset element.  In the following example, the yellow area should fill the   
  totality of the fieldset element but it only fills up 75% of it, apparently
because its parent fieldset element has a itself size of 75%.  

    <div style="height: 200px; width: 200px;">
        <fieldset style="height: 75%; width: 75%;">
            <div style="height: 100%; width: 100%; background-color: yellow;">
            </div>
        </fieldset>
    </div>

See URL for live sample.

Reproducible: Always
Steps to Reproduce:
1. Just run the code inserted here in a browser...

Actual Results:  
The yellow area occupies only 75% of the vertical space available in the
fieldset element.

Expected Results:  
The yellow area should occupy 100% of the vertical space available in the
fieldset element.

I'm using the Mostly Crystal Theme.
See description or test case.
Hmm.. I took a partial stab at this in bug 191135, but that's not enough to fix
this case, since percentages inherit as speficied.

I think the right fix here would have to be to make the style contexts of the
fieldsets kids kids of its style context, instead of kids of the anonymous block
context....  I wonder what tables do, exactly.  Or do they have the same bug?

Perhaps nsCSSFrameConstructor::ResolveStyleContext needs to skip style contexts
with the cell-content and fieldset-content pseudos, not just scrolledcontent?
Chris wrote this so my guess is fieldsets have a similiar bizarre style context
relationship like the outer-, inner table frame and caption. For fieldsets we
have to the fieldset, legendframe and the inner frame.
Actually, no.  A fieldset is a lot like a table cell; the legend and areaframe
are kids of the fieldset; everything else is a kid of the areaframe.  But they
shouldn't be inheriting style from the areaframe...
Keywords: testcase
Confirming.....
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch PatchSplinter Review
This breaks height:inherit on the kids of the fieldset, but it does fix this
bug as filed.  I think the latter is more common, and the former should be
handled by parenting the style contexts correctly.

Note that we don't have to worry about quirks percent height stuff because the
fieldset frame cuts it off.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #173034 - Flags: superreview?(roc)
Attachment #173034 - Flags: review?(roc)
OS: Windows 2000 → All
Hardware: PC → All
Summary: Children of fieldset elements sized using % units inherit an height proportional to that of their parents. → [FIx]Children of fieldset elements sized using % units inherit an height proportional to that of their parents.
Target Milestone: --- → mozilla1.8beta
Summary: [FIx]Children of fieldset elements sized using % units inherit an height proportional to that of their parents. → [FIX]Children of fieldset elements sized using % units inherit an height proportional to that of their parents.
Comment on attachment 173034 [details] [diff] [review]
Patch

your comments about height:inherit made me realize that the patch I checked in
today for column heights will break height:inherit in columns ... but like
here, that should be fixed by having column children get the right style
context as parent
Attachment #173034 - Flags: superreview?(roc)
Attachment #173034 - Flags: superreview+
Attachment #173034 - Flags: review?(roc)
Attachment #173034 - Flags: review+
Filed bug 280610 on the inherit issue.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Depends on: 296722
Depends on: 296929
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: