[webkit-changes] cvs commit: WebCore/layout-tests/fast/table
cellindex-expected.txt cellindex.html
Justin
justing at opensource.apple.com
Fri Jun 17 14:55:40 PDT 2005
justing 05/06/17 14:55:40
Modified: . ChangeLog
khtml/html html_tableimpl.cpp html_tableimpl.h
Added: layout-tests/fast/table cellindex-expected.txt
cellindex.html
Log:
Bug #:
Revision Changes Path
1.4273 +14 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4272
retrieving revision 1.4273
diff -u -r1.4272 -r1.4273
--- ChangeLog 17 Jun 2005 20:00:06 -0000 1.4272
+++ ChangeLog 17 Jun 2005 21:55:35 -0000 1.4273
@@ -1,3 +1,17 @@
+2005-06-17 Justin Garcia <justin.garcia at apple.com>
+
+ Fix for rdar://3756860, (also listed as) http://bugzilla.opendarwin.org/show_bug.cgi?id=3295
+ The cellIndex property for HTMLTableCellElement was always zero because the method to support it was just a stub. KHTML fix was to simply call nodeIndex(), but this is incorrect because a table row can have as children <script>s and <form>s (and perhaps others).
+
+ Reviewed by hyatt and john
+
+ Test cases added:
+ * layout-tests/fast/table/cellindex.html: Added. Illustrates the fix.
+
+ * khtml/html/html_tableimpl.cpp:
+ (DOM::HTMLTableCellElementImpl::cellIndex): Iterate through siblings only counting <th> and <td> elements
+ * khtml/html/html_tableimpl.h:
+
2005-06-17 Adele Peterson <adele at apple.com>
Reviewed by Maciej.
1.53 +10 -0 WebCore/khtml/html/html_tableimpl.cpp
Index: html_tableimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- html_tableimpl.cpp 11 May 2005 05:49:34 -0000 1.52
+++ html_tableimpl.cpp 17 Jun 2005 21:55:39 -0000 1.53
@@ -1118,6 +1118,16 @@
{
}
+long HTMLTableCellElementImpl::cellIndex() const
+{
+ int index = 0;
+ for (const NodeImpl * node = previousSibling(); node; node = node->previousSibling()) {
+ if (node->id() == ID_TD || node->id() == ID_TH)
+ index++;
+ }
+
+ return index;
+}
bool HTMLTableCellElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
1.21 +1 -1 WebCore/khtml/html/html_tableimpl.h
Index: html_tableimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- html_tableimpl.h 11 May 2005 05:49:34 -0000 1.20
+++ html_tableimpl.h 17 Jun 2005 21:55:39 -0000 1.21
@@ -242,7 +242,7 @@
~HTMLTableCellElementImpl();
// ### FIX these two...
- long cellIndex() const { return 0; }
+ long cellIndex() const;
int col() const { return _col; }
void setCol(int col) { _col = col; }
1.1 WebCore/layout-tests/fast/table/cellindex-expected.txt
Index: cellindex-expected.txt
===================================================================
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderTable {TABLE} at (0,0) size 152x24
RenderTableSection {TBODY} at (0,0) size 0x24
RenderTableRow {TR} at (0,0) size 0x0
RenderTableCell {TH} at (2,2) size 64x20 [r=0 c=0 rs=1 cs=1]
RenderText {TEXT} at (1,1) size 62x18
text run at (1,1) width 62: "Header 1"
RenderText {TEXT} at (0,0) size 0x0
RenderTableCell {TD} at (68,2) size 40x20 [r=0 c=1 rs=1 cs=1]
RenderText {TEXT} at (1,1) size 38x18
text run at (1,1) width 38: "Cell 1"
RenderTableCell {TD} at (110,2) size 40x20 [r=0 c=2 rs=1 cs=1]
RenderText {TEXT} at (1,1) size 38x18
text run at (1,1) width 38: "Cell 2"
RenderBlock (anonymous) at (0,24) size 784x54
RenderText {TEXT} at (0,0) size 92x18
text run at (0,0) width 92: "h1 has index 0"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,18) size 91x18
text run at (0,18) width 91: "c1 has index 1"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,36) size 91x18
text run at (0,36) width 91: "c2 has index 2"
RenderBR {BR} at (0,0) size 0x0
1.1 WebCore/layout-tests/fast/table/cellindex.html
Index: cellindex.html
===================================================================
<table>
<th id="h1">Header 1</td>
<td id="c1">Cell 1</td>
<script></script>
<td id="c2">Cell 2</td>
</table>
<script>
function outputIndex(name) {
node = document.getElementById(name);
document.writeln(name + " has index " + node.cellIndex + "<br>");
}
outputIndex("h1");
outputIndex("c1");
outputIndex("c2");
</script>
More information about the webkit-changes
mailing list