Index: Source/core/html/HTMLTableRowsCollection.cpp |
diff --git a/Source/core/html/HTMLTableRowsCollection.cpp b/Source/core/html/HTMLTableRowsCollection.cpp |
index e8f31e8a5fc7f895867a45941e8ce716d0a2f269..6a14bddb66fad310c7a003cdeb4a52b0b4c8d510 100644 |
--- a/Source/core/html/HTMLTableRowsCollection.cpp |
+++ b/Source/core/html/HTMLTableRowsCollection.cpp |
@@ -100,11 +100,9 @@ HTMLTableRowElement* HTMLTableRowsCollection::rowAfter(HTMLTableElement& table, |
HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement& table) |
{ |
- for (HTMLElement* child = Traversal<HTMLElement>::lastChild(table); child; child = Traversal<HTMLElement>::previousSibling(*child)) { |
- if (child->hasTagName(tfootTag)) { |
- if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastChild(*child)) |
+ for (HTMLElement* tfoot = Traversal<HTMLElement>::lastChild(table, HasHTMLTagName(tfootTag)); tfoot; tfoot = Traversal<HTMLElement>::previousSibling(*tfoot, HasHTMLTagName(tfootTag))) { |
+ if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastChild(*tfoot)) |
return lastRow; |
- } |
} |
for (HTMLElement* child = Traversal<HTMLElement>::lastChild(table); child; child = Traversal<HTMLElement>::previousSibling(*child)) { |
@@ -116,11 +114,9 @@ HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement& table) |
} |
} |
- for (HTMLElement* child = Traversal<HTMLElement>::lastChild(table); child; child = Traversal<HTMLElement>::previousSibling(*child)) { |
- if (child->hasTagName(theadTag)) { |
- if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastChild(*child)) |
- return lastRow; |
- } |
+ for (HTMLElement* thead = Traversal<HTMLElement>::lastChild(table, HasHTMLTagName(theadTag)); thead; thead = Traversal<HTMLElement>::previousSibling(*thead, HasHTMLTagName(theadTag))) { |
+ if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastChild(*thead)) |
+ return lastRow; |
} |
return 0; |