| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return row->parentNode() && toElement(row->parentNode())->hasLocalName(tbody
Tag); | 48 return row->parentNode() && toElement(row->parentNode())->hasLocalName(tbody
Tag); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static bool isInFoot(Element* row) | 51 static bool isInFoot(Element* row) |
| 52 { | 52 { |
| 53 return row->parentNode() && toElement(row->parentNode())->hasLocalName(tfoot
Tag); | 53 return row->parentNode() && toElement(row->parentNode())->hasLocalName(tfoot
Tag); |
| 54 } | 54 } |
| 55 | 55 |
| 56 static inline HTMLTableRowElement* findTableRowElementInChildren(Element& curren
t) | 56 static inline HTMLTableRowElement* findTableRowElementInChildren(Element& curren
t) |
| 57 { | 57 { |
| 58 for (Element* child = ElementTraversal::firstWithin(current); child; child =
ElementTraversal::nextSibling(*child)) { | 58 return Traversal<HTMLTableRowElement>::firstWithin(current); |
| 59 if (isHTMLTableRowElement(child)) | |
| 60 return toHTMLTableRowElement(child); | |
| 61 } | |
| 62 return 0; | |
| 63 } | 59 } |
| 64 | 60 |
| 65 HTMLTableRowElement* HTMLTableRowsCollection::rowAfter(HTMLTableElement* table,
HTMLTableRowElement* previous) | 61 HTMLTableRowElement* HTMLTableRowsCollection::rowAfter(HTMLTableElement* table,
HTMLTableRowElement* previous) |
| 66 { | 62 { |
| 67 Element* child = 0; | 63 Element* child = 0; |
| 68 | 64 |
| 69 // Start by looking for the next row in this section. | 65 // Start by looking for the next row in this section. |
| 70 // Continue only if there is none. | 66 // Continue only if there is none. |
| 71 if (previous && previous->parentNode() != table) { | 67 if (previous && previous->parentNode() != table) { |
| 72 for (child = ElementTraversal::nextSibling(*previous); child; child = El
ementTraversal::nextSibling(*child)) { | 68 if (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::nextSibli
ng(*previous)) |
| 73 if (isHTMLTableRowElement(child)) | 69 return row; |
| 74 return toHTMLTableRowElement(child); | |
| 75 } | |
| 76 } | 70 } |
| 77 | 71 |
| 78 // If still looking at head sections, find the first row in the next head se
ction. | 72 // If still looking at head sections, find the first row in the next head se
ction. |
| 79 if (!previous) | 73 if (!previous) |
| 80 child = ElementTraversal::firstWithin(*table); | 74 child = ElementTraversal::firstWithin(*table); |
| 81 else if (isInHead(previous)) | 75 else if (isInHead(previous)) |
| 82 child = ElementTraversal::nextSibling(*previous->parentNode()); | 76 child = ElementTraversal::nextSibling(*previous->parentNode()); |
| 83 for (; child; child = ElementTraversal::nextSibling(*child)) { | 77 for (; child; child = ElementTraversal::nextSibling(*child)) { |
| 84 if (child->hasTagName(theadTag)) { | 78 if (child->hasTagName(theadTag)) { |
| 85 if (HTMLTableRowElement* row = findTableRowElementInChildren(*child)
) | 79 if (HTMLTableRowElement* row = findTableRowElementInChildren(*child)
) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 { | 159 { |
| 166 return adoptRef(new HTMLTableRowsCollection(table)); | 160 return adoptRef(new HTMLTableRowsCollection(table)); |
| 167 } | 161 } |
| 168 | 162 |
| 169 Element* HTMLTableRowsCollection::virtualItemAfter(Element* previous) const | 163 Element* HTMLTableRowsCollection::virtualItemAfter(Element* previous) const |
| 170 { | 164 { |
| 171 return rowAfter(toHTMLTableElement(ownerNode()), toHTMLTableRowElement(previ
ous)); | 165 return rowAfter(toHTMLTableElement(ownerNode()), toHTMLTableRowElement(previ
ous)); |
| 172 } | 166 } |
| 173 | 167 |
| 174 } | 168 } |
| OLD | NEW |