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

Unified Diff: Source/core/dom/Document.cpp

Issue 308963002: Minimize calls to Node::nodeType() as it is virtual (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/DocumentFragment.h » ('j') | Source/core/dom/Node.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 1b58988fa57f7919eb3c223be714fb8e9d4aa15d..0958eb4485e22fb1e37254802ae491be0a8d193e 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -3333,8 +3333,8 @@ bool Document::canReplaceChild(const Node& newChild, const Node& oldChild) const
}
// Then, see how many doctypes and elements might be added by the new child.
- if (newChild.nodeType() == DOCUMENT_FRAGMENT_NODE) {
- for (Node* c = newChild.firstChild(); c; c = c->nextSibling()) {
+ if (newChild.isDocumentFragment()) {
+ for (Node* c = toDocumentFragment(newChild).firstChild(); c; c = c->nextSibling()) {
aandrey 2014/06/02 14:50:51 why change this?
Inactive 2014/06/02 15:48:02 Because this ends up calling ContainerNode::firstC
Inactive 2014/06/02 15:49:02 BTW, this is not the only place where we should do
switch (c->nodeType()) {
case ATTRIBUTE_NODE:
case CDATA_SECTION_NODE:
« no previous file with comments | « no previous file | Source/core/dom/DocumentFragment.h » ('j') | Source/core/dom/Node.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698