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

Issue 306233005: Call insertedInto or removedFrom before childrenChanged (Closed)

Created:
6 years, 6 months ago by esprehn
Modified:
6 years, 6 months ago
Reviewers:
abarth-chromium, adamk, ojan
CC:
blink-reviews, blink-reviews-dom_chromium.org, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Visibility:
Public.

Description

Call insertedInto or removedFrom before childrenChanged To avoid needing put all the children into a NodeVector inside removeChildren() we can reverse the order of childrenChanged and the associated child notifications (insertedInto/removedFrom). This seems fine, it means that a parent now is not told it has new children until they've already been told they're in the tree. Inversely it does mean that when a child is told it's in the tree the parent doesn't know it has new children yet, but that's less crazy since it doesn't result in things like children without inDocument() bits being set existing inside ::childrenChanged. For removal I swapped the calls to notifyNodeRemoved with the calls to childrenChanged. For insertion I moved the call to childrenChanged into the notifyNodeInserted function. This is necessary since it can run script and we need to call childrenChanged before running the script. I also added some more RefPtr<Node> protect(this) guards to methods which can runs script and more ScriptForbiddenScopes to parts of the code that now can't run script. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=175732

Patch Set 1 #

Patch Set 2 : Do it for real #

Patch Set 3 : Pass right flags, don't notify on ShadowRoot #

Total comments: 3

Patch Set 4 : enum { OjanReview } #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -27 lines) Patch
M Source/core/dom/ContainerNode.h View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M Source/core/dom/ContainerNode.cpp View 1 2 3 10 chunks +33 lines, -26 lines 2 comments Download

Messages

Total messages: 7 (0 generated)
esprehn
6 years, 6 months ago (2014-06-03 01:35:47 UTC) #1
ojan
lgtm https://codereview.chromium.org/306233005/diff/40001/Source/core/dom/ContainerNode.cpp File Source/core/dom/ContainerNode.cpp (right): https://codereview.chromium.org/306233005/diff/40001/Source/core/dom/ContainerNode.cpp#newcode509 Source/core/dom/ContainerNode.cpp:509: RefPtr<Node> protect(this); Don't need this if script can't ...
6 years, 6 months ago (2014-06-04 00:38:46 UTC) #2
esprehn
The CQ bit was checked by esprehn@chromium.org
6 years, 6 months ago (2014-06-07 00:14:47 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/esprehn@chromium.org/306233005/60001
6 years, 6 months ago (2014-06-07 00:15:09 UTC) #4
abarth-chromium
https://codereview.chromium.org/306233005/diff/60001/Source/core/dom/ContainerNode.cpp File Source/core/dom/ContainerNode.cpp (right): https://codereview.chromium.org/306233005/diff/60001/Source/core/dom/ContainerNode.cpp#newcode281 Source/core/dom/ContainerNode.cpp:281: RefPtrWillBeRawPtr<Node> protect(this); Why not do this after checking for ...
6 years, 6 months ago (2014-06-07 01:17:51 UTC) #5
commit-bot: I haz the power
Change committed as 175732
6 years, 6 months ago (2014-06-07 03:48:18 UTC) #6
sof
6 years, 6 months ago (2014-06-07 15:41:09 UTC) #7
Message was sent while issue was closed.
https://codereview.chromium.org/306233005/diff/60001/Source/core/dom/Containe...
File Source/core/dom/ContainerNode.cpp (right):

https://codereview.chromium.org/306233005/diff/60001/Source/core/dom/Containe...
Source/core/dom/ContainerNode.cpp:283: if (nextChild.previousSibling() ==
newChild || nextChild == newChild) // nothing to do
Oilpan compilation broke as a result of dropping the & from what was there
previously.

Fixed compilation via https://codereview.chromium.org/325573002/

Powered by Google App Engine
This is Rietveld 408576698