[webkit-changes] cvs commit: WebCore/layout-tests/fast/dom replaceChild.html replaceChildHelper.html

Beth bdakin at opensource.apple.com
Tue Sep 20 16:38:52 PDT 2005


bdakin      05/09/20 16:38:52

  Modified:    .        ChangeLog
               khtml/xml dom_nodeimpl.cpp
  Added:       layout-tests/fast/dom replaceChild.html
                        replaceChildHelper.html
  Log:
  Bug #:
  Bug #:
  Bug #:
  
  Revision  Changes    Path
  1.141     +18 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.140
  retrieving revision 1.141
  diff -u -r1.140 -r1.141
  --- ChangeLog	20 Sep 2005 23:01:37 -0000	1.140
  +++ ChangeLog	20 Sep 2005 23:38:50 -0000	1.141
  @@ -1,3 +1,21 @@
  +2005-09-20  Beth Dakin  <bdakin at apple.com>
  +
  +        Reviewed by Hyatt
  +
  +        Test cases added: /fast/dom/replaceChild.html
  +
  +	This is a fix for <rdar://problem/4039660> crash replacing iframe 
  +	node with another node; test page posted on homepage.mac.com - nil 
  +	RenderArena. Basically the problem was that whenever a node was 
  +	passed to a new document, that node's document pointer was updated
  +	to the new document, but the document pointers of its children were not.
  +
  +        * khtml/xml/dom_nodeimpl.cpp: Simple loop that recurses through children
  +					changing their document pointers too.
  +        (DOM::NodeImpl::checkAddChild):
  +        * layout-tests/fast/dom/replaceChild.html: Added. New layout test.
  +        * layout-tests/fast/dom/replaceChildHelper.html: Added. Helps new layout test. 
  +
   2005-09-20  David Hyatt  <hyatt at apple.com>
   
   	Meant to land this ages ago.  Make radio buttons work dynamically
  
  
  
  1.191     +5 -3      WebCore/khtml/xml/dom_nodeimpl.cpp
  
  Index: dom_nodeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
  retrieving revision 1.190
  retrieving revision 1.191
  diff -u -r1.190 -r1.191
  --- dom_nodeimpl.cpp	20 Sep 2005 23:01:41 -0000	1.190
  +++ dom_nodeimpl.cpp	20 Sep 2005 23:38:51 -0000	1.191
  @@ -1138,10 +1138,12 @@
           return;
       }
   
  -    // only do this once we know there won't be an exception
  +    // change the document pointer of newChild and all of its children to be the new document
       if (shouldAdoptChild) {
  -	KJS::ScriptInterpreter::updateDOMNodeDocument(newChild, newChild->getDocument(), getDocument());
  -	newChild->setDocument(getDocument()->docPtr());
  +        for (NodeImpl* node = newChild; node; node = node->traverseNextNode()) {
  +            KJS::ScriptInterpreter::updateDOMNodeDocument(node, node->getDocument(), getDocument());
  +            node->setDocument(getDocument()->docPtr());
  +        }
       }
   }
   
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/replaceChild.html
  
  Index: replaceChild.html
  ===================================================================
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>main window</title>
<style type="text/css" media="screen">
	body{
		margin:0px;
		padding:0px;
		background-color:#CCFFCC;
	}
	iframe#menu_import{
		width: 150px;
		height:150px;
		border:1px solid #000;
	}
</style>
<script language="javascript" type="text/javascript">
	function loadMenu(m){
		var w = document.getElementById("menu_content_area");
		w.replaceChild(m, document.getElementById("menu_import"));
	}
</script>
</head>

<body>

	<div id="menu_content_area"><iframe src="replaceChildHelper.html" id="menu_import" name="menu_import" ></iframe></div>

</body>
</html>
  
  
  1.1                  WebCore/layout-tests/fast/dom/replaceChildHelper.html
  
  Index: replaceChildHelper.html
  ===================================================================
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>menu window</title>
<script language="javascript" type="text/javascript">
	function doLoad(){
		if(window.parent){
			var menu = document.getElementById("menu").cloneNode(true);
			parent.loadMenu(menu);
		}
	}
	window.onload = doLoad;
</script>
</head>
	<div id="menu">
		<div>test 1</div>
		<div>test 2</div>
	</div>
<body>
</body>
</html>
  
  



More information about the webkit-changes mailing list