HTMLConverter::_processText is slow because it walks up ancestor elements
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Mar 2014 06:22:48 +0000 (06:22 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Mar 2014 06:22:48 +0000 (06:22 +0000)
commit61ce161e56e3622c4cad7ebb9458f347d4838538
tree38ec835ca7b97481cb1294efa250a50fb1a36eff
parentcb9db3c3e0b5aa3bce77ea9e4b46da8ca77130d7
HTMLConverter::_processText is slow because it walks up ancestor elements
https://bugs.webkit.org/show_bug.cgi?id=130820

Reviewed by Sam Weinig.

Avoid walking up the tree from each text node by caching the aggregated attributed strings for each element.
Also compute the attributed strings top-down to avoid calling mutableCopy in every iteration.

This reduces the runtime of Interactive/CopyAll.html from 15s to 13s (15%).

* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_attributesForElement):
(HTMLConverter::attributesForElement):
(HTMLConverter::aggregatedAttributesForAncestors):
(HTMLConverter::_processText):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166347 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/HTMLConverter.mm