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

Side by Side 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: 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
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, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 } 1308 }
1309 1309
1310 // The + selector. We need to invalidate the first element following the cha nge. It is the only possible element 1310 // The + selector. We need to invalidate the first element following the cha nge. It is the only possible element
1311 // that could be affected by this DOM change. 1311 // that could be affected by this DOM change.
1312 if (childrenAffectedByDirectAdjacentRules() && nodeAfterChange) { 1312 if (childrenAffectedByDirectAdjacentRules() && nodeAfterChange) {
1313 if (Element* elementAfterChange = nodeAfterChange->isElementNode() ? toE lement(nodeAfterChange) : ElementTraversal::nextSibling(*nodeAfterChange)) 1313 if (Element* elementAfterChange = nodeAfterChange->isElementNode() ? toE lement(nodeAfterChange) : ElementTraversal::nextSibling(*nodeAfterChange))
1314 elementAfterChange->setNeedsStyleRecalc(SubtreeStyleChange); 1314 elementAfterChange->setNeedsStyleRecalc(SubtreeStyleChange);
1315 } 1315 }
1316 } 1316 }
1317 1317
1318 void ContainerNode::invalidateNodeListCachesInAncestors(const QualifiedName* att rName, Element* attributeOwnerElement)
1319 {
1320 if (hasRareData() && (!attrName || isAttributeNode())) {
1321 if (NodeListsNodeData* lists = rareData()->nodeLists())
1322 lists->clearChildNodeListCache();
1323 }
1324
1325 // Modifications to attributes that are not associated with an Element can't invalidate NodeList caches.
1326 if (attrName && !attributeOwnerElement)
1327 return;
1328
1329 if (!document().shouldInvalidateNodeListCaches(attrName))
1330 return;
1331
1332 document().invalidateNodeListCaches(attrName);
1333
1334 for (ContainerNode* node = this; node; node = node->parentNode()) {
1335 if (NodeListsNodeData* lists = node->nodeLists())
1336 lists->invalidateCaches(attrName);
1337 }
1338 }
1339
1318 PassRefPtrWillBeRawPtr<TagCollection> ContainerNode::getElementsByTagName(const AtomicString& localName) 1340 PassRefPtrWillBeRawPtr<TagCollection> ContainerNode::getElementsByTagName(const AtomicString& localName)
1319 { 1341 {
1320 if (localName.isNull()) 1342 if (localName.isNull())
1321 return nullptr; 1343 return nullptr;
1322 1344
1323 if (document().isHTMLDocument()) 1345 if (document().isHTMLDocument())
1324 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(*t his, HTMLTagCollectionType, localName); 1346 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(*t his, HTMLTagCollectionType, localName);
1325 return ensureRareData().ensureNodeLists().addCache<TagCollection>(*this, Tag CollectionType, localName); 1347 return ensureRareData().ensureNodeLists().addCache<TagCollection>(*this, Tag CollectionType, localName);
1326 } 1348 }
1327 1349
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 return true; 1409 return true;
1388 1410
1389 if (node->isElementNode() && toElement(node)->shadow()) 1411 if (node->isElementNode() && toElement(node)->shadow())
1390 return true; 1412 return true;
1391 1413
1392 return false; 1414 return false;
1393 } 1415 }
1394 #endif 1416 #endif
1395 1417
1396 } // namespace blink 1418 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698