Changeset 80696 in webkit
- Timestamp:
- Mar 10, 2011 12:33:11 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80692 r80696 1 2011-03-10 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Able to move nodes across documents 6 https://bugs.webkit.org/show_bug.cgi?id=19524 7 8 Makes cross-document appendChild, insertBefore, Range.insertNode and Range.surroundContents work. 9 This matches Gecko and the new Dom Core spec. There are a number of Range methods where we don't 10 match Gecko or the spec that will need to be updated in a following patch. 11 12 * dom/html/level1/core/hc_elementwrongdocumenterr-expected.txt: 13 * dom/html/level1/core/hc_namednodemapwrongdocumenterr-expected.txt: 14 * dom/xhtml/level1/core/hc_elementwrongdocumenterr-expected.txt: 15 * dom/xhtml/level1/core/hc_namednodemapwrongdocumenterr-expected.txt: 16 * fast/dom/move-nodes-across-documents-expected.txt: Added. 17 * fast/dom/move-nodes-across-documents.html: Added. 18 1 19 2011-03-09 Roland Steiner <rolandsteiner@chromium.org> 2 20 -
trunk/LayoutTests/dom/html/level1/core/hc_elementwrongdocumenterr-expected.txt
r11962 r80696 1 Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr 2 Status: Success 1 Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr 2 Status: failure 3 Detail: throw_WRONG_DOCUMENT_ERR: assertTrue failed -
trunk/LayoutTests/dom/html/level1/core/hc_namednodemapwrongdocumenterr-expected.txt
r11962 r80696 1 Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr 2 Status: Success 1 Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr 2 Status: failure 3 Detail: throw_WRONG_DOCUMENT_ERR: assertTrue failed -
trunk/LayoutTests/dom/xhtml/level1/core/hc_elementwrongdocumenterr-expected.txt
r11962 r80696 1 1 Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr 2 Status Success 2 Status failure 3 Message throw_WRONG_DOCUMENT_ERR: assertTrue failed -
trunk/LayoutTests/dom/xhtml/level1/core/hc_namednodemapwrongdocumenterr-expected.txt
r11962 r80696 1 1 Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr 2 Status Success 2 Status failure 3 Message throw_WRONG_DOCUMENT_ERR: assertTrue failed -
trunk/Source/WebCore/ChangeLog
r80695 r80696 1 2011-03-10 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Able to move nodes across documents 6 https://bugs.webkit.org/show_bug.cgi?id=19524 7 8 Makes cross-document appendChild, insertBefore, Range.insertNode and Range.surroundContents work. 9 This matches Gecko and the new Dom Core spec. There are a number of Range methods where we don't 10 match Gecko or the spec that will need to be updated in a following patch. 11 12 Test: fast/dom/move-nodes-across-documents.html 13 14 * dom/Element.cpp: 15 (WebCore::Element::removeAttributeNode): 16 * dom/NamedNodeMap.cpp: 17 (WebCore::NamedNodeMap::setNamedItem): 18 * dom/Node.cpp: 19 (WebCore::Node::setDocumentRecursively): 20 (WebCore::checkAcceptChild): 21 (WebCore::Node::checkReplaceChild): 22 * dom/Range.cpp: 23 (WebCore::Range::insertNode): 24 (WebCore::Range::surroundContents): 25 1 26 2011-03-09 Antti Koivisto <antti@apple.com> 2 27 -
trunk/Source/WebCore/dom/Element.cpp
r80412 r80696 1398 1398 return 0; 1399 1399 } 1400 if (document() != attr->document()) { 1401 ec = WRONG_DOCUMENT_ERR; 1402 return 0; 1403 } 1400 1401 ASSERT(document() == attr->document()); 1404 1402 1405 1403 NamedNodeMap* attrs = attributes(true); -
trunk/Source/WebCore/dom/NamedNodeMap.cpp
r77019 r80696 101 101 } 102 102 103 // WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.104 if (arg->document() != m_element->document()) {105 ec = WRONG_DOCUMENT_ERR;106 return 0;107 }108 109 103 // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node 110 104 if (!arg->isAttributeNode()) { -
trunk/Source/WebCore/dom/Node.cpp
r80487 r80696 760 760 void Node::setDocumentRecursively(Document* document) 761 761 { 762 // FIXME: To match Gecko, we should do this for nodes that are already in the document as well. 763 if (this->document() == document || this->inDocument()) 762 if (this->document() == document) 764 763 return; 765 764 … … 1143 1142 static void checkAcceptChild(Node* newParent, Node* newChild, ExceptionCode& ec) 1144 1143 { 1145 // Perform error checking as required by spec for adding a new child. Used by replaceChild().1146 1147 1144 // Not mentioned in spec: throw NOT_FOUND_ERR if newChild is null 1148 1145 if (!newChild) { … … 1151 1148 } 1152 1149 1153 // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly1154 1150 if (newParent->isReadOnlyNode()) { 1155 1151 ec = NO_MODIFICATION_ALLOWED_ERR; 1156 1152 return; 1157 1153 } 1158 1159 // WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that 1160 // created this node. 1161 // We assume that if newChild is a DocumentFragment, all children are created from the same document 1162 // as the fragment itself (otherwise they could not have been added as children) 1163 if (newChild->document() != newParent->document() && newChild->inDocument()) { 1164 // but if the child is not in a document yet then loosen the 1165 // restriction, so that e.g. creating an element with the Option() 1166 // constructor and then adding it to a different document works, 1167 // as it does in Mozilla and Mac IE. 1168 ec = WRONG_DOCUMENT_ERR; 1169 return; 1170 } 1171 1154 1155 if (newChild->inDocument() && newChild->nodeType() == Node::DOCUMENT_TYPE_NODE) { 1156 ec = HIERARCHY_REQUEST_ERR; 1157 return; 1158 } 1159 1172 1160 // HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the 1173 1161 // newChild node, or if the node to append is one of this node's ancestors. 1174 1162 1175 // check for ancestor/same node1176 1163 if (newChild == newParent || newParent->isDescendantOf(newChild)) { 1177 1164 ec = HIERARCHY_REQUEST_ERR; … … 1182 1169 void Node::checkReplaceChild(Node* newChild, Node* oldChild, ExceptionCode& ec) 1183 1170 { 1171 if (!oldChild) { 1172 ec = NOT_FOUND_ERR; 1173 return; 1174 } 1175 1184 1176 checkAcceptChild(this, newChild, ec); 1185 1177 if (ec) -
trunk/Source/WebCore/dom/Range.cpp
r80408 r80696 930 930 if (containedByReadOnly()) { 931 931 ec = NO_MODIFICATION_ALLOWED_ERR; 932 return;933 }934 935 // WRONG_DOCUMENT_ERR: Raised if newParent and the container of the start of the Range were936 // not created from the same document.937 if (newNode->document() != m_start.container()->document()) {938 ec = WRONG_DOCUMENT_ERR;939 932 return; 940 933 } … … 1424 1417 } 1425 1418 1426 // WRONG_DOCUMENT_ERR: Raised if newParent and the container of the start of the Range were1427 // not created from the same document.1428 if (newParent->document() != m_start.container()->document()) {1429 ec = WRONG_DOCUMENT_ERR;1430 return;1431 }1432 1433 1419 // Raise a HIERARCHY_REQUEST_ERR if m_start.container() doesn't accept children like newParent. 1434 1420 Node* parentOfNewParent = m_start.container();
Note: See TracChangeset
for help on using the changeset viewer.