Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b78015aa9a05000616a8c95c5bb7b88f3bf99763
      
https://github.com/WebKit/WebKit/commit/b78015aa9a05000616a8c95c5bb7b88f3bf99763
  Author: Ahmad Saleem <[email protected]>
  Date:   2022-11-22 (Tue, 22 Nov 2022)

  Changed paths:
    M Source/WebCore/editing/TypingCommand.cpp

  Log Message:
  -----------
  Simplify TypingCommand::makeEditableRootEmpty() by removing firstElementChild

Simplify TypingCommand::makeEditableRootEmpty() by removing firstElementChild
https://bugs.webkit.org/show_bug.cgi?id=248191

Reviewed by Ryosuke Niwa.

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

Simplify TypingCommand::makeEditableRootEmpty() a bit by avoiding an unnecessary
call to firstElementChild.

In this if scope, we already know that the root node has a single child.
Therefore, there is no reason to do a tree traversal, we can directly call
ContainerNode::firstChild().

firstElementChild never explores descendants and only looks
for the first direct child that is an Element. In this case, we don't need to
check if the child is an Element as we can pass a Node to hasTagName(brTag).

* Source/WebCore/editing/TypingCommand.cpp:
(TypingCommand::makeEditableRootEmpty): Simplify by removing references to 
firstElementChild

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to