Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Unified Diff: Source/core/html/HTMLTableRowsCollection.cpp

Issue 471173003: Introduce HasHTMLTagName functor and use it with ElementTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLTableRowElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/html/HTMLTableRowElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698