commit | 362b9e1aefdc1846862db8fb097d87ae2ab19992 | [log] [tgz] |
---|---|---|
author | Emil A Eklund <eae@chromium.org> | Thu Nov 29 22:20:45 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Nov 29 22:20:45 2018 |
tree | a26f787a67eb1ab6afadbe66648501e4c42cf97c | |
parent | 96ea470027c441ada9b8ff14372f7e422650afc8 [diff] |
[LayoutNG] Fix O(N^2) in NGInlineNode::ShapeText When shaping the content of an inline node in NGInlineNode::ShapeText we assume that the number of runs is small and iterate over all of the runs for each inline item. This assumption holds true for most content, there are certain cases where the assumption is incorrect however, such as the euckr-decode-ksc_5601.html WPT test where each CJK glyph is wrapped in a span and separated by space characters of a different glyph. This causes each of the 10k+ items to iterate over 10+ runs which is very expensive. This patch adds an optional context argument to ShapeResult::SubRange so that context (the relevant run) may be maintained across invocations and thereby avoids an extra loop over all of the runs for each SubRange call. Change-Id: I2ee610a60e33fe4389277fc275a9b8d670453a31 Reviewed-on: https://chromium-review.googlesource.com/c/1354561 Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org> Commit-Queue: Emil A Eklund <eae@chromium.org> Cr-Commit-Position: refs/heads/master@{#612403}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .