Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207639 => 207640)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-10-20 21:00:54 UTC (rev 207640)
@@ -1,3 +1,20 @@
+2016-10-20 Chris Dumez <cdu...@apple.com>
+
+ Make table.deleteRow(-1) a no-op when there are no rows
+ https://bugs.webkit.org/show_bug.cgi?id=163746
+
+ Reviewed by Alex Christensen.
+
+ Import test coverage from:
+ - https://github.com/w3c/web-platform-tests/pull/4001
+
+ * web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row-expected.txt:
+ * web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row.html:
+ * web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt:
+ * web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow.html:
+ * web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt:
+ * web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell.html:
+
2016-10-19 Dean Jackson <d...@apple.com>
Import W3C CSS Shapes tests
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row-expected.txt (207639 => 207640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row-expected.txt 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row-expected.txt 2016-10-20 21:00:54 UTC (rev 207640)
@@ -1,7 +1,8 @@
-First column Second column
PASS deleteRow function invalid argument
PASS deleteRow function invalid argument bis
PASS check normal deleteRow
PASS check normal deleteRow bis
+PASS deleteRow(-1) with no rows
+PASS deleteRow(0) with no rows
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row.html (207639 => 207640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row.html 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-table-element/remove-row.html 2016-10-20 21:00:54 UTC (rev 207640)
@@ -42,9 +42,23 @@
assert_equals(old_length, el.rows.length);
}, "check normal deleteRow");
test(function() {
- while (el.rows.length > 1) {
+ assert_equals(el.rows.length, 3);
+ do {
+ var old_length = el.rows.length;
el.deleteRow(-1);
- }
- assert_equals(1, el.rows.length);
+ assert_equals(el.rows.length, old_length - 1);
+ } while (el.rows.length);
}, "check normal deleteRow bis");
+
+test(function() {
+ assert_equals(el.rows.length, 0);
+ el.deleteRow(-1);
+}, 'deleteRow(-1) with no rows');
+
+test(function() {
+ assert_equals(el.rows.length, 0);
+ assert_throws("IndexSizeError", function() {
+ el.deleteRow(0);
+ });
+}, 'deleteRow(0) with no rows');
</script>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt (207639 => 207640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt 2016-10-20 21:00:54 UTC (rev 207640)
@@ -4,4 +4,5 @@
PASS HTMLTableSectionElement deleteRow(rows.length)
PASS HTMLTableSectionElement deleteRow(-2)
PASS HTMLTableSectionElement deleteRow(-1) with no rows
+PASS HTMLTableSectionElement deleteRow(0) with no rows
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow.html (207639 => 207640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow.html 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow.html 2016-10-20 21:00:54 UTC (rev 207640)
@@ -51,4 +51,11 @@
assert_equals(tbody.rows.length, 0);
}, "HTMLTableSectionElement deleteRow(-1) with no rows");
+test(function () {
+ assert_equals(tbody.rows.length, 0);
+ assert_throws("IndexSizeError", function () {
+ tbody.deleteRow(0);
+ });
+}, "HTMLTableSectionElement deleteRow(0) with no rows");
+
</script>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt (207639 => 207640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt 2016-10-20 21:00:54 UTC (rev 207640)
@@ -4,4 +4,5 @@
PASS HTMLTableRowElement deleteCell(-2)
PASS HTMLTableRowElement deleteCell(cells.length)
PASS HTMLTableRowElement deleteCell(-1) with no cells
+PASS HTMLTableRowElement deleteCell(0) with no cells
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell.html (207639 => 207640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell.html 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell.html 2016-10-20 21:00:54 UTC (rev 207640)
@@ -51,4 +51,11 @@
assert_equals(tr.cells.length, 0);
}, "HTMLTableRowElement deleteCell(-1) with no cells");
+test(function () {
+ assert_equals(tr.cells.length, 0);
+ assert_throws("IndexSizeError", function () {
+ tr.deleteCell(0);
+ });
+}, "HTMLTableRowElement deleteCell(0) with no cells");
+
</script>
Modified: trunk/Source/WebCore/ChangeLog (207639 => 207640)
--- trunk/Source/WebCore/ChangeLog 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/Source/WebCore/ChangeLog 2016-10-20 21:00:54 UTC (rev 207640)
@@ -1,3 +1,23 @@
+2016-10-20 Chris Dumez <cdu...@apple.com>
+
+ Make table.deleteRow(-1) a no-op when there are no rows
+ https://bugs.webkit.org/show_bug.cgi?id=163746
+
+ Reviewed by Alex Christensen.
+
+ Make table.deleteRow(-1) a no-op when there are no rows, instead of throwing:
+ - https://github.com/whatwg/html/pull/1924
+
+ This is more consistent with the behavior of tbody.deleteRow(-1) and
+ tr.deleteCell(-1). This is also consistent with Gecko. Blink is doing the
+ same change via:
+ - https://codereview.chromium.org/2427963004/
+
+ No new tests, updated existing tests.
+
+ * html/HTMLTableElement.cpp:
+ (WebCore::HTMLTableElement::deleteRow):
+
2016-10-20 Dave Hyatt <hy...@apple.com>
[CSS Parser] Make sure to handle prefixed transform-style
Modified: trunk/Source/WebCore/html/HTMLTableElement.cpp (207639 => 207640)
--- trunk/Source/WebCore/html/HTMLTableElement.cpp 2016-10-20 20:28:17 UTC (rev 207639)
+++ trunk/Source/WebCore/html/HTMLTableElement.cpp 2016-10-20 21:00:54 UTC (rev 207640)
@@ -250,19 +250,21 @@
void HTMLTableElement::deleteRow(int index, ExceptionCode& ec)
{
HTMLTableRowElement* row = nullptr;
- if (index == -1)
+ if (index == -1) {
row = HTMLTableRowsCollection::lastRow(*this);
- else {
+ if (!row)
+ return;
+ } else {
for (int i = 0; i <= index; ++i) {
row = HTMLTableRowsCollection::rowAfter(*this, row);
if (!row)
break;
}
+ if (!row) {
+ ec = INDEX_SIZE_ERR;
+ return;
+ }
}
- if (!row) {
- ec = INDEX_SIZE_ERR;
- return;
- }
row->remove(ec);
}