Title: [202952] trunk
Revision
202952
Author
[email protected]
Date
2016-07-07 18:56:18 -0700 (Thu, 07 Jul 2016)

Log Message

tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there are no rows / cells
https://bugs.webkit.org/show_bug.cgi?id=159527
<rdar://problem/27232261>

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt:
* web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt:

Source/WebCore:

tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there
are no rows / cells:
- https://html.spec.whatwg.org/multipage/tables.html#dom-tbody-deleterow
- https://html.spec.whatwg.org/multipage/tables.html#dom-tr-deletecell

Firefox and Chrome do not throw but WebKit was throwing.

No new tests, rebaselined existing tests.

* html/HTMLTableRowElement.cpp:
(WebCore::HTMLTableRowElement::deleteCell):
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::deleteRow):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (202951 => 202952)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-08 01:15:48 UTC (rev 202951)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-08 01:56:18 UTC (rev 202952)
@@ -1,5 +1,18 @@
 2016-07-07  Chris Dumez  <[email protected]>
 
+        tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there are no rows / cells
+        https://bugs.webkit.org/show_bug.cgi?id=159527
+        <rdar://problem/27232261>
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt:
+        * web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt:
+
+2016-07-07  Chris Dumez  <[email protected]>
+
         HTMLTitleElement.text should only account for direct children Text nodes
         https://bugs.webkit.org/show_bug.cgi?id=159536
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt (202951 => 202952)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt	2016-07-08 01:15:48 UTC (rev 202951)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt	2016-07-08 01:56:18 UTC (rev 202952)
@@ -3,5 +3,5 @@
 PASS HTMLTableSectionElement deleteRow(-1) 
 PASS HTMLTableSectionElement deleteRow(rows.length) 
 PASS HTMLTableSectionElement deleteRow(-2) 
-FAIL HTMLTableSectionElement deleteRow(-1) with no rows IndexSizeError: DOM Exception 1
+PASS HTMLTableSectionElement deleteRow(-1) with no rows 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt (202951 => 202952)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt	2016-07-08 01:15:48 UTC (rev 202951)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt	2016-07-08 01:56:18 UTC (rev 202952)
@@ -3,5 +3,5 @@
 PASS HTMLTableRowElement deleteCell(-1) 
 PASS HTMLTableRowElement deleteCell(-2) 
 PASS HTMLTableRowElement deleteCell(cells.length) 
-FAIL HTMLTableRowElement deleteCell(-1) with no cells IndexSizeError: DOM Exception 1
+PASS HTMLTableRowElement deleteCell(-1) with no cells 
 

Modified: trunk/Source/WebCore/ChangeLog (202951 => 202952)


--- trunk/Source/WebCore/ChangeLog	2016-07-08 01:15:48 UTC (rev 202951)
+++ trunk/Source/WebCore/ChangeLog	2016-07-08 01:56:18 UTC (rev 202952)
@@ -1,5 +1,27 @@
 2016-07-07  Chris Dumez  <[email protected]>
 
+        tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there are no rows / cells
+        https://bugs.webkit.org/show_bug.cgi?id=159527
+        <rdar://problem/27232261>
+
+        Reviewed by Alex Christensen.
+
+        tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there
+        are no rows / cells:
+        - https://html.spec.whatwg.org/multipage/tables.html#dom-tbody-deleterow
+        - https://html.spec.whatwg.org/multipage/tables.html#dom-tr-deletecell
+
+        Firefox and Chrome do not throw but WebKit was throwing.
+
+        No new tests, rebaselined existing tests.
+
+        * html/HTMLTableRowElement.cpp:
+        (WebCore::HTMLTableRowElement::deleteCell):
+        * html/HTMLTableSectionElement.cpp:
+        (WebCore::HTMLTableSectionElement::deleteRow):
+
+2016-07-07  Chris Dumez  <[email protected]>
+
         HTMLTitleElement.text should only account for direct children Text nodes
         https://bugs.webkit.org/show_bug.cgi?id=159536
 

Modified: trunk/Source/WebCore/html/HTMLTableRowElement.cpp (202951 => 202952)


--- trunk/Source/WebCore/html/HTMLTableRowElement.cpp	2016-07-08 01:15:48 UTC (rev 202951)
+++ trunk/Source/WebCore/html/HTMLTableRowElement.cpp	2016-07-08 01:56:18 UTC (rev 202952)
@@ -130,8 +130,12 @@
 {
     Ref<HTMLCollection> children = cells();
     int numCells = children->length();
-    if (index == -1)
-        index = numCells-1;
+    if (index == -1) {
+        if (!numCells)
+            return;
+
+        index = numCells - 1;
+    }
     if (index >= 0 && index < numCells)
         HTMLElement::removeChild(*children->item(index), ec);
     else

Modified: trunk/Source/WebCore/html/HTMLTableSectionElement.cpp (202951 => 202952)


--- trunk/Source/WebCore/html/HTMLTableSectionElement.cpp	2016-07-08 01:15:48 UTC (rev 202951)
+++ trunk/Source/WebCore/html/HTMLTableSectionElement.cpp	2016-07-08 01:56:18 UTC (rev 202952)
@@ -85,8 +85,12 @@
 {
     Ref<HTMLCollection> children = rows();
     int numRows = children->length();
-    if (index == -1)
+    if (index == -1) {
+        if (!numRows)
+            return;
+
         index = numRows - 1;
+    }
     if (index >= 0 && index < numRows)
         HTMLElement::removeChild(*children->item(index), ec);
     else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to