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

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

Issue 10689138: Merge 120868 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 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
« no previous file with comments | « Source/WebCore/dom/DynamicNodeList.h ('k') | Source/WebCore/dom/NodeRareData.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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 #if ENABLE(MICRODATA) 960 #if ENABLE(MICRODATA)
961 && attrName != itemscopeAttr 961 && attrName != itemscopeAttr
962 && attrName != itempropAttr 962 && attrName != itempropAttr
963 && attrName != itemtypeAttr 963 && attrName != itemtypeAttr
964 #endif 964 #endif
965 && attrName != nameAttr 965 && attrName != nameAttr
966 && attrName != forAttr 966 && attrName != forAttr
967 && (attrName != idAttr || !attributeOwnerElement->isFormControlElement() )) 967 && (attrName != idAttr || !attributeOwnerElement->isFormControlElement() ))
968 return; 968 return;
969 969
970 if (document()->hasRareData()) { 970 document()->clearNodeListCaches();
971 if (NodeListsNodeData* nodeLists = document()->rareData()->nodeLists())
972 nodeLists->invalidateCachesForDocument();
973 }
974 971
975 if (!treeScope()->hasNodeListCaches()) 972 if (!treeScope()->hasNodeListCaches())
976 return; 973 return;
977 974
978 for (Node* node = this; node; node = node->parentNode()) { 975 for (Node* node = this; node; node = node->parentNode()) {
979 ASSERT(this == node || !node->isAttributeNode()); 976 ASSERT(this == node || !node->isAttributeNode());
980 if (!node->hasRareData()) 977 if (!node->hasRareData())
981 continue; 978 continue;
982 NodeRareData* data = node->rareData(); 979 NodeRareData* data = node->rareData();
983 if (!data->nodeLists()) 980 if (!data->nodeLists())
984 continue; 981 continue;
985 982
986 data->nodeLists()->invalidateCachesThatDependOnAttributes(); 983 data->nodeLists()->invalidateCachesThatDependOnAttributes();
987 } 984 }
988 } 985 }
989 986
990 void Node::invalidateNodeListsCacheAfterChildrenChanged() 987 void Node::invalidateNodeListsCacheAfterChildrenChanged()
991 { 988 {
992 if (hasRareData()) 989 if (hasRareData())
993 rareData()->clearChildNodeListCache(); 990 rareData()->clearChildNodeListCache();
994 991
995 if (document()->hasRareData()) { 992 document()->clearNodeListCaches();
996 if (NodeListsNodeData* nodeLists = document()->rareData()->nodeLists())
997 nodeLists->invalidateCachesForDocument();
998 }
999 993
1000 if (!treeScope()->hasNodeListCaches()) 994 if (!treeScope()->hasNodeListCaches())
1001 return; 995 return;
996
1002 for (Node* node = this; node; node = node->parentNode()) { 997 for (Node* node = this; node; node = node->parentNode()) {
1003 if (!node->hasRareData()) 998 if (!node->hasRareData())
1004 continue; 999 continue;
1005 NodeRareData* data = node->rareData(); 1000 NodeRareData* data = node->rareData();
1006 if (!data->nodeLists()) 1001 if (!data->nodeLists())
1007 continue; 1002 continue;
1008 1003
1009 data->nodeLists()->invalidateCaches(); 1004 data->nodeLists()->invalidateCaches();
1010 } 1005 }
1011 } 1006 }
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 { 2313 {
2319 TagNodeListCache::const_iterator tagCacheEnd = m_tagNodeListCache.end(); 2314 TagNodeListCache::const_iterator tagCacheEnd = m_tagNodeListCache.end();
2320 for (TagNodeListCache::const_iterator it = m_tagNodeListCache.begin(); it != tagCacheEnd; ++it) 2315 for (TagNodeListCache::const_iterator it = m_tagNodeListCache.begin(); it != tagCacheEnd; ++it)
2321 it->second->invalidateCache(); 2316 it->second->invalidateCache();
2322 TagNodeListCacheNS::const_iterator tagCacheNSEnd = m_tagNodeListCacheNS.end( ); 2317 TagNodeListCacheNS::const_iterator tagCacheNSEnd = m_tagNodeListCacheNS.end( );
2323 for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.begin(); i t != tagCacheNSEnd; ++it) 2318 for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.begin(); i t != tagCacheNSEnd; ++it)
2324 it->second->invalidateCache(); 2319 it->second->invalidateCache();
2325 invalidateCachesThatDependOnAttributes(); 2320 invalidateCachesThatDependOnAttributes();
2326 } 2321 }
2327 2322
2328 void NodeListsNodeData::invalidateCachesForDocument()
2329 {
2330 NodeListsNodeData::NodeListSet::iterator end = m_listsInvalidatedAtDocument. end();
2331 for (NodeListsNodeData::NodeListSet::iterator it = m_listsInvalidatedAtDocum ent.begin(); it != end; ++it)
2332 (*it)->invalidateCache();
2333 }
2334
2335 void NodeListsNodeData::invalidateCachesThatDependOnAttributes() 2323 void NodeListsNodeData::invalidateCachesThatDependOnAttributes()
2336 { 2324 {
2337 ClassNodeListCache::iterator classCacheEnd = m_classNodeListCache.end(); 2325 ClassNodeListCache::iterator classCacheEnd = m_classNodeListCache.end();
2338 for (ClassNodeListCache::iterator it = m_classNodeListCache.begin(); it != c lassCacheEnd; ++it) 2326 for (ClassNodeListCache::iterator it = m_classNodeListCache.begin(); it != c lassCacheEnd; ++it)
2339 it->second->invalidateCache(); 2327 it->second->invalidateCache();
2340 2328
2341 NameNodeListCache::iterator nameCacheEnd = m_nameNodeListCache.end(); 2329 NameNodeListCache::iterator nameCacheEnd = m_nameNodeListCache.end();
2342 for (NameNodeListCache::iterator it = m_nameNodeListCache.begin(); it != nam eCacheEnd; ++it) 2330 for (NameNodeListCache::iterator it = m_nameNodeListCache.begin(); it != nam eCacheEnd; ++it)
2343 it->second->invalidateCache(); 2331 it->second->invalidateCache();
2344 if (m_labelsNodeListCache) 2332 if (m_labelsNodeListCache)
2345 m_labelsNodeListCache->invalidateCache(); 2333 m_labelsNodeListCache->invalidateCache();
2346 2334
2347 #if ENABLE(MICRODATA) 2335 #if ENABLE(MICRODATA)
2348 MicroDataItemListCache::iterator itemListCacheEnd = m_microDataItemListCache .end(); 2336 MicroDataItemListCache::iterator itemListCacheEnd = m_microDataItemListCache .end();
2349 for (MicroDataItemListCache::iterator it = m_microDataItemListCache.begin(); it != itemListCacheEnd; ++it) 2337 for (MicroDataItemListCache::iterator it = m_microDataItemListCache.begin(); it != itemListCacheEnd; ++it)
2350 it->second->invalidateCache(); 2338 it->second->invalidateCache();
2351 #endif 2339 #endif
2352
2353 RadioNodeListCache::iterator radioNodeListCacheEnd = m_radioNodeListCache.en d();
2354 for (RadioNodeListCache::iterator it = m_radioNodeListCache.begin(); it != r adioNodeListCacheEnd; ++it)
2355 it->second->invalidateCache();
2356 } 2340 }
2357 2341
2358 bool NodeListsNodeData::isEmpty() const 2342 bool NodeListsNodeData::isEmpty() const
2359 { 2343 {
2360 if (!m_listsInvalidatedAtDocument.isEmpty())
2361 return false;
2362
2363 if (!m_tagNodeListCache.isEmpty()) 2344 if (!m_tagNodeListCache.isEmpty())
2364 return false; 2345 return false;
2365 if (!m_tagNodeListCacheNS.isEmpty()) 2346 if (!m_tagNodeListCacheNS.isEmpty())
2366 return false; 2347 return false;
2367 if (!m_classNodeListCache.isEmpty()) 2348 if (!m_classNodeListCache.isEmpty())
2368 return false; 2349 return false;
2369 if (!m_nameNodeListCache.isEmpty()) 2350 if (!m_nameNodeListCache.isEmpty())
2370 return false; 2351 return false;
2371 #if ENABLE(MICRODATA) 2352 #if ENABLE(MICRODATA)
2372 if (!m_microDataItemListCache.isEmpty()) 2353 if (!m_microDataItemListCache.isEmpty())
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2942 node->showTreeForThis(); 2923 node->showTreeForThis();
2943 } 2924 }
2944 2925
2945 void showNodePath(const WebCore::Node* node) 2926 void showNodePath(const WebCore::Node* node)
2946 { 2927 {
2947 if (node) 2928 if (node)
2948 node->showNodePathForThis(); 2929 node->showNodePathForThis();
2949 } 2930 }
2950 2931
2951 #endif 2932 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/dom/DynamicNodeList.h ('k') | Source/WebCore/dom/NodeRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698