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

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

Issue 195813003: Use new is*Element() helper functions further more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bad assertion Created 6 years, 9 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
Index: Source/core/html/HTMLTableCellElement.cpp
diff --git a/Source/core/html/HTMLTableCellElement.cpp b/Source/core/html/HTMLTableCellElement.cpp
index 833196300d642ccc56aba1d06a0409662caf94d3..9e0b4f1a9a3798edf8c9318286e0568b2de17427 100644
--- a/Source/core/html/HTMLTableCellElement.cpp
+++ b/Source/core/html/HTMLTableCellElement.cpp
@@ -67,14 +67,12 @@ int HTMLTableCellElement::rowSpan() const
int HTMLTableCellElement::cellIndex() const
{
- int index = 0;
- if (!parentElement() || !parentElement()->hasTagName(trTag))
+ if (!isHTMLTableRowElement(parentElement()))
return -1;
- for (const Node * node = previousSibling(); node; node = node->previousSibling()) {
- if (node->hasTagName(tdTag) || node->hasTagName(thTag))
- index++;
- }
+ int index = 0;
+ for (const HTMLTableCellElement* element = Traversal<HTMLTableCellElement>::previousSibling(*this); element; element = Traversal<HTMLTableCellElement>::previousSibling(*element))
+ ++index;
return index;
}

Powered by Google App Engine
This is Rietveld 408576698