| 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 return Traversal<HTMLTableRowElement>::firstWithin(current); | 58 for (Element* child = ElementTraversal::firstWithin(current); child; child =
ElementTraversal::nextSibling(*child)) { |
| 59 if (isHTMLTableRowElement(child)) |
| 60 return toHTMLTableRowElement(child); |
| 61 } |
| 62 return 0; |
| 59 } | 63 } |
| 60 | 64 |
| 61 HTMLTableRowElement* HTMLTableRowsCollection::rowAfter(HTMLTableElement& table,
HTMLTableRowElement* previous) | 65 HTMLTableRowElement* HTMLTableRowsCollection::rowAfter(HTMLTableElement& table,
HTMLTableRowElement* previous) |
| 62 { | 66 { |
| 63 Element* child = 0; | 67 Element* child = 0; |
| 64 | 68 |
| 65 // Start by looking for the next row in this section. | 69 // Start by looking for the next row in this section. |
| 66 // Continue only if there is none. | 70 // Continue only if there is none. |
| 67 if (previous && previous->parentNode() != table) { | 71 if (previous && previous->parentNode() != table) { |
| 68 if (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::nextSibli
ng(*previous)) | 72 for (child = ElementTraversal::nextSibling(*previous); child; child = El
ementTraversal::nextSibling(*child)) { |
| 69 return row; | 73 if (isHTMLTableRowElement(child)) |
| 74 return toHTMLTableRowElement(child); |
| 75 } |
| 70 } | 76 } |
| 71 | 77 |
| 72 // If still looking at head sections, find the first row in the next head se
ction. | 78 // If still looking at head sections, find the first row in the next head se
ction. |
| 73 if (!previous) | 79 if (!previous) |
| 74 child = ElementTraversal::firstWithin(table); | 80 child = ElementTraversal::firstWithin(table); |
| 75 else if (isInHead(previous)) | 81 else if (isInHead(previous)) |
| 76 child = ElementTraversal::nextSibling(*previous->parentNode()); | 82 child = ElementTraversal::nextSibling(*previous->parentNode()); |
| 77 for (; child; child = ElementTraversal::nextSibling(*child)) { | 83 for (; child; child = ElementTraversal::nextSibling(*child)) { |
| 78 if (child->hasTagName(theadTag)) { | 84 if (child->hasTagName(theadTag)) { |
| 79 if (HTMLTableRowElement* row = findTableRowElementInChildren(*child)
) | 85 if (HTMLTableRowElement* row = findTableRowElementInChildren(*child)
) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 { | 165 { |
| 160 return adoptRef(new HTMLTableRowsCollection(table)); | 166 return adoptRef(new HTMLTableRowsCollection(table)); |
| 161 } | 167 } |
| 162 | 168 |
| 163 Element* HTMLTableRowsCollection::virtualItemAfter(Element* previous) const | 169 Element* HTMLTableRowsCollection::virtualItemAfter(Element* previous) const |
| 164 { | 170 { |
| 165 return rowAfter(toHTMLTableElement(ownerNode()), toHTMLTableRowElement(previ
ous)); | 171 return rowAfter(toHTMLTableElement(ownerNode()), toHTMLTableRowElement(previ
ous)); |
| 166 } | 172 } |
| 167 | 173 |
| 168 } | 174 } |
| OLD | NEW |