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

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

Issue 2406423004: Change deleteCell behavior when there are no cells (Closed)
Patch Set: Created 4 years, 2 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 | « third_party/WebKit/LayoutTests/imported/wpt/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLTableRowElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTableRowElement.cpp b/third_party/WebKit/Source/core/html/HTMLTableRowElement.cpp
index 189ed69fcb9275e61213562f6403c7a4c839e53d..28a99e7876580e3e60fc89ee0f05c83b6b5398ab 100644
--- a/third_party/WebKit/Source/core/html/HTMLTableRowElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTableRowElement.cpp
@@ -110,8 +110,11 @@ void HTMLTableRowElement::deleteCell(int index,
ExceptionState& exceptionState) {
HTMLCollection* children = cells();
int numCells = children ? children->length() : 0;
- if (index == -1)
+ if (index == -1) {
+ if (numCells == 0)
+ return;
index = numCells - 1;
+ }
if (index >= 0 && index < numCells) {
Element* cell = children->item(index);
HTMLElement::removeChild(cell, exceptionState);
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/wpt/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698