Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify TypingCommand::makeEditableRootEmpty() by removing firstElem…
…entChild 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
- Loading branch information