commit | 7c44da721a59e6aa0b9fdcddb314175cb1e0123f | [log] [tgz] |
---|---|---|
author | Rune Lillesveen <rune@opera.com> | Fri Jun 30 12:28:44 2017 |
committer | Commit Bot <commit-bot@chromium.org> | Fri Jun 30 12:28:44 2017 |
tree | d477a60ab35c04a81895db9254968c053e980205 | |
parent | 203a2bad8062d170441af80f574e897bc586f180 [diff] |
Implement lazy (re-)attachment of whitespace. The existing implementation of re-attachment of whitespace nodes had performance issues because it tried to re-attach whitepace nodes as early as possible, leading to multiple re-attachments of the same node and multiple sibling-walks past the same out-of-flow elements. Instead, this CL stores the last seen text node in a new WhitespaceAttacher object and delays the re-attachment of that text node until we know its need for a LayoutObject for the current layout tree rebuild. In particular, we don't re-attach the whitespace node when previous siblings are/become display:none or out-of-flow. Contrary to what last_text_node did, the WhitespaceAttacher persist the last seen text node in the flat tree order and across display:contents and slot/content element which fixes various correctness issues in addition to performance issues. In addition to the last visited text node, we also store the last seen display:contents element and only walk the display:contents subtree when needed to find its first in-flow whitespace descendant. BUG=349395,399816,705525,686016,648931,650168 Change-Id: Id397986c49a4bc75e831da1ff8b679f2043873c3 Reviewed-on: https://chromium-review.googlesource.com/517940 Commit-Queue: Rune Lillesveen <rune@opera.com> Reviewed-by: Hayato Ito <hayato@chromium.org> Reviewed-by: meade_UTC10 <meade@chromium.org> Cr-Commit-Position: refs/heads/master@{#483683}