[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ... |
Date: |
Sat, 17 May 2008 15:48:13 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/05/17 15:48:13
Modified files:
. : ChangeLog
server : edit_text_character.cpp edit_text_character.h
namedStrings.cpp namedStrings.h
testsuite/actionscript.all: TextField.as
Log message:
* server/namedStrings.{cpp,h}: add PROP_TEXT_HEIGHT.
* server/edit_text_character.{cpp,h}: implement missing textHeight,
turn textWidth into a proper property.
* testsuite/actionscript.all/TextField.as: updated expected results.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6633&r2=1.6634
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.183&r2=1.184
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.79&r2=1.80
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.54&r2=1.55
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6633
retrieving revision 1.6634
diff -u -b -r1.6633 -r1.6634
--- ChangeLog 17 May 2008 12:41:36 -0000 1.6633
+++ ChangeLog 17 May 2008 15:48:07 -0000 1.6634
@@ -1,3 +1,10 @@
+2008-05-17 Sandro Santilli <address@hidden>
+
+ * server/namedStrings.{cpp,h}: add PROP_TEXT_HEIGHT.
+ * server/edit_text_character.{cpp,h}: implement missing textHeight,
+ turn textWidth into a proper property.
+ * testsuite/actionscript.all/TextField.as: updated expected results.
+
2008-05-17 Benjamin Wolsey <address@hidden>
* server/asobj/NetStreamGst.cpp: replace rint with std::floor.
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -b -r1.183 -r1.184
--- server/edit_text_character.cpp 17 May 2008 10:47:10 -0000 1.183
+++ server/edit_text_character.cpp 17 May 2008 15:48:10 -0000 1.184
@@ -94,6 +94,8 @@
static as_value textfield_html_getset(const fn_call& fn);
static as_value textfield_selectable_getset(const fn_call& fn);
static as_value textfield_length_getset(const fn_call& fn);
+static as_value textfield_textWidth_getset(const fn_call& fn);
+static as_value textfield_textHeight_getset(const fn_call& fn);
//
@@ -365,6 +367,8 @@
o.init_property(NSV::PROP_uYMOUSE, character::ymouse_get,
character::ymouse_get, propFlags);
o.init_property(NSV::PROP_uXSCALE, character::xscale_getset,
character::xscale_getset);
o.init_property(NSV::PROP_uYSCALE, character::yscale_getset,
character::yscale_getset);
+ o.init_property(NSV::PROP_TEXT_WIDTH, textfield_textWidth_getset,
textfield_textWidth_getset);
+ o.init_property(NSV::PROP_TEXT_HEIGHT, textfield_textHeight_getset,
textfield_textHeight_getset);
// SWF5 or higher (TODO: check textfields in SWF5 !!! we miss tests
here !)
@@ -1151,18 +1155,6 @@
#endif // GNASH_DEBUG_TEXTFIELDS
return true;
}
- case NSV::PROP_TEXT_WIDTH:
- //else if (name == "textWidth")
- {
- // Return the width, in pixels, of the text as laid out.
- // (I.e. the actual text content, not our defined
- // bounding box.)
- //
- // In local coords. Verified against Macromedia Flash.
- val->set_double(TWIPS_TO_PIXELS(m_text_bounding_box.width()));
-
- return true;
- }
} // end switch
return get_member_default(name, val, nsname);
@@ -2280,6 +2272,56 @@
}
static as_value
+textfield_textHeight_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 the height, in pixels, of the text as laid out.
+ // (I.e. the actual text content, not our defined
+ // bounding box.)
+ //
+ // In local coords. Verified against Macromedia Flash.
+ return
as_value(TWIPS_TO_PIXELS(ptr->getTextBoundingBox().height()));
+
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set read-only %s property of
TextField %s"), "textHeight", ptr->getTarget());
+ );
+ }
+
+ return as_value();
+}
+
+static as_value
+textfield_textWidth_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 the width, in pixels, of the text as laid out.
+ // (I.e. the actual text content, not our defined
+ // bounding box.)
+ //
+ // In local coords. Verified against Macromedia Flash.
+ return
as_value(TWIPS_TO_PIXELS(ptr->getTextBoundingBox().width()));
+
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set read-only %s property of
TextField %s"), "textWidth", ptr->getTarget());
+ );
+ }
+
+ 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.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- server/edit_text_character.h 28 Apr 2008 09:40:21 -0000 1.79
+++ server/edit_text_character.h 17 May 2008 15:48:11 -0000 1.80
@@ -392,6 +392,11 @@
void setUnderlined(bool v);
+ const geometry::Range2d<float>& getTextBoundingBox() const
+ {
+ return m_text_bounding_box;
+ }
+
private:
/// Set our text to the given string.
Index: server/namedStrings.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/namedStrings.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/namedStrings.cpp 6 May 2008 11:16:25 -0000 1.18
+++ server/namedStrings.cpp 17 May 2008 15:48:12 -0000 1.19
@@ -119,6 +119,7 @@
string_table::svt( "text", NSV::PROP_TEXT ),
string_table::svt( "textColor", NSV::PROP_TEXT_COLOR ),
string_table::svt( "textWidth", NSV::PROP_TEXT_WIDTH ),
+ string_table::svt( "textHeight", NSV::PROP_TEXT_HEIGHT ),
string_table::svt( "toString", NSV::PROP_TO_STRING ),
string_table::svt( "_totalframes", NSV::PROP_uTOTALFRAMES ),
string_table::svt( "underline", NSV::PROP_UNDERLINE ),
Index: server/namedStrings.h
===================================================================
RCS file: /sources/gnash/gnash/server/namedStrings.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/namedStrings.h 6 May 2008 11:16:26 -0000 1.18
+++ server/namedStrings.h 17 May 2008 15:48:12 -0000 1.19
@@ -138,6 +138,7 @@
PROP_TEXT,
PROP_TEXT_COLOR,
PROP_TEXT_WIDTH,
+ PROP_TEXT_HEIGHT,
PROP_TO_STRING,
PROP_uTOTALFRAMES,
PROP_UNDERLINE,
Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- testsuite/actionscript.all/TextField.as 29 Apr 2008 17:22:43 -0000
1.54
+++ testsuite/actionscript.all/TextField.as 17 May 2008 15:48:13 -0000
1.55
@@ -20,7 +20,7 @@
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: TextField.as,v 1.54 2008/04/29 17:22:43 strk Exp $";
+rcsid="$Id: TextField.as,v 1.55 2008/05/17 15:48:13 strk Exp $";
#include "check.as"
#if OUTPUT_VERSION > 5
@@ -69,8 +69,8 @@
xcheck( !TextField.prototype.hasOwnProperty('selectable') );
check( !TextField.prototype.hasOwnProperty('text') );
xcheck( !TextField.prototype.hasOwnProperty('textColor') );
-check( !TextField.prototype.hasOwnProperty('textHeight') );
-check( !TextField.prototype.hasOwnProperty('textWidth') );
+xcheck( !TextField.prototype.hasOwnProperty('textHeight') ); // should be
available on first instantiation
+xcheck( !TextField.prototype.hasOwnProperty('textWidth') ); // should be
available on first instantiation
xcheck( !TextField.prototype.hasOwnProperty('type') ); // should be available
on first instantiation
xcheck( !TextField.prototype.hasOwnProperty('variable') );
xcheck( !TextField.prototype.hasOwnProperty('wordWrap') );
@@ -144,8 +144,8 @@
check( TextField.prototype.hasOwnProperty('selectable') );
xcheck( TextField.prototype.hasOwnProperty('text') );
check( TextField.prototype.hasOwnProperty('textColor') );
-xcheck( TextField.prototype.hasOwnProperty('textHeight') );
-xcheck( TextField.prototype.hasOwnProperty('textWidth') );
+check( TextField.prototype.hasOwnProperty('textHeight') );
+check( TextField.prototype.hasOwnProperty('textWidth') );
check( TextField.prototype.hasOwnProperty('type') );
check( TextField.prototype.hasOwnProperty('variable') );
check( TextField.prototype.hasOwnProperty('wordWrap') );
@@ -531,11 +531,11 @@
// Check TextField.textHeight (height of the bounding box)
-xcheck_equals(typeof(tf.textHeight), 'number');
+check_equals(typeof(tf.textHeight), 'number');
check( ! tf.hasOwnProperty('textHeight') );
currentHeight = tf.textHeight; // WARNING: this might depend on the default
font height
tf.textHeight = 1000;
-xcheck_equals(tf.textHeight, currentHeight); // was read-only (I think)
+check_equals(tf.textHeight, currentHeight); // was read-only (I think)
// Check TextField.textWidth (width of the bounding box)