[webkit-changes] cvs commit: WebCore/khtml/xml dom_nodeimpl.cpp
Vicki
vicki at opensource.apple.com
Tue Oct 25 13:49:39 PDT 2005
vicki 05/10/25 13:49:38
Modified: . ChangeLog
khtml/xml dom_nodeimpl.cpp
Log:
Reviewed by Hyatt.
- fix <rdar://problem/4288276> DOM tests expect hierarchy exception adding wrong types of nodes to parents (4568)
Check that the node being added is an allowable child. If inserting a document fragment node, check each child of
the node. Fixes 4 of the W3C DOM HTML tests and 11 of the XHTML tests.
* khtml/xml/dom_nodeimpl.cpp:
(DOM::NodeImpl::checkAddChild):
Revision Changes Path
1.283 +12 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.282
retrieving revision 1.283
diff -u -r1.282 -r1.283
--- ChangeLog 25 Oct 2005 16:39:23 -0000 1.282
+++ ChangeLog 25 Oct 2005 20:49:28 -0000 1.283
@@ -1,3 +1,15 @@
+2005-10-25 Vicki Murley <vicki at apple.com>
+
+ Reviewed by Hyatt.
+
+ - fix <rdar://problem/4288276> DOM tests expect hierarchy exception adding wrong types of nodes to parents (4568)
+
+ Check that the node being added is an allowable child. If inserting a document fragment node, check each child of
+ the node. Fixes 4 of the W3C DOM HTML tests and 11 of the XHTML tests.
+
+ * khtml/xml/dom_nodeimpl.cpp:
+ (DOM::NodeImpl::checkAddChild):
+
2005-10-25 Darin Adler <darin at apple.com>
Reviewed by Dave Hyatt.
1.203 +16 -1 WebCore/khtml/xml/dom_nodeimpl.cpp
Index: dom_nodeimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -r1.202 -r1.203
--- dom_nodeimpl.cpp 25 Oct 2005 16:39:25 -0000 1.202
+++ dom_nodeimpl.cpp 25 Oct 2005 20:49:35 -0000 1.203
@@ -1141,7 +1141,22 @@
exceptioncode = DOMException::HIERARCHY_REQUEST_ERR;
return;
}
-
+
+ if (newChild->nodeType() != Node::DOCUMENT_FRAGMENT_NODE) {
+ if (!childTypeAllowed(newChild->nodeType())) {
+ exceptioncode = DOMException::HIERARCHY_REQUEST_ERR;
+ return;
+ }
+ }
+ else {
+ for (NodeImpl *n = newChild->firstChild(); n; n = n->nextSibling()) {
+ if (!childTypeAllowed(n->nodeType())) {
+ exceptioncode = DOMException::HIERARCHY_REQUEST_ERR;
+ return;
+ }
+ }
+ }
+
// change the document pointer of newChild and all of its children to be the new document
if (shouldAdoptChild) {
for (NodeImpl* node = newChild; node; node = node->traverseNextNode(newChild)) {
More information about the webkit-changes
mailing list