Summary: | <td> cellIndex using DOM has incorrect value | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Andrew <Andrew_Garner> |
Component: | khtml ecma | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | Poposed patch |
Description
Andrew
2003-05-22 13:03:30 UTC
Yes, cellIndex() is not implemented. Better return this to the pool. I don't have time to finish it right now. JFR: http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-84150186 cellIndex of type long, readonly The index of this cell in the row, starting from 0. This index is in document tree order and not display order. Created attachment 7690 [details]
Poposed patch
Hi,
The attached patch works for this testcase, but maybe it needs
more testing?
Cheers,
Rob.
Applied the patch. Even if it weren't quite right it's better than nothing. SVN commit 426346 by orlovich: justing in #khtml was looking at the cellIndex commit, and asked: could there be other tags then TD in a TR? The answer is yes, so using nodeIndex for cellIndex isn't quite right. This testcase shows the difference (and the baseline is right). Proper fix upcoming. CCBUG:58799 A baseline/unsorted/58799.html-dom AM baseline/unsorted/58799.html-dump.png A baseline/unsorted/58799.html-render A tests/unsorted/58799.html ** trunk/tests/khtmltests/regression/baseline/unsorted/58799.html-dump.png #property changes Name: svn:mime-type + application/octet-stream SVN commit 426347 by orlovich: Make cellIndex not count tags != TD, TH when counting its index. Code essentially copies from the sectionRowIndex code from TRs. CCBUG:58799 M +11 -1 html_tableimpl.cpp --- trunk/KDE/kdelibs/khtml/html/html_tableimpl.cpp #426346:426347 @@ -791,7 +791,17 @@ long HTMLTableCellElementImpl::cellIndex() const { - return nodeIndex(); + int cIndex = 0; + const NodeImpl *n = this; + do { + n = n->previousSibling(); + if (n && (n->isElementNode() && n->id() == ID_TD || + n->isElementNode() && n->id() == ID_TH)) + cIndex++; + } + while (n); + + return cIndex; } void HTMLTableCellElementImpl::parseAttribute(AttributeImpl *attr) |