Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e9768a95677440dc108fcf26db2af5cd82b8b902
https://github.com/WebKit/WebKit/commit/e9768a95677440dc108fcf26db2af5cd82b8b902
Author: Jessica Cheung <[email protected]>
Date: 2026-06-26 (Fri, 26 Jun 2026)
Changed paths:
A
LayoutTests/editing/smart-lists/backspace-after-typing-in-smart-list-does-not-undo-list-expected.txt
A
LayoutTests/editing/smart-lists/backspace-after-typing-in-smart-list-does-not-undo-list.html
A
LayoutTests/editing/smart-lists/backspace-immediately-after-smart-list-creation-undoes-list-expected.txt
A
LayoutTests/editing/smart-lists/backspace-immediately-after-smart-list-creation-undoes-list.html
A
LayoutTests/editing/smart-lists/backspace-immediately-after-third-list-item-does-not-undo-list-expected.txt
A
LayoutTests/editing/smart-lists/backspace-immediately-after-third-list-item-does-not-undo-list.html
M LayoutTests/platform/glib/TestExpectations
M Source/WebCore/editing/InsertTextCommand.cpp
M Source/WebCore/editing/InsertTextCommand.h
M Source/WebCore/editing/TypingCommand.cpp
M Source/WebCore/editing/TypingCommand.h
Log Message:
-----------
[Smart Lists] Backspace after Smart Lists formatting removes entire list line
instead of just formatting
https://bugs.webkit.org/show_bug.cgi?id=317665
rdar://177210669
Reviewed by Wenson Hsieh.
Currently, when backspacing immediately from the second list item of a smart
list,
the selection moves back to the first list item. Instead, the entire list
formatting
should be removed. This should be the case because a user could have accidently
triggered
list formatting and need a way out.
So, if it is currently on the second list item of a newly created smart list,
there is no text
yet and a backspace is hit, then WebKit should remove the list formatting. This
is the window
in which the undo operation via backspace will be valid.
To ensure this, a SmartListUndoData struct is created that stores all the
information needed for the
undo operation. This data is only set during that small window and will be a
nullopt otherwise for all
other operations. In performSmartListUndo, conditions are checked whether the
undo operation is valid here.
If so, divs are created and the text is then put in the divs that are located
in the DOM right where the
list element would be. The list element is then removed. If the user is on any
other list item and backspaces,
the list formatting is not removed because the conditions would not be met.
Add three layout tests that cover these cases:
1. Backspace immediately once at the second list item of a smart list
2. Backspace after typing a character at the second list item of a smart list
3, Backspace immediately once at the third list item of a smart list
*
LayoutTests/editing/smart-lists/backspace-after-typing-in-smart-list-does-not-undo-list-expected.txt:
Added.
*
LayoutTests/editing/smart-lists/backspace-after-typing-in-smart-list-does-not-undo-list.html:
Added.
*
LayoutTests/editing/smart-lists/backspace-immediately-after-smart-list-creation-undoes-list-expected.txt:
Added.
*
LayoutTests/editing/smart-lists/backspace-immediately-after-smart-list-creation-undoes-list.html:
Added.
*
LayoutTests/editing/smart-lists/backspace-immediately-after-third-list-item-does-not-undo-list-expected.txt:
Added.
*
LayoutTests/editing/smart-lists/backspace-immediately-after-third-list-item-does-not-undo-list.html:
Added.
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::applySmartListsIfNeeded):
* Source/WebCore/editing/InsertTextCommand.h:
* Source/WebCore/editing/TypingCommand.cpp:
(WebCore::TypingCommand::willAddTypingToOpenCommand):
(WebCore::TypingCommand::insertTextRunWithoutNewlines):
(WebCore::TypingCommand::deleteKeyPressed):
(WebCore::TypingCommand::performSmartListUndo):
* Source/WebCore/editing/TypingCommand.h:
Canonical link: https://commits.webkit.org/315904@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications