Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Issue 1068193002: Make Node::needsDistributionRecalc always check the root node of the tree of trees, instead of the … (Closed)

Created:
5 years, 8 months ago by hayato
Modified:
5 years, 8 months ago
Reviewers:
esprehn, dglazkov
CC:
blink-reviews, blink-reviews-dom_chromium.org, dglazkov+blink, sof, eae+blinkwatch, rwlbuis, kochi, sergeyv
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Make Node::needsDistributionRecalc always check the root node of the tree of trees, instead of the node. This is a follow-up patch for https://codereview.chromium.org/1058763002. The previous patch's assertion is a weak assertion because it can't assert the following case: var shadowHost = document.createElement("div"); var shadowRoot = shadowHost.createShadowRoot(); var content = document.createElement("content"); shadowRoot.appendChild(content); // Note that |shadowHost| is *NOT* in a document. // To clear distribution-recalc flag on all nodes in this detached subtree, call getDestinationInsertionPoints() at an arbitrary node. content.getDestinationInsertionPoint(); // Append a child to the shadow host. var shadowHostChild = document.createElement("div"); shadowHostChild.appendChild(shadowHostChild); // Here, |shadowHostChild| and its ancestors (in a tree of trees), including |shadowHost|, // have distribution-recalc flag be set. However, |content|'s flag is *NOT* set. var distributedNodes = content.getDistributedNodes(); // Suppose that Blink forget to call |Node::updateDistribution()| before processing InsertionPoint::getDistributedNodes(), // we want to detect this error by the assertion, but calling InsertionPoint.getDitributedNodes() wouldn't hit the assertion // in the previous CL, unfortunately, because |content|'s flag is not set even when we need to re-calculate distributions in this case. As a result, |content.getDistributedNodes| would return an empty NodeList wrongly, instead of hitting an assertion. To hit the assertion, we should check the root node of the tree of trees. Note that, strictly speaking, this use case doesn't apply to the previous CL exactly. However, this use case might be enough to explain why the assertion in the previous CL is a weak condition. BUG=473000 TEST=distribution-for-detached-subtree.html. As long as Blink calls updateDistribution() properly, it wouldn't hit an assertion in either case. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=193529

Patch Set 1 #

Patch Set 2 : Add a test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+21 lines, -10 lines) Patch
A LayoutTests/fast/dom/shadow/distribution-for-detached-subtree.html View 1 1 chunk +16 lines, -0 lines 0 comments Download
A + LayoutTests/fast/dom/shadow/distribution-for-detached-subtree-expected.txt View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/Node.cpp View 1 2 chunks +3 lines, -9 lines 0 comments Download

Messages

Total messages: 9 (4 generated)
hayato
PTAL
5 years, 8 months ago (2015-04-08 09:39:30 UTC) #2
esprehn
On 2015/04/08 at 09:39:30, hayato wrote: > PTAL Can you add a test with your ...
5 years, 8 months ago (2015-04-09 19:26:37 UTC) #4
hayato
On 2015/04/09 19:26:37, esprehn wrote: > On 2015/04/08 at 09:39:30, hayato wrote: > > PTAL ...
5 years, 8 months ago (2015-04-10 03:09:35 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1068193002/20001
5 years, 8 months ago (2015-04-10 04:07:18 UTC) #8
commit-bot: I haz the power
5 years, 8 months ago (2015-04-10 09:35:59 UTC) #9
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=193529

Powered by Google App Engine
This is Rietveld 408576698