⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 202952 in webkit


Ignore:
Timestamp:
Jul 7, 2016, 6:56:18 PM (10 years ago)
Author:
Chris Dumez
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:

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):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r202951 r202952  
     12016-07-07  Chris Dumez  <cdumez@apple.com>
     2
     3        tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there are no rows / cells
     4        https://bugs.webkit.org/show_bug.cgi?id=159527
     5        <rdar://problem/27232261>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Rebaseline now that more checks are passing.
     10
     11        * web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt:
     12        * web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt:
     13
    1142016-07-07  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tbody-element/deleteRow-expected.txt

    r194580 r202952  
    44PASS HTMLTableSectionElement deleteRow(rows.length)
    55PASS HTMLTableSectionElement deleteRow(-2)
    6 FAIL HTMLTableSectionElement deleteRow(-1) with no rows IndexSizeError: DOM Exception 1
     6PASS HTMLTableSectionElement deleteRow(-1) with no rows
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell-expected.txt

    r194580 r202952  
    44PASS HTMLTableRowElement deleteCell(-2)
    55PASS HTMLTableRowElement deleteCell(cells.length)
    6 FAIL HTMLTableRowElement deleteCell(-1) with no cells IndexSizeError: DOM Exception 1
     6PASS HTMLTableRowElement deleteCell(-1) with no cells
    77
  • trunk/Source/WebCore/ChangeLog

    r202951 r202952  
     12016-07-07  Chris Dumez  <cdumez@apple.com>
     2
     3        tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there are no rows / cells
     4        https://bugs.webkit.org/show_bug.cgi?id=159527
     5        <rdar://problem/27232261>
     6
     7        Reviewed by Alex Christensen.
     8
     9        tdody.deleteRow(-1) and tr.deleteCell(-1) should not throw when there
     10        are no rows / cells:
     11        - https://html.spec.whatwg.org/multipage/tables.html#dom-tbody-deleterow
     12        - https://html.spec.whatwg.org/multipage/tables.html#dom-tr-deletecell
     13
     14        Firefox and Chrome do not throw but WebKit was throwing.
     15
     16        No new tests, rebaselined existing tests.
     17
     18        * html/HTMLTableRowElement.cpp:
     19        (WebCore::HTMLTableRowElement::deleteCell):
     20        * html/HTMLTableSectionElement.cpp:
     21        (WebCore::HTMLTableSectionElement::deleteRow):
     22
    1232016-07-07  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebCore/html/HTMLTableRowElement.cpp

    r202937 r202952  
    131131    Ref<HTMLCollection> children = cells();
    132132    int numCells = children->length();
    133     if (index == -1)
    134         index = numCells-1;
     133    if (index == -1) {
     134        if (!numCells)
     135            return;
     136
     137        index = numCells - 1;
     138    }
    135139    if (index >= 0 && index < numCells)
    136140        HTMLElement::removeChild(*children->item(index), ec);
  • trunk/Source/WebCore/html/HTMLTableSectionElement.cpp

    r197779 r202952  
    8686    Ref<HTMLCollection> children = rows();
    8787    int numRows = children->length();
    88     if (index == -1)
     88    if (index == -1) {
     89        if (!numRows)
     90            return;
     91
    8992        index = numRows - 1;
     93    }
    9094    if (index >= 0 && index < numRows)
    9195        HTMLElement::removeChild(*children->item(index), ec);
Note: See TracChangeset for help on using the changeset viewer.