gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/asobj/xml.cpp server/aso...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/xml.cpp server/aso...
Date: Sat, 07 Apr 2007 15:27:16 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/07 15:27:16

Modified files:
        .              : ChangeLog 
        server/asobj   : xml.cpp xmlnode.cpp xmlnode.h 
        testsuite/actionscript.all: XML.as 

Log message:
                * server/asobj/xml.cpp (extractNode, parseDoc): properly setup
                  the node parent.
                * server/asobj/xmlnode.{cpp,h}: keep parent by intrusive_ptr.
                * testsuite/actionscript.all/XML.as: add tests for
                  nextSibling and previousSibling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2808&r2=1.2809
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlnode.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlnode.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/XML.as?cvsroot=gnash&r1=1.24&r2=1.25

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2808
retrieving revision 1.2809
diff -u -b -r1.2808 -r1.2809
--- ChangeLog   7 Apr 2007 12:50:04 -0000       1.2808
+++ ChangeLog   7 Apr 2007 15:27:16 -0000       1.2809
@@ -1,3 +1,11 @@
+2007-04-07 Sandro Santilli <address@hidden>
+
+       * server/asobj/xml.cpp (extractNode, parseDoc): properly setup
+         the node parent.
+       * server/asobj/xmlnode.{cpp,h}: keep parent by intrusive_ptr.
+       * testsuite/actionscript.all/XML.as: add tests for
+         nextSibling and previousSibling
+
 2007-04-07 Tomas Groth Christensen <address@hidden>
 
        * server/asobj/NetStream{Ffmpeg,Gst}.cpp: Use the m_imageframe's

Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- server/asobj/xml.cpp        4 Apr 2007 20:30:45 -0000       1.35
+++ server/asobj/xml.cpp        7 Apr 2007 15:27:16 -0000       1.36
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: xml.cpp,v 1.35 2007/04/04 20:30:45 bjacques Exp $ */
+/* $Id: xml.cpp,v 1.36 2007/04/07 15:27:16 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -274,7 +274,7 @@
                 {
                     if (node->content)
                     {
-                        log_msg("extractChildNode from text for %s has 
contents %s\n", node->name, ptr);
+                        //log_msg("extractChildNode from text for %s has 
contents '%s'", node->name, ptr);
                         std::string val(reinterpret_cast<const char*>(ptr));
                         element.nodeValueSet(val);
                     }
@@ -289,11 +289,11 @@
     while (childnode)
     {
         child = new XMLNode();
+        child->setParent(&element);
         extractNode(*child, childnode, mem);
         element._children.push_back(child);
         childnode = childnode->next;
     }
-
 }
 
 // Read in an XML document from the specified source
@@ -314,6 +314,7 @@
     if (cur != NULL)
     {
         boost::intrusive_ptr<XMLNode> child = new XMLNode();
+        child->setParent(this);
         extractNode(*child, cur, mem);
         _children.push_back(child);
     }  

Index: server/asobj/xmlnode.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlnode.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/asobj/xmlnode.cpp    4 Apr 2007 15:47:22 -0000       1.26
+++ server/asobj/xmlnode.cpp    7 Apr 2007 15:27:16 -0000       1.27
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: xmlnode.cpp,v 1.26 2007/04/04 15:47:22 strk Exp $ */
+/* $Id: xmlnode.cpp,v 1.27 2007/04/07 15:27:16 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -129,7 +129,7 @@
 bool
 XMLNode::hasChildNodes()
 {
-    GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
     if (_children.size()) {
        return true;
     }
@@ -147,7 +147,7 @@
 boost::intrusive_ptr<XMLNode>
 XMLNode::lastChild()
 {
-       GNASH_REPORT_FUNCTION;
+       //GNASH_REPORT_FUNCTION;
        if ( _children.empty() )
        {
                        log_msg("XMLNode %p has no childrens", (void*)this);
@@ -203,7 +203,7 @@
 XMLNode *
 XMLNode::previousSibling()
 {
-    GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
 
     if ( ! _parent) return NULL;
        if (_parent->_children.size() <= 1) return NULL;
@@ -226,10 +226,18 @@
 XMLNode *
 XMLNode::nextSibling()
 {
-    GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
 
-    if ( ! _parent) return NULL;
-       if (_parent->_children.size() <= 1) return NULL;
+    if ( ! _parent)
+    {
+            //log_msg("Node %p has no parent, returning NULL", this);
+            return NULL;
+    }
+    if (_parent->_children.size() <= 1)
+    {
+            //log_msg("Node %p parent has only this node, returning NULL", 
this);
+            return NULL;
+    }
 
     XMLNode *previous_node = NULL;
     ChildList::reverse_iterator itx;
@@ -237,7 +245,7 @@
     {
         if (itx->get() == this)
         {
-            // log_msg("Found the next XMLNode child !!!! %s <%p>\n", 
(*itx)->nodeName(), (void*)*itx);
+            //log_msg("Found the next XMLNode child !!!! %s <%p>", 
(*itx)->nodeName().c_str(), (void*)itx->get());
                    return previous_node;
                }
                previous_node = itx->get();
@@ -618,7 +626,7 @@
 static as_value
 xmlnode_lastchild(const fn_call& fn)
 {
-    GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     as_value rv;
     rv.set_null();
@@ -641,7 +649,7 @@
 static as_value
 xmlnode_nextsibling(const fn_call& fn)
 {
-    GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
     as_value rv;
     rv.set_null();
 
@@ -665,7 +673,7 @@
 static as_value
 xmlnode_previoussibling(const fn_call& fn)
 {
-    GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
     as_value rv;
     rv.set_null();
 

Index: server/asobj/xmlnode.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlnode.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/asobj/xmlnode.h      4 Apr 2007 15:47:22 -0000       1.10
+++ server/asobj/xmlnode.h      7 Apr 2007 15:27:16 -0000       1.11
@@ -199,7 +199,7 @@
     void appendChild(boost::intrusive_ptr<XMLNode> childNode);
 
     void setParent(XMLNode *node) { _parent = node; };
-    XMLNode *getParent() { return _parent; };
+    XMLNode *getParent() { return _parent.get(); };
 
     /// Insert a node before a node
     //
@@ -219,7 +219,7 @@
 
     void  change_stack_frame(int frame, gnash::as_object *xml, 
gnash::as_environment *env);
 
-    XMLNode            *_parent;
+    boost::intrusive_ptr<XMLNode> _parent;
     ChildList          _children;
     AttribList      _attributes;
 

Index: testsuite/actionscript.all/XML.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/XML.as,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- testsuite/actionscript.all/XML.as   4 Apr 2007 15:47:22 -0000       1.24
+++ testsuite/actionscript.all/XML.as   7 Apr 2007 15:27:16 -0000       1.25
@@ -20,7 +20,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: XML.as,v 1.24 2007/04/04 15:47:22 strk Exp $";
+rcsid="$Id: XML.as,v 1.25 2007/04/07 15:27:16 strk Exp $";
 
 #include "dejagnu.as"
 #include "utils.as"
@@ -260,6 +260,8 @@
        {
                check_equals(nodeName, 'TOPNODE');
                check_equals(typeof(nodeValue), 'null');
+               check_equals(typeof(nextSibling), 'null');
+               check_equals(typeof(previousSibling), 'null');
 
                // Check that nodeValue is overridable
                nodeValue = 4;
@@ -273,6 +275,11 @@
                {
                        check_equals(nodeName, 'SUBNODE1');
                        check_equals(typeof(nodeValue), 'null');
+
+                       check_equals(typeof(nextSibling), 'object');
+                       check_equals(nextSibling.nodeName, 'SUBNODE2');
+                       check_equals(typeof(previousSibling), 'null');
+
                        check_equals(nodeType, 1); // element
                        check_equals(childNodes.length, 2);
                        with (firstChild)
@@ -280,6 +287,9 @@
                                check_equals(nodeName, 'SUBSUBNODE1');
                                check_equals(typeof(nodeValue), 'null');
                                check_equals(nodeType, 1); // element
+                               check_equals(typeof(nextSibling), 'object');
+                               check_equals(nextSibling.nodeName, 
'SUBSUBNODE2');
+                               check_equals(typeof(previousSibling), 'null');
                                check_equals(childNodes.length, 1);
                                with (firstChild)
                                {
@@ -293,6 +303,9 @@
                                check_equals(nodeName, 'SUBSUBNODE2');
                                check_equals(typeof(nodeValue), 'null');
                                check_equals(nodeType, 1); // element
+                               check_equals(typeof(nextSibling), 'null');
+                               check_equals(typeof(previousSibling), 'object');
+                               check_equals(previousSibling.nodeName, 
'SUBSUBNODE1');
                                check_equals(childNodes.length, 1);
                                with (firstChild)
                                {
@@ -308,6 +321,11 @@
                        check_equals(nodeName, 'SUBNODE2');
                        check_equals(typeof(nodeValue), 'null');
                        check_equals(nodeType, 1); // element
+
+                       check_equals(typeof(nextSibling), 'null');
+                       check_equals(typeof(previousSibling), 'object');
+                       check_equals(previousSibling.nodeName, 'SUBNODE1');
+
                        check_equals(childNodes.length, 2);
                        with (firstChild)
                        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]