[webkit-changes] [WebKit/WebKit] 531d36: Change ReplaceSelectionCommand::moveNodeOutOfAnces...

Ahmad Saleem noreply at github.com
Mon Nov 14 19:51:25 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 531d3679e268acaf10750ee50bdce95007891bdb
      https://github.com/WebKit/WebKit/commit/531d3679e268acaf10750ee50bdce95007891bdb
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2022-11-14 (Mon, 14 Nov 2022)

  Changed paths:
    A LayoutTests/editing/inserting/replace-in-heading-001-expected.txt
    A LayoutTests/editing/inserting/replace-in-heading-001.html
    A LayoutTests/editing/inserting/replace-in-paragraph-001-expected.txt
    A LayoutTests/editing/inserting/replace-in-paragraph-001.html
    M Source/WebCore/editing/ReplaceSelectionCommand.cpp

  Log Message:
  -----------
  Change ReplaceSelectionCommand::moveNodeOutOfAncestor() to avoid hitting assertion while trying replace selection

Change ReplaceSelectionCommand::moveNodeOutOfAncestor() to avoid hitting assertion while trying replace selection
https://bugs.webkit.org/show_bug.cgi?id=247918

Reviewed by Ryosuke Niwa.

Merge - https://src.chromium.org/viewvc/blink?revision=153031&view=revision

Before this patch, replacing selection in heading/paragraph with heading/paragraph gets assertion at InsertNodeBeforeCommand constructor, or crash when assertion disabled. It tries to move replaced heading/paragraph out of ancestor, ReplaceSelectionCommand::moveNodeOutOfAncestor().

This patch changes ReplaceSelectionCommand::moveNodeOutOfAncestor() to avoid the assertion.

* Source/WebCore/editing/ReplaceSelectionCommand.cpp:
(ReplaceSelectionCommand::moveNodeOutOfAncestor): Add logic to avoid crash
* LayoutTests/editing/inserting/replace-in-paragraph-001.html: Added Test Case
* LayoutTests/editing/inserting/replace-in-paragraph-001-expected.txt: Added Test Case Expectations
* LayoutTests/editing/inserting/replace-in-heading-001.html: Added Test Case
* LayoutTests/editing/inserting/replace-in-heading-001-expected.txt: Added Test Case Expectations

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




More information about the webkit-changes mailing list