Distribution calculation happens even when v1 shadow tree doesn't have a slot |
||
Issue descriptionThe context: https://crbug.com/699838 It looks Blink recursively traverses down all shadow trees to *calculate* distribution even when a slot is not used at all there. It looks wasteful, and actually consumes some time budget, though it is not significant. I think we can skip that because a distribution recalc flag is now set lazily (dynamically) when a relevant DOM mutation happens.
,
Apr 19 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a9c70fe4e42df88f817cb00cbc13a98b7727d99f commit a9c70fe4e42df88f817cb00cbc13a98b7727d99f Author: hayato <hayato@chromium.org> Date: Wed Apr 19 10:42:07 2017 Do not set a distribution recalc flag when v1 shadow tree is added After rewriting Shadow DOM distribution engine for v1 [1], we no longer need to set a distribution recalc flag when a v1 shadow tree is added. A distribution recalc flag will be set correctly later, if necessary, when a slot is inserted, removed, or other relevant DOM mutation happens. Instead of setting recalc flag, host's children need to be lazy reattached in adding a shadow root, which would be done in resolve assignments if we set a distribution recalc flag. This optimization would make loading slightly faster when there are many shadow trees which will not have a slot because we do not need to traverse down the trees. In the case of bug 699838, this can make loading 5ms (at most) faster. [1] https://codereview.chromium.org/1995203002 BUG= 712559 Review-Url: https://codereview.chromium.org/2822113002 Cr-Commit-Position: refs/heads/master@{#465547} [add] https://crrev.com/a9c70fe4e42df88f817cb00cbc13a98b7727d99f/third_party/WebKit/LayoutTests/shadow-dom/layout-1-expected.html [add] https://crrev.com/a9c70fe4e42df88f817cb00cbc13a98b7727d99f/third_party/WebKit/LayoutTests/shadow-dom/layout-1.html [modify] https://crrev.com/a9c70fe4e42df88f817cb00cbc13a98b7727d99f/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
,
Apr 19 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by hayato@chromium.org
, Apr 19 2017186 KB
186 KB View Download