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

Side by Side Diff: Source/core/html/HTMLTableRowElement.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLTableElement.cpp ('k') | Source/core/html/HTMLTableRowsCollection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 int rIndex = 0; 74 int rIndex = 0;
75 75
76 if (HTMLTableSectionElement* head = toHTMLTableElement(table)->tHead()) { 76 if (HTMLTableSectionElement* head = toHTMLTableElement(table)->tHead()) {
77 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChi ld(*head); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) { 77 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChi ld(*head); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) {
78 if (row == this) 78 if (row == this)
79 return rIndex; 79 return rIndex;
80 ++rIndex; 80 ++rIndex;
81 } 81 }
82 } 82 }
83 83
84 for (HTMLElement* child = Traversal<HTMLElement>::firstChild(*table); child; child = Traversal<HTMLElement>::nextSibling(*child)) { 84 for (HTMLElement* tbody = Traversal<HTMLElement>::firstChild(*table, HasHTML TagName(tbodyTag)); tbody; tbody = Traversal<HTMLElement>::nextSibling(*tbody, H asHTMLTagName(tbodyTag))) {
85 if (child->hasTagName(tbodyTag)) { 85 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChi ld(*tbody); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) {
86 HTMLTableSectionElement* section = toHTMLTableSectionElement(child); 86 if (row == this)
87 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firs tChild(*section); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) { 87 return rIndex;
88 if (row == this) 88 ++rIndex;
89 return rIndex;
90 ++rIndex;
91 }
92 } 89 }
93 } 90 }
94 91
95 if (HTMLTableSectionElement* foot = toHTMLTableElement(table)->tFoot()) { 92 if (HTMLTableSectionElement* foot = toHTMLTableElement(table)->tFoot()) {
96 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChi ld(*foot); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) { 93 for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChi ld(*foot); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) {
97 if (row == this) 94 if (row == this)
98 return rIndex; 95 return rIndex;
99 ++rIndex; 96 ++rIndex;
100 } 97 }
101 } 98 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(index) + ") is outside the range [0, " + String::number(numCell s) + ")."); 150 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(index) + ") is outside the range [0, " + String::number(numCell s) + ").");
154 } 151 }
155 } 152 }
156 153
157 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLTableRowElement::cells() 154 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLTableRowElement::cells()
158 { 155 {
159 return ensureCachedCollection<HTMLCollection>(TRCells); 156 return ensureCachedCollection<HTMLCollection>(TRCells);
160 } 157 }
161 158
162 } 159 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTableElement.cpp ('k') | Source/core/html/HTMLTableRowsCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698