Changeset 87079 in webkit
- Timestamp:
- May 23, 2011 10:47:46 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87074 r87079 1 2011-05-23 Roland Steiner <rolandsteiner@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Update node list cache count on the containing TreeScope rather than the Document 6 https://bugs.webkit.org/show_bug.cgi?id=59983 7 8 Change code to call add/removeNodeListCache() and hasNodeListCaches() on the proper tree scope. 9 Move updating of the node list cache count from setDocument() to setTreeScopeRecursively(). 10 Make setDocument() and setDocumentRecursively() private. 11 12 No new tests. (refactoring) 13 14 * dom/ContainerNode.cpp: 15 (WebCore::ContainerNode::childrenChanged): 16 * dom/Node.cpp: 17 (WebCore::Node::~Node): 18 (WebCore::Node::setDocument): 19 (WebCore::Node::setTreeScopeRecursively): 20 (WebCore::Node::childNodes): 21 (WebCore::Node::registerDynamicNodeList): 22 (WebCore::Node::unregisterDynamicNodeList): 23 (WebCore::Node::notifyLocalNodeListsAttributeChanged): 24 (WebCore::Node::notifyLocalNodeListsChildrenChanged): 25 (WebCore::Node::getElementsByTagName): 26 (WebCore::Node::getElementsByTagNameNS): 27 (WebCore::Node::getElementsByName): 28 (WebCore::Node::getElementsByClassName): 29 * dom/Node.h: 30 * html/HTMLFormControlElement.cpp: 31 (WebCore::HTMLFormControlElement::labels): 32 1 33 2011-05-23 Yury Semikhatsky <yurys@chromium.org> 2 34 -
trunk/Source/WebCore/dom/ContainerNode.cpp
r86358 r87079 813 813 if (!changedByParser && childCountDelta) 814 814 document()->nodeChildrenChanged(this); 815 if ( document()->hasNodeListCaches())815 if (treeScope()->hasNodeListCaches()) 816 816 notifyNodeListsChildrenChanged(); 817 817 } -
trunk/Source/WebCore/dom/Node.cpp
r87067 r87079 391 391 ASSERT(!NodeRareData::rareDataMap().contains(this)); 392 392 else { 393 if ( m_document&& rareData()->nodeLists())394 m_document->removeNodeListCache();393 if (treeScope() && rareData()->nodeLists()) 394 treeScope()->removeNodeListCache(); 395 395 396 396 NodeRareData::NodeRareDataMap& dataMap = NodeRareData::rareDataMap(); … … 454 454 willMoveToNewOwnerDocument(); 455 455 ASSERT(willMoveToNewOwnerDocumentWasCalled); 456 457 if (hasRareData() && rareData()->nodeLists()) {458 if (m_document)459 m_document->removeNodeListCache();460 document->addNodeListCache();461 }462 456 463 457 if (m_document) { … … 511 505 node->ensureRareData()->setTreeScope(newTreeScope); 512 506 507 if (node->hasRareData() && node->rareData()->nodeLists()) { 508 if (currentTreeScope) 509 currentTreeScope->removeNodeListCache(); 510 newTreeScope->addNodeListCache(); 511 } 512 513 513 node->setDocument(newDocument); 514 514 … … 607 607 if (!data->nodeLists()) { 608 608 data->setNodeLists(NodeListsNodeData::create()); 609 if ( document())610 document()->addNodeListCache();609 if (treeScope()) 610 treeScope()->addNodeListCache(); 611 611 } 612 612 … … 979 979 if (!data->nodeLists()) { 980 980 data->setNodeLists(NodeListsNodeData::create()); 981 document()->addNodeListCache();982 } else if (! m_document || !m_document->hasNodeListCaches()) {981 treeScope()->addNodeListCache(); 982 } else if (!treeScope() || !treeScope()->hasNodeListCaches()) { 983 983 // We haven't been receiving notifications while there were no registered lists, so the cache is invalid now. 984 984 data->nodeLists()->invalidateCaches(); … … 998 998 if (data->nodeLists()->isEmpty()) { 999 999 data->clearNodeLists(); 1000 if ( document())1001 document()->removeNodeListCache();1000 if (treeScope()) 1001 treeScope()->removeNodeListCache(); 1002 1002 } 1003 1003 } … … 1019 1019 if (data->nodeLists()->isEmpty()) { 1020 1020 data->clearNodeLists(); 1021 document()->removeNodeListCache();1021 treeScope()->removeNodeListCache(); 1022 1022 } 1023 1023 } … … 1045 1045 if (data->nodeLists()->isEmpty()) { 1046 1046 data->clearNodeLists(); 1047 document()->removeNodeListCache();1047 treeScope()->removeNodeListCache(); 1048 1048 } 1049 1049 } … … 1823 1823 if (!data->nodeLists()) { 1824 1824 data->setNodeLists(NodeListsNodeData::create()); 1825 document()->addNodeListCache();1825 treeScope()->addNodeListCache(); 1826 1826 } 1827 1827 … … 1852 1852 if (!data->nodeLists()) { 1853 1853 data->setNodeLists(NodeListsNodeData::create()); 1854 document()->addNodeListCache();1854 treeScope()->addNodeListCache(); 1855 1855 } 1856 1856 … … 1875 1875 if (!data->nodeLists()) { 1876 1876 data->setNodeLists(NodeListsNodeData::create()); 1877 document()->addNodeListCache();1877 treeScope()->addNodeListCache(); 1878 1878 } 1879 1879 … … 1892 1892 if (!data->nodeLists()) { 1893 1893 data->setNodeLists(NodeListsNodeData::create()); 1894 document()->addNodeListCache();1894 treeScope()->addNodeListCache(); 1895 1895 } 1896 1896 -
trunk/Source/WebCore/dom/Node.h
r87067 r87079 637 637 Node(Document*, ConstructionType); 638 638 639 // Do not use this method to change the document of a node until after the node has been640 // removed from its previous document.641 void setDocument(Document*);642 void setDocumentRecursively(Document*);643 644 639 virtual void willMoveToNewOwnerDocument(); 645 640 virtual void didMoveToNewOwnerDocument(); … … 655 650 656 651 private: 652 // Do not use this method to change the document of a node until after the node has been 653 // removed from its previous document. 654 void setDocumentRecursively(Document*); 655 void setDocument(Document*); 656 657 657 enum EditableLevel { Editable, RichlyEditable }; 658 658 bool rendererIsEditable(EditableLevel) const; -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r86988 r87079 488 488 if (!data->nodeLists()) { 489 489 data->setNodeLists(NodeListsNodeData::create()); 490 document()->addNodeListCache();490 treeScope()->addNodeListCache(); 491 491 } 492 492
Note: See TracChangeset
for help on using the changeset viewer.