Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 105fc9b52b9ae74666096a6289b9717abde65177
https://github.com/WebKit/WebKit/commit/105fc9b52b9ae74666096a6289b9717abde65177
Author: Chris Dumez <[email protected]>
Date: 2026-06-28 (Sun, 28 Jun 2026)
Changed paths:
A LayoutTests/editing/deleting/delete-empty-end-table-row-expected.txt
A LayoutTests/editing/deleting/delete-empty-end-table-row.html
M Source/WebCore/editing/DeleteSelectionCommand.cpp
Log Message:
-----------
DeleteSelectionCommand leaves an empty trailing table row behind after
deletion
https://bugs.webkit.org/show_bug.cgi?id=318002
Reviewed by Anne van Kesteren and Darin Adler.
DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows() has a final
block whose job is to remove the *end* table row itself when the deleted
selection left it empty (and the caret is not landing inside it). The block was
guarded by `endTableRow != m_startTableRow`, but a refactoring typo initialized
the local `endTableRow` from `m_startTableRow` instead of `m_endTableRow`. That
made the guard always false, so the block became dead code and an empty trailing
row was never removed.
This regressed in 295798@main ("Reduce incorrect usage of protectedX() in dom
and editing"), which mechanically rewrote:
```
auto endTableRow = protectedEndTableRow(); // returned m_endTableRow
```
into:
```
RefPtr endTableRow = m_startTableRow; // wrong member
```
silently substituting the start row for the end row.
Fix the local to be initialized from m_endTableRow, restoring the intended
behavior. Note this is only observable when the end row is already empty and
falls inside the selection (e.g. a trailing empty row), because table-spanning
deletes preserve the content of the boundary rows.
Test: editing/deleting/delete-empty-end-table-row.html
* LayoutTests/editing/deleting/delete-empty-end-table-row-expected.txt: Added.
* LayoutTests/editing/deleting/delete-empty-end-table-row.html: Added.
* Source/WebCore/editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows):
Canonical link: https://commits.webkit.org/315990@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications