Closed Bug 610935 Opened 9 years ago Closed 9 years ago

The display style problem of div insides a table

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla2.0b8

People

(Reporter: yli, Assigned: Ms2ger)

Details

Attachments

(1 file, 1 obsolete file)

The html code like this:
<div style="width:300px;background:yellow;height:50px;">
    <table width="150%" cellspacing="0" cellpadding="0" border="0">
        <tr><td style="background:blue;">parent div float=left</td></tr>
    </table>
</div>

In Firefox, the max width of table is the parent div's width.

But in IE, Chrome, Safri and Opera, the width of table is larger than it's parent div.

This is a bug for Firefox?
FWIW it works if you use CSS.
Component: General → Layout: Tables
Product: Firefox → Core
QA Contact: general → layout.tables
Jonas, nsAttrValue::ParseSpecialIntValue has:

1077   if (aCanBePercent && (isPercent || tmp.RFindChar('%') >= 0)) {
1078     if (val > 100) {
1079       val = 100;
1080     }

Why, exactly?
Component: Layout: Tables → DOM
QA Contact: layout.tables → general
OK, this code used to live in nsHTMLValue, and before that in nsGenericHTMLElement.

The original blame is revision 1.1 of nsGenericHTMLElement.cpp:

  1.1 <kipp@netscape.com> 1998-09-02 16:52
  Spanked

Not helpful.

Do any other browsers do this for any %-valued attributes?  If not, can we just nuke lines 1078-1080?

Seems like i just carried that forward. If other browsers don't do it we should nuke it too I agree.
Tested with image width too, and the behavior is the same; no weird clamping in other browsers.

I think we should remove the clamping.  Ms2ger, want to do the honors?
Certainly.
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
Attached patch Patch v1 (obsolete) — Splinter Review
Attachment #489601 - Flags: review?(bzbarsky)
Keywords: checkin-needed
OS: Windows 7 → All
Hardware: x86 → All
Version: unspecified → Trunk
Attachment #489601 - Attachment is obsolete: true
http://hg.mozilla.org/mozilla-central/rev/35dfd6a0ace7
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.