CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/10/18 09:07:18
Modified files: . : ChangeLog server : edit_text_character.cpp edit_text_character.h testsuite/actionscript.all: TextField.as Log message: * server/edit_text_character.{cpp,h}: add initial support for TextField.selectable * testsuite/actionscript.all/TextField.as: update expected results. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4626&r2=1.4627 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.124&r2=1.125 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.54&r2=1.55 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.27&r2=1.28 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4626 retrieving revision 1.4627 diff -u -b -r1.4626 -r1.4627 --- ChangeLog 18 Oct 2007 09:06:24 -0000 1.4626 +++ ChangeLog 18 Oct 2007 09:07:17 -0000 1.4627 @@ -1,3 +1,10 @@ +2007-10-17 Sandro Santilli <[EMAIL PROTECTED]> + + * server/edit_text_character.{cpp,h}: add initial support for + TextField.selectable + * testsuite/actionscript.all/TextField.as: update expected + results. + 2007-10-17 Bastiaan Jacques <[EMAIL PROTECTED]> * backend/render_handler_cairo.cpp: New Cairo implementation. Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.124 retrieving revision 1.125 diff -u -b -r1.124 -r1.125 --- server/edit_text_character.cpp 17 Oct 2007 05:41:35 -0000 1.124 +++ server/edit_text_character.cpp 18 Oct 2007 09:07:18 -0000 1.125 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.124 2007/10/17 05:41:35 strk Exp $ */ +/* $Id: edit_text_character.cpp,v 1.125 2007/10/18 09:07:18 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -86,6 +86,7 @@ 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); +static as_value textfield_selectable_getset(const fn_call& fn); // @@ -339,6 +340,8 @@ o.init_property("wordWrap", *getset, *getset); getset = new builtin_function(textfield_html_getset); o.init_property("html", *getset, *getset); + getset = new builtin_function(textfield_selectable_getset); + o.init_property("selectable", *getset, *getset); // Target seems to not be a normal property getset = new builtin_function(&character::target_getset, NULL); @@ -416,6 +419,7 @@ _embedFonts(m_def->getUseEmbeddedGlyphs()), _wordWrap(m_def->do_word_wrap()), _html(m_def->htmlAllowed()), + _selectable(!m_def->get_no_select()), _autoSize(autoSizeNone), _bounds(m_def->get_bounds().getRange()) { @@ -1951,6 +1955,23 @@ } static as_value +textfield_selectable_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->isSelectable()); + } + else // setter + { + ptr->setSelectable( 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.54 retrieving revision 1.55 diff -u -b -r1.54 -r1.55 --- server/edit_text_character.h 17 Oct 2007 05:41:35 -0000 1.54 +++ server/edit_text_character.h 18 Oct 2007 09:07:18 -0000 1.55 @@ -70,7 +70,7 @@ ~edit_text_character(); - // TODO: should this return !m_def->get_no_select() ? + // TODO: should this return isSelectable() ? bool can_handle_mouse_event() const { return true; } character* get_topmost_mouse_entity(float x, float y); @@ -258,6 +258,19 @@ _html = on; } + /// Return true if the TextField text is selectable + bool isSelectable() const + { + return _selectable; + } + + /// Set 'selectable' parameter + void setSelectable(bool v) + { + _selectable = v; + } + + private: /// Call this function when willing to invoke the onChanged event handler @@ -372,6 +385,8 @@ bool _html; + bool _selectable; + AutoSizeValue _autoSize; /// Area in which the text is drawn. Index: testsuite/actionscript.all/TextField.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v retrieving revision 1.27 retrieving revision 1.28 diff -u -b -r1.27 -r1.28 --- testsuite/actionscript.all/TextField.as 29 Sep 2007 16:22:58 -0000 1.27 +++ testsuite/actionscript.all/TextField.as 18 Oct 2007 09:07:18 -0000 1.28 @@ -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.27 2007/09/29 16:22:58 strk Exp $"; +rcsid="$Id: TextField.as,v 1.28 2007/10/18 09:07:18 strk Exp $"; #include "check.as" @@ -65,7 +65,7 @@ check( !TextField.prototype.hasOwnProperty('password') ); check( !TextField.prototype.hasOwnProperty('restrict') ); check( !TextField.prototype.hasOwnProperty('scroll') ); -check( !TextField.prototype.hasOwnProperty('selectable') ); +xcheck( !TextField.prototype.hasOwnProperty('selectable') ); check( !TextField.prototype.hasOwnProperty('text') ); xcheck( !TextField.prototype.hasOwnProperty('textColor') ); check( !TextField.prototype.hasOwnProperty('textHeight') ); @@ -134,7 +134,7 @@ xcheck( TextField.prototype.hasOwnProperty('password') ); xcheck( TextField.prototype.hasOwnProperty('restrict') ); xcheck( TextField.prototype.hasOwnProperty('scroll') ); -xcheck( TextField.prototype.hasOwnProperty('selectable') ); +check( TextField.prototype.hasOwnProperty('selectable') ); xcheck( TextField.prototype.hasOwnProperty('text') ); check( TextField.prototype.hasOwnProperty('textColor') ); xcheck( TextField.prototype.hasOwnProperty('textHeight') ); @@ -427,11 +427,13 @@ // Check TextField.selectable -xcheck_equals(typeof(tf.selectable), 'boolean'); +check_equals(typeof(tf.selectable), 'boolean'); check( ! tf.hasOwnProperty('selectable') ); -xcheck_equals(tf.selectable, true); +check_equals(tf.selectable, true); tf.selectable = false; check_equals(tf.selectable, false); +tf.selectable = "Hello"; +check_equals(typeof(tf.selectable), 'boolean'); tf.selectable = true; // Check TextField._soundbuftime _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit