The display style problem of div insides a table

RESOLVED FIXED in mozilla2.0b8

Status

()

RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: yli, Assigned: Ms2ger)

Tracking

Trunk
mozilla2.0b8
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

8 years ago
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?

Comment 1

8 years ago
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?
(Assignee)

Comment 6

8 years ago
Certainly.
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
(Assignee)

Comment 7

8 years ago
Created attachment 489601 [details] [diff] [review]
Patch v1
Attachment #489601 - Flags: review?(bzbarsky)
(Assignee)

Updated

8 years ago
Keywords: checkin-needed
OS: Windows 7 → All
Hardware: x86 → All
Version: unspecified → Trunk
(Assignee)

Comment 8

8 years ago
Created attachment 489780 [details] [diff] [review]
Patch for checkin
Attachment #489601 - Attachment is obsolete: true
http://hg.mozilla.org/mozilla-central/rev/35dfd6a0ace7
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
You need to log in before you can comment on or make changes to this bug.