Closed
Bug 83786
Opened 23 years ago
Closed 23 years ago
Table width algorithm ignores right margin (and uses left margin instead) [MARGIN-H] (tables, margins)
Categories
(Core :: Layout: Tables, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: ian, Assigned: bernd_mozilla)
References
()
Details
(Keywords: css2, testcase, Whiteboard: [Hixie-P3])
Attachments
(1 file)
1.41 KB,
patch
|
Details | Diff | Splinter Review |
When working out if a table fits in its container (and thus whether it should be shrunk), we use the left margin instead of the right margin. Thus, for example, in: table { margin-left: 1em; margin-right: 10em; } ...we assume that the table has horizontal margins of "2em" when trying to size the table. Later, when we actually lay the table out and work out if we need scroll bars, we correctly realise that the right margin is 10em. This is visible in one of the testcases mentioned on bug 72060: http://web.thock.com/mozilla/css_bug2b.html The table should have 10em right margin, but when being sized our code assumes that the table has 0 right margin (since the left margin is 0) and therefore sizes the table to 100% (modulo borders). When we then lay this out, we see the right margin and therefore provide a horizontal scrollbar. This works fine when borders are used in the test instead of margins: http://www.hixie.ch/tests/adhoc/css/box/table/005.html
Reporter | ||
Updated•23 years ago
|
steeling the bug; the following patch fixes the problem Index: nsTableOuterFrame.cpp =================================================================== RCS file: /cvsroot/mozilla/layout/html/table/src/nsTableOuterFrame.cpp,v retrieving revision 3.191 diff -u -w -r3.191 nsTableOuterFrame.cpp --- nsTableOuterFrame.cpp 2001/05/17 23:52:29 3.191 +++ nsTableOuterFrame.cpp 2001/06/04 16:35:08 @@ -521,7 +521,7 @@ GetMarginPadding(aPresContext, aOuterRS, aChildFrame, marginIgnore, aMarginNoAuto, aPadding); nscoord width = aOuterWidth; if (NS_UNCONSTRAINEDSIZE != width) { - width = aOuterWidth - aMarginNoAuto.left + aMarginNoAuto.right; + width = aOuterWidth - aMarginNoAuto.left - aMarginNoAuto.right; width = PR_MAX(width, mMinCaptionWidth); } return width;
Assignee: karnaze → bernd.mielke
despite the discouraging comments at http://www.hixie.ch/tests/adhoc/css/box/table tables need some more love (e.g. testcases). The provided patch fixes hixies testcase and improves the picture at http://lxr.mozilla.org/mozilla/source/layout/html/tests/table/bugs/bug15247.html where the margin at the right of the second and third nested table is removed. (I like regression tests!!). Further it makes nsTableFrame.cpp more stringent because it removes completely the reference to margins that should be handled in the outer frame.
Reporter | ||
Comment 4•23 years ago
|
||
The patch certainly logically explains the effect I was seeing. Bernd: The person to ask for tables test cases is amar@netscape.com (the QA contact for this bug, incidentally). Feel free to cc me on any correspondence.
Keywords: mozilla0.9.2
Comment 5•23 years ago
|
||
r=karnaze.
Comment 6•23 years ago
|
||
sr=attinasi
a=dbaron for trunk checkin on behalf of drivers
fix checked in,
>The person to ask for tables test cases is amar@netscape.com (the QA
>contact for this bug, incidentally). Feel free to cc me on any correspondence.
I know, but I know how makes the best testcases in town :-)
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•