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

Side by Side 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, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/DocumentFragment.h » ('j') | Source/core/dom/Node.cpp » ('J')
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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after
3326 break; 3326 break;
3327 case ELEMENT_NODE: 3327 case ELEMENT_NODE:
3328 numElements++; 3328 numElements++;
3329 break; 3329 break;
3330 default: 3330 default:
3331 break; 3331 break;
3332 } 3332 }
3333 } 3333 }
3334 3334
3335 // Then, see how many doctypes and elements might be added by the new child. 3335 // Then, see how many doctypes and elements might be added by the new child.
3336 if (newChild.nodeType() == DOCUMENT_FRAGMENT_NODE) { 3336 if (newChild.isDocumentFragment()) {
3337 for (Node* c = newChild.firstChild(); c; c = c->nextSibling()) { 3337 for (Node* c = toDocumentFragment(newChild).firstChild(); c; c = c->next Sibling()) {
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
3338 switch (c->nodeType()) { 3338 switch (c->nodeType()) {
3339 case ATTRIBUTE_NODE: 3339 case ATTRIBUTE_NODE:
3340 case CDATA_SECTION_NODE: 3340 case CDATA_SECTION_NODE:
3341 case DOCUMENT_FRAGMENT_NODE: 3341 case DOCUMENT_FRAGMENT_NODE:
3342 case DOCUMENT_NODE: 3342 case DOCUMENT_NODE:
3343 case TEXT_NODE: 3343 case TEXT_NODE:
3344 return false; 3344 return false;
3345 case COMMENT_NODE: 3345 case COMMENT_NODE:
3346 case PROCESSING_INSTRUCTION_NODE: 3346 case PROCESSING_INSTRUCTION_NODE:
3347 break; 3347 break;
(...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after
5802 visitor->trace(m_timeline); 5802 visitor->trace(m_timeline);
5803 visitor->trace(m_compositorPendingAnimations); 5803 visitor->trace(m_compositorPendingAnimations);
5804 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5804 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5805 DocumentSupplementable::trace(visitor); 5805 DocumentSupplementable::trace(visitor);
5806 TreeScope::trace(visitor); 5806 TreeScope::trace(visitor);
5807 ContainerNode::trace(visitor); 5807 ContainerNode::trace(visitor);
5808 ExecutionContext::trace(visitor); 5808 ExecutionContext::trace(visitor);
5809 } 5809 }
5810 5810
5811 } // namespace WebCore 5811 } // namespace WebCore
OLDNEW
« 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