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

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp

Issue 2194393004: Move Range objects new owner after moving tree rather than during moving tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-08-02T18:35:29 Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/RangeTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 for (const auto& attr : *attrs) 65 for (const auto& attr : *attrs)
66 moveTreeToNewScope(*attr); 66 moveTreeToNewScope(*attr);
67 } 67 }
68 68
69 for (ShadowRoot* shadow = element.youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) { 69 for (ShadowRoot* shadow = element.youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) {
70 shadow->setParentTreeScope(newScope()); 70 shadow->setParentTreeScope(newScope());
71 if (willMoveToNewDocument) 71 if (willMoveToNewDocument)
72 moveTreeToNewDocument(*shadow, oldDocument, newDocument); 72 moveTreeToNewDocument(*shadow, oldDocument, newDocument);
73 } 73 }
74 } 74 }
75 if (!willMoveToNewDocument)
76 return;
77 oldDocument.didMoveTreeToNewDocument(root);
75 } 78 }
76 79
77 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument, Document& newDocument) const 80 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument, Document& newDocument) const
78 { 81 {
79 DCHECK_NE(oldDocument, newDocument); 82 DCHECK_NE(oldDocument, newDocument);
80 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { 83 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
81 moveNodeToNewDocument(node, oldDocument, newDocument); 84 moveNodeToNewDocument(node, oldDocument, newDocument);
82 85
83 if (!node.isElementNode()) 86 if (!node.isElementNode())
84 continue; 87 continue;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; 136 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument;
134 #endif 137 #endif
135 138
136 node.didMoveToNewDocument(oldDocument); 139 node.didMoveToNewDocument(oldDocument);
137 #if DCHECK_IS_ON() 140 #if DCHECK_IS_ON()
138 DCHECK(didMoveToNewDocumentWasCalled); 141 DCHECK(didMoveToNewDocumentWasCalled);
139 #endif 142 #endif
140 } 143 }
141 144
142 } // namespace blink 145 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/RangeTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698