Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7eb9a7614adf95c3595df8a9e41987148b42ad88
https://github.com/WebKit/WebKit/commit/7eb9a7614adf95c3595df8a9e41987148b42ad88
Author: Richard Robinson <[email protected]>
Date: 2026-02-12 (Thu, 12 Feb 2026)
Changed paths:
M Source/WebCore/editing/CompositeEditCommand.cpp
M Source/WebCore/editing/CompositeEditCommand.h
M Source/WebCore/editing/InsertTextCommand.cpp
M Source/WebCore/editing/TextListParser.cpp
M Source/WebCore/editing/TextListParser.h
M Source/WebCore/editing/TypingCommand.cpp
M Source/WebCore/html/HTMLAttributeNames.in
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartLists.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartListsSupport.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartListsSupport.swift
M Tools/TestWebKitAPI/WebPage+Extras.swift
Log Message:
-----------
[Smart Lists] Backspace on first bullet should remove list formatting and
keep - or •
https://bugs.webkit.org/show_bug.cgi?id=307309
rdar://168767896
Reviewed by Tim Horton.
Currently, when performing a backspace within an empty list item, the list
formatting goes away. This is consistent
with system behavior. However, this is undesirable when the list is a Smart
List, since then there is no way to
preserve the plain text list markers like "*" for example.
Tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartLists.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartListsSupport.swift
Tools/TestWebKitAPI/WebPage+Extras.swift
* Source/WebCore/editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphs):
* Source/WebCore/editing/CompositeEditCommand.h:
- Add a function to determine if the enclosing list has a smart list marker
attribute to determine if
the original plain text marker needs to be re-made when needed.
- Modify `breakOutOfEmptyListItem` to re-make the plain text list if one
exists, predicated on the
`reconstitutePlainTextListIfNeeded` parameter. This parameter is needed since
the desired behavior
is for the plain text list to be re-made only on backspace, and not in other
scenerios where `breakOutOfEmptyListItem`
is called, such as when a new paragraph is created.
* Source/WebCore/editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::applySmartListsIfNeeded):
* Source/WebCore/editing/TextListParser.cpp:
(WebCore::nodeAttributesForSmartList):
* Source/WebCore/editing/TextListParser.h:
Store the plain text marker used to make the Smart List in an HTML attribute.
* Source/WebCore/editing/TypingCommand.cpp:
(WebCore::TypingCommand::deleteKeyPressed):
When backspacing inside an empty list item, in addition to breaking out of the
list, also re-make the original plain text
list marker if needed.
* Source/WebCore/html/HTMLAttributeNames.in:
Add a new custom HTML attribute to preserve the plain text symbol used to
create the Smart List.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartLists.mm:
((SmartLists, BackspaceOnEmptyListElementShouldKeepPlainTextMarkers)):
((SmartLists, BackspaceOnEmptyNonFirstListElementShouldKeepPlainTextMarkers)):
((SmartLists, NewlineOnEmptyListElementShouldRemovePlainTextMarkers)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartListsSupport.swift:
(SmartListsSupport.processConfiguration(_:)):
* Tools/TestWebKitAPI/WebPage+Extras.swift:
(executeEditCommand(_:with:)):
(WebPage.waitForNextPresentationUpdate): Deleted.
(WebPage.setWebFeature(_:enabled:)): Deleted.
Tests and test infrastructure support.
Canonical link: https://commits.webkit.org/307373@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications