OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserv
ed. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserv
ed. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return -1; | 59 return -1; |
60 | 60 |
61 // To match Firefox, the row indices work like this: | 61 // To match Firefox, the row indices work like this: |
62 // Rows from the first <thead> are numbered before all <tbody> rows. | 62 // Rows from the first <thead> are numbered before all <tbody> rows. |
63 // Rows from the first <tfoot> are numbered after all <tbody> rows. | 63 // Rows from the first <tfoot> are numbered after all <tbody> rows. |
64 // Rows from other <thead> and <tfoot> elements don't get row indices at a
ll. | 64 // Rows from other <thead> and <tfoot> elements don't get row indices at a
ll. |
65 | 65 |
66 int rIndex = 0; | 66 int rIndex = 0; |
67 | 67 |
68 if (HTMLTableSectionElement* head = toHTMLTableElement(table)->tHead()) { | 68 if (HTMLTableSectionElement* head = toHTMLTableElement(table)->tHead()) { |
69 for (Element* row = ElementTraversal::firstWithin(*head); row; row = Ele
mentTraversal::nextSibling(*row)) { | 69 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChi
ld(*head); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) { |
70 if (row == this) | 70 if (row == this) |
71 return rIndex; | 71 return rIndex; |
72 if (row->hasTagName(trTag)) | 72 ++rIndex; |
73 ++rIndex; | |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 for (Element* child = ElementTraversal::firstWithin(*table); child; child =
ElementTraversal::nextSibling(*child)) { | 76 for (Element* child = ElementTraversal::firstWithin(*table); child; child =
ElementTraversal::nextSibling(*child)) { |
78 if (child->hasTagName(tbodyTag)) { | 77 if (child->hasTagName(tbodyTag)) { |
79 HTMLTableSectionElement* section = toHTMLTableSectionElement(child); | 78 HTMLTableSectionElement* section = toHTMLTableSectionElement(child); |
80 for (Element* row = ElementTraversal::firstWithin(*section); row; ro
w = ElementTraversal::nextSibling(*row)) { | 79 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firs
tChild(*section); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row))
{ |
81 if (row == this) | 80 if (row == this) |
82 return rIndex; | 81 return rIndex; |
83 if (row->hasTagName(trTag)) | 82 ++rIndex; |
84 ++rIndex; | |
85 } | 83 } |
86 } | 84 } |
87 } | 85 } |
88 | 86 |
89 if (HTMLTableSectionElement* foot = toHTMLTableElement(table)->tFoot()) { | 87 if (HTMLTableSectionElement* foot = toHTMLTableElement(table)->tFoot()) { |
90 for (Element* row = ElementTraversal::firstWithin(*foot); row; row = Ele
mentTraversal::nextSibling(*row)) { | 88 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChi
ld(*foot); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) { |
91 if (row == this) | 89 if (row == this) |
92 return rIndex; | 90 return rIndex; |
93 if (row->hasTagName(trTag)) | 91 ++rIndex; |
94 ++rIndex; | |
95 } | 92 } |
96 } | 93 } |
97 | 94 |
98 // We get here for rows that are in <thead> or <tfoot> sections other than t
he main header and footer. | 95 // We get here for rows that are in <thead> or <tfoot> sections other than t
he main header and footer. |
99 return -1; | 96 return -1; |
100 } | 97 } |
101 | 98 |
102 int HTMLTableRowElement::sectionRowIndex() const | 99 int HTMLTableRowElement::sectionRowIndex() const |
103 { | 100 { |
104 int rIndex = 0; | 101 int rIndex = 0; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 exceptionState.throwDOMException(IndexSizeError, "The value provided ("
+ String::number(index) + ") is outside the range [0, " + String::number(numCell
s) + ")."); | 146 exceptionState.throwDOMException(IndexSizeError, "The value provided ("
+ String::number(index) + ") is outside the range [0, " + String::number(numCell
s) + ")."); |
150 } | 147 } |
151 } | 148 } |
152 | 149 |
153 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells() | 150 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells() |
154 { | 151 { |
155 return ensureCachedHTMLCollection(TRCells); | 152 return ensureCachedHTMLCollection(TRCells); |
156 } | 153 } |
157 | 154 |
158 } | 155 } |
OLD | NEW |