CompositeEditCommand::prune should remove subtree at once
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 20:51:24 +0000 (20:51 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 20:51:24 +0000 (20:51 +0000)
commitfec43b8aff1c8cb94dbc521ea8f323336688b526
tree77be931843b0bc651b94da7ad8a531ab20bb13b6
parent5950bd4280be41dcc5b5f034456df3f5cab6093b
CompositeEditCommand::prune should remove subtree at once
https://bugs.webkit.org/show_bug.cgi?id=68866

Reviewed by Darin Adler.

Extracted the logic to find the highest ancestor to remove as highestNodeToRemoveInPruning from prune.
This reduces the number of node removals from O(n) to O(1) where n is the depth of the tree.

* editing/CompositeEditCommand.cpp:
(WebCore::hasARenderedDescendant): Takes excludedNode in addition to node. excludedNode is used to ignore
the child node from which we climbed up the tree in highestNodeToRemoveInPruning.
(WebCore::highestNodeToRemoveInPruning): Extracted from prune.
(WebCore::CompositeEditCommand::prune):
(WebCore::CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/CompositeEditCommand.cpp