CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/11/30 22:36:31
Modified files: . : ChangeLog server : edit_text_character.cpp testsuite/misc-mtasc.all: TextFieldTest.as Log message: reset bounds of TextFields when in autoSize mode. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5033&r2=1.5034 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.133&r2=1.134 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-mtasc.all/TextFieldTest.as?cvsroot=gnash&r1=1.1&r2=1.2 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5033 retrieving revision 1.5034 diff -u -b -r1.5033 -r1.5034 --- ChangeLog 30 Nov 2007 19:01:02 -0000 1.5033 +++ ChangeLog 30 Nov 2007 22:36:30 -0000 1.5034 @@ -1,5 +1,11 @@ 2007-11-30 Sandro Santilli <[EMAIL PROTECTED]> + * server/edit_text_character.cpp (format_text): reset bounds when in + autoSize mode. + * testsuite/misc-mtasc.all/TextFieldTest.as: success and a new test. + +2007-11-30 Sandro Santilli <[EMAIL PROTECTED]> + * server/as_value.cpp (to_number): add support for parsing hex strings in swf6+ * testsuite/actionscript.all/Number.as: success in hex parsing tests. Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.133 retrieving revision 1.134 diff -u -b -r1.133 -r1.134 --- server/edit_text_character.cpp 20 Nov 2007 10:31:39 -0000 1.133 +++ server/edit_text_character.cpp 30 Nov 2007 22:36:31 -0000 1.134 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.133 2007/11/20 10:31:39 cmusick Exp $ */ +/* $Id: edit_text_character.cpp,v 1.134 2007/11/30 22:36:31 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1098,6 +1098,23 @@ { m_text_glyph_records.resize(0); + // nothing more to do if text is empty + if ( _text.empty() ) return; + + + AutoSizeValue autoSize = getAutoSize(); + if ( autoSize != autoSizeNone ) + { + static bool warned = false; + if ( ! warned ) { + log_debug(_("TextField.autoSize != 'none' TESTING")); + warned = true; + } + + _bounds.setTo(0,0,0,0); + //_bounds.setNull(); + } + // Should get info from autoSize too maybe ? edit_text_character_def::alignment textAlignment = getTextAlignment(); @@ -1330,8 +1347,6 @@ after_x_advance: float width = _bounds.width(); // m_def->width() - //float right_margin = m_def->get_right_margin(); - if (x >= width - rightMargin - PADDING_TWIPS) { //log_debug("Text in character %s exceeds margins", getTarget().c_str()); @@ -1341,16 +1356,7 @@ if ( ! doWordWrap() ) { //log_debug(" No word wrapping"); - AutoSizeValue autoSize = getAutoSize(); - if ( autoSize != autoSizeNone ) - { - static bool warned = false; - if ( ! warned ) { - log_debug(_("TextField.autoSize != 'none' TESTING")); - warned = true; - } - } - else + if ( autoSize == autoSizeNone ) { //log_debug(" autoSize=NONE!"); // truncate long line, but keep expanding text box @@ -1456,7 +1462,7 @@ // Expand bounding box to include the whole text (if autoSize) if ( _autoSize != autoSizeNone ) { - _bounds.expandTo(x+PADDING_TWIPS, y); + _bounds.expandTo(x+PADDING_TWIPS, y+PADDING_TWIPS); } else { Index: testsuite/misc-mtasc.all/TextFieldTest.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-mtasc.all/TextFieldTest.as,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- testsuite/misc-mtasc.all/TextFieldTest.as 30 Nov 2007 18:04:06 -0000 1.1 +++ testsuite/misc-mtasc.all/TextFieldTest.as 30 Nov 2007 22:36:31 -0000 1.2 @@ -29,14 +29,15 @@ mc.createTextField("textf", 100, 200, 100, 100, 100); _level0.createTextField("textout", 99, 10, 10, 500, 500); var tf = _level0.textf; + check_equals(tf._height, 100); tf.autoSize = true; tf.text = "Hello world"; tf.backgroundColor = "0xFFEEEE"; tf.background = true; var height = tf._height; note("textfield height is "+height); - xcheck(height < 50); - check_totals(1); + check(height < 50); + check_totals(2); Dejagnu.done(); } } _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit