[LayoutNG] Improve LayoutText::SetTextWithOffset() by reducing text shaping
This patch changes |LayoutText::SetTextWithOffset()| to reduce text shaping by reusing |ShapeResult| of before and after replaced range for improving performance, 10% to 15% faster but 3 times slower than legacy layout. (Profile data: http://bit.ly/33B9rfg) From this patch, |SetTextWithOffset()| does: 1. Get offset mapping to map DOM offsets to text content offsets for replaced range. 2. Collect inlines into |text_content| and |NGInlineItem| to get newly inserted text. 3. Copy before and after |ShapeResult| from current data to |NGInlineItem| list in step 2. 4. Call |NGInlineNode::ShapeText()| with |NGInlineItem| list to reuse |ShapeResult|. This patch gets rid of NGInlineNodeTest.InvalidateSetTextWithOffset because new test case replaces this test and this test call |SetTextWithOffset()| with wrong parameter. It shoulbe |SetTextWithOffset("baftere", 1, 4)| as result of |"before".replaceData(1, 4, "after")|. Bug: 707656 Change-Id: I078b19615d6f7e31362c1e6398aac88fb17b29c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729330 Commit-Queue: Yoshifumi Inoue <yosin@chromium.org> Auto-Submit: Yoshifumi Inoue <yosin@chromium.org> Reviewed-by:Koji Ishii <kojii@chromium.org> Reviewed-by:
Emil A Eklund <eae@chromium.org> Cr-Commit-Position: refs/heads/master@{#691080}
Showing
This diff is collapsed.
Please register or sign in to comment