Changeset 137535 in webkit
- Timestamp:
- Dec 12, 2012 4:32:18 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r137534 r137535 1 2012-12-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r137524. 4 http://trac.webkit.org/changeset/137524 5 https://bugs.webkit.org/show_bug.cgi?id=104859 6 7 Causes m_deletionHasBegun assertion failures in 8 MutationObserver tests (Requested by aklein on #webkit). 9 10 * dom/Document.cpp: 11 (WebCore::Document::Document): 12 (WebCore::Document::~Document): 13 (WebCore::Document::suggestedMIMEType): 14 * dom/Document.h: 15 (WebCore::Node::isDocumentNode): 16 (WebCore): 17 (WebCore::Node::treeScope): 18 (WebCore::Node::Node): 19 * dom/Element.cpp: 20 (WebCore::Element::createRareData): 21 * dom/ElementRareData.h: 22 (ElementRareData): 23 (WebCore::ElementRareData::ElementRareData): 24 * dom/Node.cpp: 25 (WebCore::Node::~Node): 26 (WebCore::Node::setDocument): 27 (WebCore): 28 (WebCore::Node::setTreeScope): 29 (WebCore::Node::createRareData): 30 (WebCore::Node::attach): 31 (WebCore::Node::reportMemoryUsage): 32 * dom/Node.h: 33 (WebCore): 34 (WebCore::NodeRareDataBase::treeScope): 35 (WebCore::NodeRareDataBase::setTreeScope): 36 (NodeRareDataBase): 37 (WebCore::NodeRareDataBase::NodeRareDataBase): 38 (Node): 39 (WebCore::Node::inDocument): 40 (WebCore::Node::documentInternal): 41 * dom/NodeRareData.cpp: 42 (SameSizeAsNodeRareData): 43 (WebCore::NodeRareData::reportMemoryUsage): 44 * dom/NodeRareData.h: 45 (WebCore::NodeRareData::NodeRareData): 46 * dom/ShadowRoot.cpp: 47 (WebCore::ShadowRoot::ShadowRoot): 48 * dom/TreeScope.cpp: 49 (SameSizeAsTreeScope): 50 (WebCore::TreeScope::TreeScope): 51 (WebCore::TreeScope::setParentTreeScope): 52 * dom/TreeScope.h: 53 (WebCore): 54 (TreeScope): 55 * dom/TreeScopeAdopter.cpp: 56 (WebCore::TreeScopeAdopter::moveTreeToNewScope): 57 (WebCore::TreeScopeAdopter::moveNodeToNewDocument): 58 1 59 2012-12-12 Seokju Kwon <seokju.kwon@gmail.com> 2 60 -
trunk/Source/WebCore/dom/Document.cpp
r137524 r137535 437 437 438 438 Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) 439 : ContainerNode( this, CreateDocument)439 : ContainerNode(0, CreateDocument) 440 440 , TreeScope(this) 441 441 , m_guardRefCount(0) … … 511 511 #endif 512 512 { 513 m_document = this; 514 513 515 m_printing = false; 514 516 m_paginatedForScreen = false; … … 667 669 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) 668 670 ASSERT(!m_nodeListCounts[i]); 671 672 m_document = 0; 669 673 670 674 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); … … 1342 1346 String Document::suggestedMIMEType() const 1343 1347 { 1344 if ( isXHTMLDocument())1348 if (m_document->isXHTMLDocument()) 1345 1349 return "application/xhtml+xml"; 1346 if ( isSVGDocument())1350 if (m_document->isSVGDocument()) 1347 1351 return "image/svg+xml"; 1348 if ( xmlStandalone())1352 if (m_document->xmlStandalone()) 1349 1353 return "text/xml"; 1350 if ( isHTMLDocument())1354 if (m_document->isHTMLDocument()) 1351 1355 return "text/html"; 1352 1356 -
trunk/Source/WebCore/dom/Document.h
r137524 r137535 1560 1560 inline bool Node::isDocumentNode() const 1561 1561 { 1562 return this == documentInternal(); 1562 return this == m_document; 1563 } 1564 1565 inline TreeScope* Node::treeScope() const 1566 { 1567 return hasRareData() ? m_data.m_rareData->treeScope() : documentInternal(); 1563 1568 } 1564 1569 1565 1570 inline Node::Node(Document* document, ConstructionType type) 1566 1571 : m_nodeFlags(type) 1567 , m_ treeScope(document)1572 , m_document(document) 1568 1573 , m_previous(0) 1569 1574 , m_next(0) … … 1571 1576 if (document) 1572 1577 document->guardRef(); 1573 else1574 m_treeScope = TreeScope::noDocumentInstance();1575 1576 1578 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) 1577 1579 trackForDebugging(); -
trunk/Source/WebCore/dom/Element.cpp
r137524 r137535 218 218 PassOwnPtr<NodeRareData> Element::createRareData() 219 219 { 220 return adoptPtr(new ElementRareData( ));220 return adoptPtr(new ElementRareData(documentInternal())); 221 221 } 222 222 -
trunk/Source/WebCore/dom/ElementRareData.h
r137524 r137535 36 36 class ElementRareData : public NodeRareData { 37 37 public: 38 ElementRareData( );38 ElementRareData(Document*); 39 39 virtual ~ElementRareData(); 40 40 … … 131 131 } 132 132 133 inline ElementRareData::ElementRareData() 134 : m_minimumSizeForResizing(defaultMinimumSizeForResizing()) 133 inline ElementRareData::ElementRareData(Document* document) 134 : NodeRareData(document) 135 , m_minimumSizeForResizing(defaultMinimumSizeForResizing()) 135 136 , m_generatedBefore(0) 136 137 , m_generatedAfter(0) -
trunk/Source/WebCore/dom/Node.cpp
r137524 r137535 419 419 detach(); 420 420 421 Document* doc = documentInternal();421 Document* doc = m_document; 422 422 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists() && !isContainerNode()) 423 423 doc->axObjectCache()->remove(this); … … 432 432 433 433 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); 434 } 435 436 void Node::setDocument(Document* document) 437 { 438 ASSERT(!inDocument() || m_document == document); 439 if (inDocument() || m_document == document) 440 return; 441 442 m_document = document; 443 } 444 445 void Node::setTreeScope(TreeScope* scope) 446 { 447 if (!hasRareData() && scope->rootNode()->isDocumentNode()) 448 return; 449 450 ensureRareData()->setTreeScope(scope); 434 451 } 435 452 … … 455 472 PassOwnPtr<NodeRareData> Node::createRareData() 456 473 { 457 return adoptPtr(new NodeRareData( ));474 return adoptPtr(new NodeRareData(documentInternal())); 458 475 } 459 476 … … 1066 1083 clearNeedsStyleRecalc(); 1067 1084 1068 Document* doc = documentInternal();1085 Document* doc = m_document; 1069 1086 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists()) 1070 1087 doc->axObjectCache()->updateCacheAfterNodeIsAttached(this); … … 2583 2600 TreeShared<Node, ContainerNode>::reportMemoryUsage(memoryObjectInfo); 2584 2601 ScriptWrappable::reportMemoryUsage(memoryObjectInfo); 2585 info.addMember(m_ treeScope);2602 info.addMember(m_document); 2586 2603 info.addMember(m_next); 2587 2604 info.addMember(m_previous); -
trunk/Source/WebCore/dom/Node.h
r137524 r137535 34 34 #include "ScriptWrappable.h" 35 35 #include "SimulatedClickOptions.h" 36 #include "TreeScope.h"37 36 #include "TreeShared.h" 38 37 #include <wtf/Forward.h> … … 87 86 class ShadowRoot; 88 87 class TagNodeList; 88 class TreeScope; 89 89 90 90 #if ENABLE(GESTURE_EVENTS) … … 116 116 void setRenderer(RenderObject* renderer) { m_renderer = renderer; } 117 117 118 TreeScope* treeScope() const { return m_treeScope; } 119 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } 120 118 121 virtual ~NodeRareDataBase() { } 119 122 protected: 120 NodeRareDataBase() { } 123 NodeRareDataBase(TreeScope* scope) 124 : m_treeScope(scope) 125 { 126 } 121 127 private: 122 128 RenderObject* m_renderer; 129 TreeScope* m_treeScope; 123 130 }; 124 131 … … 453 460 } 454 461 455 TreeScope* treeScope() const { return m_treeScope; }462 TreeScope* treeScope() const; 456 463 457 464 // Returns true if this node is associated with a document and is in its associated document's … … 459 466 bool inDocument() const 460 467 { 461 ASSERT( documentInternal()|| !getFlag(InDocumentFlag));468 ASSERT(m_document || !getFlag(InDocumentFlag)); 462 469 return getFlag(InDocumentFlag); 463 470 } … … 750 757 void setHasCustomCallbacks() { setFlag(true, HasCustomCallbacksFlag); } 751 758 752 Document* documentInternal() const { return treeScope()->documentScope(); } 753 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } 759 Document* documentInternal() const { return m_document; } 754 760 755 761 private: … … 757 763 758 764 void removedLastRef(); 765 766 // These API should be only used for a tree scope migration. 767 void setTreeScope(TreeScope*); 768 void setDocument(Document*); 759 769 760 770 enum EditableLevel { Editable, RichlyEditable }; … … 800 810 801 811 mutable uint32_t m_nodeFlags; 802 TreeScope* m_treeScope;812 Document* m_document; 803 813 Node* m_previous; 804 814 Node* m_next; -
trunk/Source/WebCore/dom/NodeRareData.cpp
r137524 r137535 40 40 41 41 struct SameSizeAsNodeRareData { 42 void* m_pointer[ 3];42 void* m_pointer[4]; 43 43 unsigned m_indicesAndBitfields[2]; 44 44 … … 65 65 { 66 66 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); 67 info.addMember(treeScope()); 67 68 info.addMember(m_nodeLists); 68 69 -
trunk/Source/WebCore/dom/NodeRareData.h
r137524 r137535 247 247 248 248 public: 249 NodeRareData() 250 : m_tabIndex(0) 249 NodeRareData(Document* document) 250 : NodeRareDataBase(document) 251 , m_tabIndex(0) 251 252 , m_childIndex(0) 252 253 , m_tabIndexWasSetExplicitly(false) -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r137524 r137535 66 66 ShadowRoot::ShadowRoot(Document* document) 67 67 : DocumentFragment(document, CreateShadowRoot) 68 , TreeScope(this , document)68 , TreeScope(this) 69 69 , m_prev(0) 70 70 , m_next(0) … … 76 76 { 77 77 ASSERT(document); 78 setTreeScope(this); 78 79 // Assume document as parent scope. 80 setParentTreeScope(document); 81 // Shadow tree scopes have the scope pointer point to themselves. 82 // This way, direct children will receive the correct scope pointer. 83 ensureRareData()->setTreeScope(this); 79 84 } 80 85 -
trunk/Source/WebCore/dom/TreeScope.cpp
r137524 r137535 56 56 struct SameSizeAsTreeScope { 57 57 virtual ~SameSizeAsTreeScope(); 58 void* pointers[ 8];58 void* pointers[7]; 59 59 }; 60 60 … … 63 63 using namespace HTMLNames; 64 64 65 TreeScope::TreeScope(ContainerNode* rootNode , Document* document)65 TreeScope::TreeScope(ContainerNode* rootNode) 66 66 : m_rootNode(rootNode) 67 , m_documentScope(document)68 , m_parentTreeScope(document)69 , m_idTargetObserverRegistry(IdTargetObserverRegistry::create())70 {71 ASSERT(rootNode);72 ASSERT(document);73 ASSERT(rootNode != document);74 }75 76 TreeScope::TreeScope(Document* document)77 : m_rootNode(document)78 , m_documentScope(document)79 67 , m_parentTreeScope(0) 80 68 , m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) 81 69 { 82 ASSERT(document); 83 } 84 85 TreeScope::TreeScope() 86 : m_rootNode(0) 87 , m_documentScope(0) 88 , m_parentTreeScope(0) 89 { 70 ASSERT(rootNode); 90 71 } 91 72 … … 113 94 114 95 m_parentTreeScope = newParentScope; 115 setDocumentScope(newParentScope->documentScope());116 96 } 117 97 -
trunk/Source/WebCore/dom/TreeScope.h
r137524 r137535 36 36 class ContainerNode; 37 37 class DOMSelection; 38 class Document;39 38 class Element; 40 39 class HTMLLabelElement; … … 48 47 class TreeScope { 49 48 friend class Document; 50 friend class TreeScopeAdopter;51 49 52 50 public: … … 60 58 void addElementById(const AtomicString& elementId, Element*); 61 59 void removeElementById(const AtomicString& elementId, Element*); 62 63 Document* documentScope() const { return m_documentScope; }64 60 65 61 Node* ancestorInThisScope(Node*) const; … … 96 92 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 97 93 98 static TreeScope* noDocumentInstance()99 {100 DEFINE_STATIC_LOCAL(TreeScope, instance, ());101 return &instance;102 }103 104 94 protected: 105 TreeScope(ContainerNode*, Document*); 106 TreeScope(Document*); 95 explicit TreeScope(ContainerNode*); 107 96 virtual ~TreeScope(); 108 97 109 98 void destroyTreeScopeData(); 110 void setDocumentScope(Document* document)111 {112 ASSERT(document);113 ASSERT(this != noDocumentInstance());114 m_documentScope = document;115 }116 99 117 100 private: 118 TreeScope();119 120 101 ContainerNode* m_rootNode; 121 Document* m_documentScope;122 102 TreeScope* m_parentTreeScope; 123 103 -
trunk/Source/WebCore/dom/TreeScopeAdopter.cpp
r137524 r137535 44 44 // of the document it was moved to. By increasing the DOMTreeVersion of the donating document here 45 45 // we ensure that the collection cache will be invalidated as needed when the element is moved back. 46 Document* oldDocument = m_oldScope ->documentScope();47 Document* newDocument = m_newScope-> documentScope();46 Document* oldDocument = m_oldScope ? m_oldScope->rootNode()->document() : 0; 47 Document* newDocument = m_newScope->rootNode()->document(); 48 48 bool willMoveToNewDocument = oldDocument != newDocument; 49 49 if (oldDocument && willMoveToNewDocument) … … 52 52 for (Node* node = root; node; node = NodeTraversal::next(node, root)) { 53 53 node->setTreeScope(m_newScope); 54 55 54 if (node->hasRareData()) { 56 55 NodeRareData* rareData = node->rareData(); … … 99 98 oldDocument->moveNodeIteratorsToNewDocument(node, newDocument); 100 99 101 if (node->isShadowRoot()) 102 toShadowRoot(node)->setDocumentScope(newDocument); 100 node->setDocument(newDocument); 103 101 104 102 #ifndef NDEBUG
Note: See TracChangeset
for help on using the changeset viewer.