Closed Bug 40038 Opened 24 years ago Closed 24 years ago

[BLOCK-H]strict mode: center around table centers contents instead of table

Categories

(Core :: Layout: Tables, defect, P1)

x86
All
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: ron, Assigned: dbaron)

References

()

Details

(Keywords: html4, testcase, Whiteboard: nsbeta3+)

Attachments

(4 files)

The CENTER element should only center the TABLE on the page.  Current version
also centers the contents of the TABLE, in violation of HTML 4 standards, which
state:  "CENTER only centers the table as a whole, not the contents of each
table cell"
Yep, this isn't right.    At first I thought this was a dupe of bug 36232 or bug
36156.    Those bugs are fixed, though, but this example still shows the
incorrect behavior.
Severity: major → normal
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 98 → All
Keywords: testcase
Summary: CENTER element centers TABLE contents, not just TABLE → <center> around table centers table contents instead of table itself (strict dtd)
Attached file test case
Using the attachment 8938 [details], this may be of interest.

In file:

layout/html/table/src/nsTableCellFrame.cpp The function 
nsTableCellFrame::MapHAlignAttribute is completely commented out by a #if 0 
block.  It says the code depends on bug 1802 and bug 915.

The code does this:

1) If there is already an alignment set on the cell, it does nothing.
2) If there are column or row alignments set, it inherits them for CSS2 
purposes.
3) Otherwise, it sets the alignment to a centered for TH (table header) and left 
for TD (table data)

You can uncomment the block, and it will compile, but no change is evident 
because by the time the function is called, the alignment is already set in 
error to: NS_STYLE_TEXT_ALIGN_MOZ_CENTER, so the function returns after 1) 
above.

I looked around a bit to see if I could figure out where the cell's alignment 
was previously set, but couldn't find it.

While working on this, you might want to see if it is ok to uncomment that 
block.
It works this way intentionally. dbaron's comments at the end of bug 7112 
indicate that this bug may not be valid in standard mode. What part of the html 
4 spec talks about <center> around <table>? The correct way to center the table 
is to have auto left and right margins.
This is probably needed for backwards compatibility in quirks mode.  I think
HTML 3.2 says something about it...
I think what needs to happen here is:
 * CENTER and DIV ALIGN="center" should always map to -moz-center (etc...)
 * TABLE elements should always respond to -moz-center as block-centering
 * in Quirks mode, TABLES should also respond to the text-align property
But I thought that through in 30 seconds, so there's probably something wrong
with it.  I'll think about it some more...

I officially retract my comments at the end of bug 7112.  I think the deprecated
HTML elements should work as they always have, even in standard mode.

I'm going to mark some bugs as dups of this one.  They have nice testcases too
(see http://bugzilla.mozilla.org/showattachment.cgi?attach_id=9500 ).
Summary: <center> around table centers table contents instead of table itself (strict dtd) → strict mode: center around table centers contents instead of table
*** Bug 40979 has been marked as a duplicate of this bug. ***
*** Bug 41076 has been marked as a duplicate of this bug. ***
Buster, the block is probably giving the table auto margins in quirks mode and 
will need to do the same thing in standard mode.
Assignee: karnaze → buster
Status: NEW → ASSIGNED
Priority: P3 → P2
Target Milestone: --- → M17
I think this is the same bug that's causing several sites I administer to be
rendered incorrectly in M16. They render fine in Netscape, IE, M13,M14, and M15
but M16 render everything on the page as if it were centered. Here's another
example for you: http://www.ncc.com/index.html
*** Bug 42334 has been marked as a duplicate of this bug. ***
*** Bug 42801 has been marked as a duplicate of this bug. ***
Priority: P2 → P1
I think I have another example of this bug:
http://www.sas.upenn.edu/~jbaron
The table is centered, as it should be, but the elements
in the table are also centered.  This did not happen in
Milestone 16, but it is happening in what seems to be M17
20000708

Summary: strict mode: center around table centers contents instead of table → [BLOCK-H]strict mode: center around table centers contents instead of table
Correctness, html4, backwards compatibility. PDT team please approve.
Keywords: correctness, html4
Taking this bug since I'm working on it.  I have the tables centered.  All (!) I
have to do is figure out how to reset the alignment inside tables only when the
alignment outside of the tables is MOZ_CENTER or MOZ_RIGHT.
Assignee: buster → dbaron
Status: ASSIGNED → NEW
Target Milestone: M17 → M18
*** Bug 46300 has been marked as a duplicate of this bug. ***
Never mind... it was all there.
Approving for beta3: have a patch and CENTER should work correctly.
Whiteboard: nsbeta3+
Fix checked in, 2000-07-27 16:37 PDT.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Using 8/25 build with original testcase, verified fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: