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

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

Issue 262163008: HTMLTableSectionElement.insertRow(0) / HTMLTableRowElement.insertCell(0) do not behave correctly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix descriptions Created 6 years, 7 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/HTMLTableRowElement.cpp
diff --git a/Source/core/html/HTMLTableRowElement.cpp b/Source/core/html/HTMLTableRowElement.cpp
index d6fd9cefc8fe7f4f2adeddf0c77c22868c22e1aa..bbb0e2dcef1ebc1652dab1f354a10c2559e13dac 100644
--- a/Source/core/html/HTMLTableRowElement.cpp
+++ b/Source/core/html/HTMLTableRowElement.cpp
@@ -129,14 +129,10 @@ PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionStat
}
RefPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create(tdTag, document());
- if (index < 0 || index >= numCells)
+ if (numCells == index || index == -1) {
appendChild(cell, exceptionState);
- else {
- Node* n;
- if (index < 1)
- n = firstChild();
- else
- n = children->item(index);
+ } else {
+ Element* n = children->item(index);
tkent 2014/05/07 01:18:23 What happens if index == -2?
Inactive 2014/05/07 01:33:20 This cannot happen, we already check for this abov
insertBefore(cell, n, exceptionState);
}
return cell.release();

Powered by Google App Engine
This is Rietveld 408576698