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

Unified Diff: Source/core/dom/ContainerNode.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index 8964573589802af05f0155a52ba02ac8b493e9a8..85218b1f258be695a248586d87737a9a4c3a4c8e 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -1315,6 +1315,30 @@ void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, Nod
}
}
+void ContainerNode::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement)
+{
+ if (hasRareData() && (!attrName || isAttributeNode())) {
+ if (NodeListsNodeData* lists = rareData()->nodeLists()) {
+ if (ChildNodeList* childNodeList = lists->childNodeList(*this))
+ childNodeList->invalidateCache();
+ }
+ }
+
+ // Modifications to attributes that are not associated with an Element can't invalidate NodeList caches.
+ if (attrName && !attributeOwnerElement)
+ return;
+
+ if (!document().shouldInvalidateNodeListCaches(attrName))
+ return;
+
+ document().invalidateNodeListCaches(attrName);
+
+ for (ContainerNode* node = this; node; node = node->parentNode()) {
+ if (NodeListsNodeData* lists = node->nodeLists())
+ lists->invalidateCaches(attrName);
+ }
+}
+
PassRefPtrWillBeRawPtr<TagCollection> ContainerNode::getElementsByTagName(const AtomicString& localName)
{
if (localName.isNull())
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698