Closed
Bug 60365
Opened 24 years ago
Closed 23 years ago
Table caption does not center when TABLE's ALIGN attribute is set to 'center'
Categories
(Core :: Layout: Tables, defect, P3)
Core
Layout: Tables
Tracking
()
RESOLVED
FIXED
mozilla0.9.7
People
(Reporter: bono_chris, Assigned: karnaze)
References
Details
(Keywords: testcase, Whiteboard: [awd:tbl] PATCH)
Attachments
(9 files, 2 obsolete files)
296 bytes,
text/html
|
Details | |
529 bytes,
text/html
|
Details | |
989 bytes,
text/html
|
Details | |
1.01 KB,
text/html
|
Details | |
6.88 KB,
image/png
|
Details | |
10.33 KB,
image/png
|
Details | |
382 bytes,
text/html
|
Details | |
670 bytes,
patch
|
attinasi
:
superreview+
|
Details | Diff | Splinter Review |
672 bytes,
patch
|
alexsavulov
:
review+
|
Details | Diff | Splinter Review |
A TABLE that is centered via the ALIGN="CENTER" attribute does not have a
centered caption. The text inside the CAPTION tag is aligned left and cannot be
centered by use of another ALIGN attribute or even with a STYLE attribute.
Comment 1•24 years ago
|
||
Comment 2•24 years ago
|
||
confirm using mozilla trunk 2000-11-20-20 / win2k that <title
align="center"><caption>stuff</caption>...</title> does not center the caption.
Marking New.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•24 years ago
|
||
Please see bug 3166. Are captions supposed to be centered using title tags?
Comment 4•24 years ago
|
||
Sorry. My earlier comment said 'TITLE' when it should have said 'TABLE'. My
excuse is "brain seizure" and I'm sticking to it. bz's attached test case shows
the example with <TABLE ALIGN="CENTER"><CAPTION>...</CAPTION>...</TABLE>
Looking at the HTML 4.01 Spec, I think the CAPTION should be rendered as part of
the table and that it should act like a cell. See HTML 4.01 B.5.2 Recommended
Layout ALgorithms. So, it would seem that if the entire table is ALIGNed with
respect to the BODY, then the CAPTION should be aligned in the same way with
respect to the BODY.
This bug is about CAPTION not being rendered as part of the TABLE while bug 3166
is about the ALIGN attribute of CAPTION not working. I think these are two
separate issues even though the underlying problem may be the same.
Updated•24 years ago
|
QA Contact: chrisd → amar
Comment 5•24 years ago
|
||
QA contact update
Comment 6•24 years ago
|
||
Caption is treated separately from table as per specificattion.
It can be centered by means of CSS.
align= property for caption applies to caption alignment to table I believe
(top, bottom, left, right), not to it's allignment on the document.
But I'm not sure if allign= property for table should affect caption in
Transitional HTML.
adding qawanted keyword.
Keywords: qawanted
Comment 7•24 years ago
|
||
According to www.w3c.org specification " The table captions should behave like
cells and Each caption is a cell that spans all of the table's columns if at the
top or bottom of the table, and rows if at the left or right side of the table."
and also if we load the testcase on Netscape 4.7 the caption is center aligned.
since we support the quirks mode it is a valid bug..
Adding "testcase" keyword
Keywords: testcase
steeling the bug --> patch to come after regression testing
Assignee: karnaze → bernd.mielke
Comment 10•24 years ago
|
||
The only testcase where the regression tests indicated a difference was
bug10140.html. IMHO the rendering is more correct with the patch then before.
The patch takes into account the horizontal table position as indicated by
InnerMargin. Please note that we already take into account the InnerMargin for
vertical alignment, so it seems natural to me to do this also for the horizontal
case.
Comment 11•24 years ago
|
||
Looks right to me: sr=attinasi (pending karnaze's review)
Comment 12•24 years ago
|
||
Comment 13•24 years ago
|
||
Comment 14•24 years ago
|
||
Comment 15•24 years ago
|
||
Comment 16•24 years ago
|
||
please ignore my first patch, the problem here is not that caption is not
centered, the problem is that the caption is too short! If we center the table
the captions left and right margin are 0 by default and as consequence it should
stretch from the left to right edge of the containing block. (Please look at the
CSS2 picture with the collapsed vertical margin.) If we do so, as a result of
the text-align:center in the html.css file the caption text will center by
default. In order to get the caption length correct I had to remove the
innerMarginNoAuto from the width calculation for the caption and to fix an
obvious typo inside the width calculation. With that patch we happily break
bug10140.html. But now I think we implement the correct thing for the last
tables in that testcase.
Assignee | ||
Comment 17•24 years ago
|
||
r=karnaze
Comment 18•24 years ago
|
||
sr=attinasi
Comment 19•24 years ago
|
||
a= asa@mozilla.org for checkin to the trunk.
(on behalf of drivers)
According to CSS2, http://www.w3.org/TR/REC-CSS2/tables.html#q6 , captions above
and below a table should be treated as block boxes adjacent to the table. So I
don't see why this should be a fix in the core layout. Shouldn't this instead
be done in attribute mapping code?
(I admit that the recommendation in B.5.2 of HTML4 slightly disagrees with this,
but that's only a recommendation. Perhaps we should raise this issue with the
CSS working group?)
What does the patch do to the following testcases?
http://www.people.fas.harvard.edu/~dbaron/css/test/sec1704
http://www.people.fas.harvard.edu/~dbaron/css/test/sec1704b
http://www.people.fas.harvard.edu/~dbaron/css/test/sec170401
Comment 22•24 years ago
|
||
Comment 23•24 years ago
|
||
Comment 24•24 years ago
|
||
The patch does not change the picture in testcase 170401. I do not agree with
Davids statement above tables 13-16 in this testcase. I think we are rendering
fine, and the testcase is wrong. The patch clearly improves the picture for
testcase bug10140.html. 1704b exhibits a different problem the containing block
for a absolute positioned table is assumed to have the complete width
furthermore it triggers also without the patch the following assertion:
###!!! ASSERTION: next frame in reflow command is null: 'nextFrame', file C:\moz
_sour\mozilla\mozilla\layout\html\table\src\nsTableOuterFrame.cpp, line 1024
I filed bug 84140 about it.
I agree that the CSS2 and HTML spec describe a different box and rendering
model for table captions.
My personal impression is that the TableOuterFrame is a good place for handling
the inner table frame and caption frame relationship, because I see them more
like equal partners that negotiate the joint rendering e.g. reflow.
I won't object, since I don't have time to get involved in the issues.
Comment 27•24 years ago
|
||
Comment 28•24 years ago
|
||
we should do the same thing we do for the table itself in
http://lxr.mozilla.org/mozilla/source/content/html/content/src/nsHTMLTableElement.cpp#1268
also for the caption.
Comment 29•24 years ago
|
||
Bernd, I don't think you can implement this as a regular attribute-mapping
function. The function would need to access the parent table's 'align'
attribute, which AFAICT, it can't do. The MapAttributeIntoRule function is only
given the attribute data and the rule data, which isn't enough to find the
parent.
I see three ways to fix this bug.
One is to render captions with 'auto' width per CSS2:
"A caption that is above or below a table box also behaves like a block box
for width calculations; the width is computed with respect to the width of
the table box's containing block."
We're not doing this right now, even for an explicitly specified "width: auto".
Another is to default the caption's margins to the same computed value as the
inner table's for HTML documents. CSS widths/margins would override this. I
tried inheriting the margins in html.css to test this, but that didn't work.
The last way I can think of is to place the align="center" handling code--
table[align="center] > caption {margin-left: auto; margin-right: auto;}
--in html.css (where, being a non-CSS presentational hint, it doesn't really
belong).
I'd prefer implementing "width: auto" properly and setting the horizontal
margins to "inherit". This would not only be CSS2 compliant, but seem to follow
HTML4's recommendation as well. It would depend on "width: auto" working,
'inherit' working, and caption margins working. (They have problems right now.)
OS: Windows 2000 → All
Hardware: PC → All
Comment 30•24 years ago
|
||
*** Bug 91026 has been marked as a duplicate of this bug. ***
Comment 31•24 years ago
|
||
I dont think that the inheritance way will work, especially if one considers
caption-side left and right. So my feeling is that we should dependent on
caption-side lookup the margins from the table. Because this will use table
margins, caption-side and caption-margins nsOuterTableFrame.cpp may be a good
point to deal with all of it.
Comment 32•23 years ago
|
||
Chris, I give this bug back to you. I had patches even with a sr, that would at
least ease the pain. This bug requires knowledge of the style system. I dont
have it and I did not got it. I asked several style people for help and did not
got the help. Probably it is more difficult to get style people to surrender
some information, than to get the Taliban to surrender bin Laden. (If you are on
doubt about this look for bug 915 which would be fixed for ages if there would
be some piece of documentation for the style system)
The fix here would be the following: the style system should attach the
auto-width to the outer table frame, then it would take part in the normal block
reflow.
The same issue is with the numerous abs pos bugs for tables, the position
parameters should go to the outertable frame and not the inner one.
I am dissappointed
Assignee: bernd.mielke → karnaze
The problem has nothing to do with information about how the style system works.
The problem with this bug (and even more so with bug 915) is that nobody has
described the theory explaining how these changes should coexist with CSS2,
since they are fundamentally incompatible with CSS. It has nothing at all to do
with implementation.
cc:ing Bernd again so he can read my previous comment.
(Oh, and regarding the abs. pos. bugs for tables, the issue with tables having
two frames is an issue to be handled in frame construction and table code, not
style system code.)
Comment 36•23 years ago
|
||
David, your argumentation convinces me to take my hands of this class of bugs,
the only thing that still bothers me, is that all browsers I know handle this
correctly
Assignee | ||
Comment 37•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Attachment #35417 -
Attachment is obsolete: true
Assignee | ||
Updated•23 years ago
|
Attachment #36312 -
Attachment is obsolete: true
Assignee | ||
Updated•23 years ago
|
Comment 38•23 years ago
|
||
Comment on attachment 61271 [details] [diff] [review]
patch to allow caption to inherit margin-left, margin-right, align=center from table
Please change the selector:
+table[align="center"] caption
to:
+table[align="center"] > caption
because child selectors are more efficient than decendant selectors.
sr=attinasi
Attachment #61271 -
Flags: superreview+
Assignee | ||
Comment 39•23 years ago
|
||
Comment 40•23 years ago
|
||
Comment on attachment 61275 [details] [diff] [review]
revised patch
r= alexsavulov
Attachment #61275 -
Flags: review+
Assignee | ||
Comment 41•23 years ago
|
||
The patch is in.
Amar, can you please file new bugs for any remaining test cases that are not
fixed by this, keeping in mind bug 114734 (which I just opened). The original
problem is now fixed.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•