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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 413763004: Get rid of unnecessary isChildNodeList() virtual call in clearChildNodeListCache() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Second proposal Created 6 years, 5 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 | « Source/core/dom/Node.h ('k') | Source/core/dom/NodeListsNodeData.h » ('j') | 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 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 831
832 unsigned Node::nodeIndex() const 832 unsigned Node::nodeIndex() const
833 { 833 {
834 Node *_tempNode = previousSibling(); 834 Node *_tempNode = previousSibling();
835 unsigned count=0; 835 unsigned count=0;
836 for ( count=0; _tempNode; count++ ) 836 for ( count=0; _tempNode; count++ )
837 _tempNode = _tempNode->previousSibling(); 837 _tempNode = _tempNode->previousSibling();
838 return count; 838 return count;
839 } 839 }
840 840
841 void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, El ement* attributeOwnerElement)
842 {
843 if (hasRareData() && (!attrName || isAttributeNode())) {
844 if (NodeListsNodeData* lists = rareData()->nodeLists())
845 lists->clearChildNodeListCache();
846 }
847
848 // Modifications to attributes that are not associated with an Element can't invalidate NodeList caches.
849 if (attrName && !attributeOwnerElement)
850 return;
851
852 if (!document().shouldInvalidateNodeListCaches(attrName))
853 return;
854
855 document().invalidateNodeListCaches(attrName);
856
857 for (Node* node = this; node; node = node->parentNode()) {
858 if (NodeListsNodeData* lists = node->nodeLists())
859 lists->invalidateCaches(attrName);
860 }
861 }
862
863 NodeListsNodeData* Node::nodeLists() 841 NodeListsNodeData* Node::nodeLists()
864 { 842 {
865 return hasRareData() ? rareData()->nodeLists() : 0; 843 return hasRareData() ? rareData()->nodeLists() : 0;
866 } 844 }
867 845
868 void Node::clearNodeLists() 846 void Node::clearNodeLists()
869 { 847 {
870 rareData()->clearNodeLists(); 848 rareData()->clearNodeLists();
871 } 849 }
872 850
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 node->showTreeForThis(); 2547 node->showTreeForThis();
2570 } 2548 }
2571 2549
2572 void showNodePath(const blink::Node* node) 2550 void showNodePath(const blink::Node* node)
2573 { 2551 {
2574 if (node) 2552 if (node)
2575 node->showNodePathForThis(); 2553 node->showNodePathForThis();
2576 } 2554 }
2577 2555
2578 #endif 2556 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/NodeListsNodeData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698