Changeset 85650 in webkit
- Timestamp:
- May 3, 2011 1:35:39 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r85649 r85650 1 2011-05-03 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-03 Ryosuke Niwa <rniwa@webkit.org> 2 34 -
trunk/Source/WebCore/dom/ContainerNode.cpp
r84701 r85650 794 794 if (!changedByParser && childCountDelta) 795 795 document()->nodeChildrenChanged(this); 796 if ( document()->hasNodeListCaches())796 if (treeScope()->hasNodeListCaches()) 797 797 notifyNodeListsChildrenChanged(); 798 798 } -
trunk/Source/WebCore/dom/Node.cpp
r85644 r85650 389 389 ASSERT(!NodeRareData::rareDataMap().contains(this)); 390 390 else { 391 if ( m_document&& rareData()->nodeLists())392 m_document->removeNodeListCache();391 if (treeScope() && rareData()->nodeLists()) 392 treeScope()->removeNodeListCache(); 393 393 394 394 NodeRareData::NodeRareDataMap& dataMap = NodeRareData::rareDataMap(); … … 452 452 willMoveToNewOwnerDocument(); 453 453 ASSERT(willMoveToNewOwnerDocumentWasCalled); 454 455 if (hasRareData() && rareData()->nodeLists()) {456 if (m_document)457 m_document->removeNodeListCache();458 document->addNodeListCache();459 }460 454 461 455 if (m_document) { … … 509 503 node->ensureRareData()->setTreeScope(newTreeScope); 510 504 505 if (hasRareData() && rareData()->nodeLists()) { 506 if (currentTreeScope) 507 currentTreeScope->removeNodeListCache(); 508 newTreeScope->addNodeListCache(); 509 } 510 511 511 node->setDocument(newDocument); 512 512 … … 605 605 if (!data->nodeLists()) { 606 606 data->setNodeLists(NodeListsNodeData::create()); 607 if ( document())608 document()->addNodeListCache();607 if (treeScope()) 608 treeScope()->addNodeListCache(); 609 609 } 610 610 … … 977 977 if (!data->nodeLists()) { 978 978 data->setNodeLists(NodeListsNodeData::create()); 979 document()->addNodeListCache();980 } else if (! m_document || !m_document->hasNodeListCaches()) {979 treeScope()->addNodeListCache(); 980 } else if (!treeScope() || !treeScope()->hasNodeListCaches()) { 981 981 // We haven't been receiving notifications while there were no registered lists, so the cache is invalid now. 982 982 data->nodeLists()->invalidateCaches(); … … 996 996 if (data->nodeLists()->isEmpty()) { 997 997 data->clearNodeLists(); 998 if ( document())999 document()->removeNodeListCache();998 if (treeScope()) 999 treeScope()->removeNodeListCache(); 1000 1000 } 1001 1001 } … … 1017 1017 if (data->nodeLists()->isEmpty()) { 1018 1018 data->clearNodeLists(); 1019 document()->removeNodeListCache();1019 treeScope()->removeNodeListCache(); 1020 1020 } 1021 1021 } … … 1043 1043 if (data->nodeLists()->isEmpty()) { 1044 1044 data->clearNodeLists(); 1045 document()->removeNodeListCache();1045 treeScope()->removeNodeListCache(); 1046 1046 } 1047 1047 } … … 1773 1773 if (!data->nodeLists()) { 1774 1774 data->setNodeLists(NodeListsNodeData::create()); 1775 document()->addNodeListCache();1775 treeScope()->addNodeListCache(); 1776 1776 } 1777 1777 … … 1802 1802 if (!data->nodeLists()) { 1803 1803 data->setNodeLists(NodeListsNodeData::create()); 1804 document()->addNodeListCache();1804 treeScope()->addNodeListCache(); 1805 1805 } 1806 1806 … … 1825 1825 if (!data->nodeLists()) { 1826 1826 data->setNodeLists(NodeListsNodeData::create()); 1827 document()->addNodeListCache();1827 treeScope()->addNodeListCache(); 1828 1828 } 1829 1829 … … 1842 1842 if (!data->nodeLists()) { 1843 1843 data->setNodeLists(NodeListsNodeData::create()); 1844 document()->addNodeListCache();1844 treeScope()->addNodeListCache(); 1845 1845 } 1846 1846 -
trunk/Source/WebCore/dom/Node.h
r85256 r85650 632 632 Node(Document*, ConstructionType); 633 633 634 // Do not use this method to change the document of a node until after the node has been635 // removed from its previous document.636 void setDocument(Document*);637 void setDocumentRecursively(Document*);638 639 634 virtual void willMoveToNewOwnerDocument(); 640 635 virtual void didMoveToNewOwnerDocument(); … … 650 645 651 646 private: 647 // Do not use this method to change the document of a node until after the node has been 648 // removed from its previous document. 649 void setDocumentRecursively(Document*); 650 void setDocument(Document*); 651 652 652 enum EditableLevel { Editable, RichlyEditable }; 653 653 bool rendererIsEditable(EditableLevel) const; -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r85373 r85650 469 469 if (!data->nodeLists()) { 470 470 data->setNodeLists(NodeListsNodeData::create()); 471 document()->addNodeListCache();471 treeScope()->addNodeListCache(); 472 472 } 473 473
Note: See TracChangeset
for help on using the changeset viewer.