Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4216f6e6461a64bfde017ae0bcf193f7af1bbef0
      
https://github.com/WebKit/WebKit/commit/4216f6e6461a64bfde017ae0bcf193f7af1bbef0
  Author: Jessica Cheung <[email protected]>
  Date:   2026-04-21 (Tue, 21 Apr 2026)

  Changed paths:
    A 
LayoutTests/editing/execCommand/break-out-of-list-resets-start-number-expected.txt
    A LayoutTests/editing/execCommand/break-out-of-list-resets-start-number.html
    A 
LayoutTests/editing/execCommand/outdent-list-resets-start-number-expected.txt
    A LayoutTests/editing/execCommand/outdent-list-resets-start-number.html
    M Source/WebCore/editing/CompositeEditCommand.cpp
    M Source/WebCore/editing/CompositeEditCommand.h
    M Source/WebCore/editing/InsertListCommand.cpp

  Log Message:
  -----------
  Removing/outdent a line from ordered list causes the following list to start 
with an incorrect number
https://bugs.webkit.org/show_bug.cgi?id=312522
rdar://173537449

Reviewed by Aditya Keerthi.

In unlistifyParagraph, there isn't a procedure to set the
starting list number after splitting. So, when it calls
splitElement() to split the list, this calls
Element::cloneElementWithoutChildren which clones all attributes,
including the start attribute.

For example, if the original list started with 11 and the list
is split in the middle, both lists now start with 11. The
expectation is when splitting the list, the second list starts
from 1.

Thus, make a function that splits the list and sets the second starting
list number to be 1 if a start attribute was originally provided. Otherwise,
don't do anything. Now, outdenting, removing list formatting, and entering to
create new lines should all have the following list start with 1.

Additionally, add layout tests for the cases to confirm the correct
starting list numbers. For outdenting and remove list formatting, both
go down the same code path so there is only one test.

* 
LayoutTests/editing/execCommand/break-out-of-list-resets-start-number-expected.txt:
 Added.
* LayoutTests/editing/execCommand/break-out-of-list-resets-start-number.html: 
Added.
* 
LayoutTests/editing/execCommand/outdent-list-resets-start-number-expected.txt: 
Added.
* LayoutTests/editing/execCommand/outdent-list-resets-start-number.html: Added.
* Source/WebCore/editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::splitListElement):
(WebCore::CompositeEditCommand::moveParagraphs):
* Source/WebCore/editing/CompositeEditCommand.h:
* Source/WebCore/editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::unlistifyParagraph):

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



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

Reply via email to