Simple line layout(regression): Calling innerText on RenderFlow with multiple childre...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Apr 2015 18:57:33 +0000 (18:57 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Apr 2015 18:57:33 +0000 (18:57 +0000)
commitbfbb11ff8a5b9afce75bf64bfa587abcd9428860
treef76d10a41e7139291783faa140df6fa2ea7afd9e
parentedb172577bde6a75496be5838019f01abbf07de3
Simple line layout(regression): Calling innerText on RenderFlow with multiple children is slow.
https://bugs.webkit.org/show_bug.cgi?id=143554

Reviewed by Antti Koivisto.

Initialize render flow's segments only when the render flow changes in TextIterator.
The included performance test shows 6x speedup. (from ~10 runs/sec to ~60 runs/sec)

PerformanceTests:

* Layout/simple-line-layout-innertext.html: Added.

Source/WebCore:

Test: PerformanceTests/Layout/simple-line-layout-innertext.html.

* editing/TextIterator.cpp:
(WebCore::TextIterator::handleTextNode):
* editing/TextIterator.h:
* rendering/SimpleLineLayoutFlowContents.cpp: Instruments log shows that vector's expandCapacity could be expensive when flow has large amount of children.
(WebCore::SimpleLineLayout::initializeSegments):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182604 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PerformanceTests/ChangeLog
PerformanceTests/Layout/simple-line-layout-innertext.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/editing/TextIterator.h
Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp
Source/WebCore/rendering/SimpleLineLayoutResolver.cpp
Source/WebCore/rendering/SimpleLineLayoutResolver.h