gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...


From: Ivor Blockley
Subject: [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...
Date: Wed, 05 Sep 2007 16:47:55 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Ivor Blockley <meteoryte>       07/09/05 16:47:55

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp edit_text_character.h 
        server/vm      : action.cpp action.h 
        testsuite/actionscript.all: TextField.as 

Log message:
        * server/vm/action.{cpp,h}: add htmlText property to as_standard_member 
ENUM
        * server/edit_text_character.{cpp,h}: add html property and cleanup 
handling of htmlText (note: still just strips tags at the moment)
        * testsuite/actionscript.all/TextField.as: 5 new passes, 1 new failure

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4231&r2=1.4232
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.109&r2=1.110
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.22&r2=1.23

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4231
retrieving revision 1.4232
diff -u -b -r1.4231 -r1.4232
--- ChangeLog   5 Sep 2007 15:48:07 -0000       1.4231
+++ ChangeLog   5 Sep 2007 16:47:54 -0000       1.4232
@@ -1,3 +1,11 @@
+2007-09-05 Ivor Blockley <address@hidden>
+
+       * server/vm/action.{cpp,h}: add htmlText property to 
+       as_standard_member ENUM
+       * server/edit_text_character.{cpp,h}: add html property and cleanup
+       handling of htmlText (note: still just strips tags at the moment).
+       * testsuite/actionscript.all/TextField.as: 5 new passes, 1 new failure
+
 2007-09-05 Sandro Santilli <address@hidden>
 
        * server/dlist.{cpp,h}: also maintain a list of characters by

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -b -r1.109 -r1.110
--- server/edit_text_character.cpp      4 Sep 2007 19:33:08 -0000       1.109
+++ server/edit_text_character.cpp      5 Sep 2007 16:47:55 -0000       1.110
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: edit_text_character.cpp,v 1.109 2007/09/04 19:33:08 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.110 2007/09/05 16:47:55 meteoryte Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -84,6 +84,7 @@
 static as_value textfield_embedFonts_getset(const fn_call& fn);
 static as_value textfield_autoSize_getset(const fn_call& fn);
 static as_value textfield_wordWrap_getset(const fn_call& fn);
+static as_value textfield_html_getset(const fn_call& fn);
 
 
 //
@@ -333,7 +334,8 @@
        o.init_property("autoSize", *getset, *getset);
        getset = new builtin_function(textfield_wordWrap_getset);
        o.init_property("wordWrap", *getset, *getset);
-
+       getset = new builtin_function(textfield_html_getset);
+       o.init_property("html", *getset, *getset);
 
        if ( target_version  < 7 ) return;
 
@@ -398,6 +400,7 @@
        _textColor(m_def->get_text_color()),
        _embedFonts(m_def->getUseEmbeddedGlyphs()),
        _wordWrap(m_def->do_word_wrap()),
+       _html(m_def->htmlAllowed()),
        _autoSize(autoSizeNone),
        _bounds(m_def->get_bounds().getRange())
 {
@@ -739,33 +742,20 @@
        default:
                break;
        case M_INVALID_MEMBER:
+               break;
+       case M_TEXT:
+               //if (name == "text")
        {
-               if (name == PROPNAME("htmlText"))
-               {       // Minimal parsing of HTML: Strip all tags
                        int version = 
get_parent()->get_movie_definition()->get_version();
-                       std::string html = val.to_string_versioned(version);
-                       std::string textOnly = std::string();
-                       bool inTag = false;
-                       for (unsigned int i = 0; i < html.length(); ++i)
-                       {
-                               if (inTag)
-                               {
-                                       inTag = html[i] != '>';
-                               } else {
-                                       inTag = html[i] == '<';
-                                       if (!inTag) textOnly += html[i];
-                               }
-                       }
-                       set_text_value(textOnly.c_str());
+               set_text_value(val.to_string_versioned(version).c_str());
                        return;
                }
-               break;
-       }
-       case M_TEXT:
-               //if (name == "text")
+       case M_HTMLTEXT:
+               //if (name == "htmlText")
        {
                int version = 
get_parent()->get_movie_definition()->get_version();
                set_text_value(val.to_string_versioned(version).c_str());
+               format_text();
                return;
        }
        case M_X:
@@ -918,6 +908,12 @@
                val->set_string(get_text_value());
                return true;
        }
+       case M_HTMLTEXT:
+               //if (name == "htmlText")
+       {
+               val->set_string(get_text_value());
+               return true;
+       }
        case M_VISIBLE:
                //else if (name == "_visible")
        {
@@ -1171,7 +1167,7 @@
                        continue;
                }
 
-               if (code == '<' && htmlAllowed() )
+               if (code == '<' && _html )
                {
                        static bool warned = false;
                        if ( ! warned )
@@ -1806,6 +1802,23 @@
 }
 
 static as_value
+textfield_html_getset(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> ptr = 
ensureType<edit_text_character>(fn.this_ptr);
+
+       if ( fn.nargs == 0 ) // getter
+       {
+               return as_value(ptr->doHtml());
+       }
+       else // setter
+       {
+               ptr->setHtml( fn.arg(0).to_bool() );
+       }
+
+       return as_value();
+}
+
+static as_value
 textfield_autoSize_getset(const fn_call& fn)
 {
        boost::intrusive_ptr<edit_text_character> ptr = 
ensureType<edit_text_character>(fn.this_ptr);

Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- server/edit_text_character.h        30 Aug 2007 14:13:07 -0000      1.48
+++ server/edit_text_character.h        5 Sep 2007 16:47:55 -0000       1.49
@@ -229,15 +229,22 @@
        ///
        void setWordWrap(bool on);
 
-private:
+       /// \brief
+       /// Return true if HTML markup in text should be rendered.
+       ///
+       bool doHtml() const {
+               return _html;
+       }
 
-       /// Return true if HTML text is allowed 
+       /// Set html parameter
        //
-       /// TODO: use own flag for this, don't query the definition
-       ///       everytime. This will allow support for the
-       ///       ActionScript settable 'html' property.
-       ///       
-       bool htmlAllowed() const { return m_def->htmlAllowed(); }
+       /// @param on
+       ///     If true HTML tags in the text will be parsed and rendered
+       void setHtml(bool on) {
+               _html = on;
+       }
+
+private:
 
        /// The actual text
        std::string _text;
@@ -338,6 +345,8 @@
 
        bool _wordWrap;
 
+       bool _html;
+
        AutoSizeValue _autoSize;
 
        /// Area in which the text is drawn. 

Index: server/vm/action.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/action.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/vm/action.cpp        7 Jul 2007 03:37:29 -0000       1.23
+++ server/vm/action.cpp        5 Sep 2007 16:47:55 -0000       1.24
@@ -538,6 +538,7 @@
                membersMap["_ymouse"] = M_YMOUSE;
                membersMap["_parent"] = M_PARENT;
                membersMap["text"] = M_TEXT;
+               membersMap["htmlText"] = M_HTMLTEXT;
                membersMap["textWidth"] = M_TEXTWIDTH;
                membersMap["textColor"] = M_TEXTCOLOR;
                membersMap["onLoad"] = M_ONLOAD;

Index: server/vm/action.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/action.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/vm/action.h  3 Sep 2007 23:52:07 -0000       1.9
+++ server/vm/action.h  5 Sep 2007 16:47:55 -0000       1.10
@@ -133,6 +133,7 @@
                M_YMOUSE,
                M_PARENT,
                M_TEXT,
+               M_HTMLTEXT,
                M_TEXTWIDTH,
                M_TEXTCOLOR,
                M_ONLOAD,

Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- testsuite/actionscript.all/TextField.as     4 Sep 2007 19:33:09 -0000       
1.22
+++ testsuite/actionscript.all/TextField.as     5 Sep 2007 16:47:55 -0000       
1.23
@@ -19,7 +19,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: TextField.as,v 1.22 2007/09/04 19:33:09 strk Exp $";
+rcsid="$Id: TextField.as,v 1.23 2007/09/05 16:47:55 meteoryte Exp $";
 
 #include "check.as"
 
@@ -55,7 +55,7 @@
 check( !TextField.prototype.hasOwnProperty('bottomScroll') );
 xcheck( !TextField.prototype.hasOwnProperty('embedFonts') );
 check( !TextField.prototype.hasOwnProperty('hscroll') );
-check( !TextField.prototype.hasOwnProperty('html') );
+xcheck( !TextField.prototype.hasOwnProperty('html') );
 check( !TextField.prototype.hasOwnProperty('htmlText') );
 check( !TextField.prototype.hasOwnProperty('length') );
 check( !TextField.prototype.hasOwnProperty('maxChars') );
@@ -124,7 +124,7 @@
 xcheck( TextField.prototype.hasOwnProperty('bottomScroll') );
 check( TextField.prototype.hasOwnProperty('embedFonts') );
 xcheck( TextField.prototype.hasOwnProperty('hscroll') );
-xcheck( TextField.prototype.hasOwnProperty('html') );
+check( TextField.prototype.hasOwnProperty('html') );
 xcheck( TextField.prototype.hasOwnProperty('htmlText') );
 xcheck( TextField.prototype.hasOwnProperty('length') );
 xcheck( TextField.prototype.hasOwnProperty('maxChars') );
@@ -275,9 +275,9 @@
 
 // Check TextField.html
 
-xcheck_equals(typeof(tf.html), 'boolean');
+check_equals(typeof(tf.html), 'boolean');
 check(!tf.hasOwnProperty('html'));
-xcheck_equals(tf.html, false);
+check_equals(tf.html, false);
 tf.html = true;
 check_equals(tf.html, true);
 tf.html = false;
@@ -293,9 +293,9 @@
 check_equals(tf.html, false);
 tf.htmlText = "Hello <b>html</b> world";
 check_equals(tf.html, false); // assigning to htmlText doesn't change the 
'html' flag
-xcheck_equals(tf.htmlText, 'Hello <b>html</b> world'); // gnash fails by 
stripping the html tags
+check_equals(tf.htmlText, 'Hello <b>html</b> world');
 // Changing htmlText also changes text
-xcheck_equals(tf.text, 'Hello <b>html</b> world'); // gnash likely succeeds 
here, but strips html tags...
+check_equals(tf.text, 'Hello <b>html</b> world');
 tf.text = "Hello world";
 check_equals(tf.htmlText, 'Hello world');
 




reply via email to

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