Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 66bba79d2a8b392443624cfafe23d9b65cd8db92
      
https://github.com/WebKit/WebKit/commit/66bba79d2a8b392443624cfafe23d9b65cd8db92
  Author: Jessica Cheung <[email protected]>
  Date:   2026-03-03 (Tue, 03 Mar 2026)

  Changed paths:
    M Source/WebCore/editing/InsertListCommand.cpp
    M Source/WebCore/editing/InsertListCommand.h
    M Source/WebCore/editing/InsertTextCommand.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartLists.mm

  Log Message:
  -----------
  [Smart Lists] Creating a new dashed or bulleted list underneath a dashed or 
bulleted list converts both lists to the new type
https://bugs.webkit.org/show_bug.cgi?id=308780
rdar://167771342

Reviewed by Richard Robinson, Ryosuke Niwa, and Wenson Hsieh.

Previously, adjacentEnclosingList only checked for
the type of list: unordered or ordered. If the existing
list was the same type as the new list, it would be
appended. Dashed and bulleted list are both unordered,
while numbered lists are ordered.
However, dashed and bulleted have different style types.

Thus, this issue occurred due to not checking for
style types before appending/inserting the new list
to adjacent ones.

So, get the new list style type in
InsertTextCommand::applySmartListsIfNeeded. Then, use
the new list style type, compare it to the adjacent
lists in adjacentEnclosingList, and do not append/insert
if the style types are different.

Add an API test for this change.

* Source/WebCore/editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::InsertListCommand):
(WebCore::adjacentEnclosingList):
(WebCore::InsertListCommand::listifyParagraph):
* Source/WebCore/editing/InsertListCommand.h:
* Source/WebCore/editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::applySmartListsIfNeeded):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SmartLists.mm:
((SmartLists, InsertingDifferentListStylesDoesNotMergeLists)):

Canonical link: https://commits.webkit.org/308575@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to