[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: |
Tue, 29 Apr 2008 17:22:44 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/04/29 17:22:44
Modified files:
. : ChangeLog
server : edit_text_character.cpp
testsuite/actionscript.all: TextField.as
Log message:
* server/edit_text_character.cpp: have wordWrap take precedence
over autoSize, don't let wordWrap make the text box taller
if autoSize is none.
* testsuite/actionscript.all/TextField.as: a couple of success
and a failure in effects of _width over textWidth.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6447&r2=1.6448
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.180&r2=1.181
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.53&r2=1.54
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6447
retrieving revision 1.6448
diff -u -b -r1.6447 -r1.6448
--- ChangeLog 29 Apr 2008 16:50:48 -0000 1.6447
+++ ChangeLog 29 Apr 2008 17:22:42 -0000 1.6448
@@ -1,3 +1,11 @@
+2008-04-29 Sandro Santilli <address@hidden>
+
+ * server/edit_text_character.cpp: have wordWrap take precedence
+ over autoSize, don't let wordWrap make the text box taller
+ if autoSize is none.
+ * testsuite/actionscript.all/TextField.as: a couple of success
+ and a failure in effects of _width over textWidth.
+
2008-04-29 Rob Savoye <address@hidden>
* configure.ac: Add --enable-jemalloc option to use our own copy of
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -b -r1.180 -r1.181
--- server/edit_text_character.cpp 28 Apr 2008 09:40:20 -0000 1.180
+++ server/edit_text_character.cpp 29 Apr 2008 17:22:43 -0000 1.181
@@ -608,6 +608,7 @@
{
point coords[4];
+
float xmin = _bounds.getMinX();
float xmax = _bounds.getMaxX();
float ymin = _bounds.getMinY();
@@ -1248,16 +1249,14 @@
// nothing more to do if text is empty
if ( _text.empty() ) return;
+ Range2d<float> defBounds = m_def->get_bounds().getRange();
+
AutoSizeValue autoSize = getAutoSize();
if ( autoSize != autoSizeNone )
{
- static bool warned = false;
- if ( ! warned ) {
- log_debug(_("TextField.autoSize != 'none' TESTING"));
- warned = true;
- }
+ LOG_ONCE( log_debug(_("TextField.autoSize != 'none' TESTING"))
);
- _bounds.setTo(0,0,0,0);
+ _bounds.setTo(0,0,defBounds.getMaxX(),0); // this is correct
for 'true'
//_bounds.setNull();
}
@@ -1504,17 +1503,19 @@
after_x_advance:
- float width = _bounds.width(); // m_def->width()
+ float width = defBounds.width();
if (x >= width - rightMargin - PADDING_TWIPS)
{
- //log_debug("Text in character %s exceeds margins",
getTarget());
- // Whoops, we just exceeded the box width.
- // Do word-wrap if requested to do so.
- if ( autoSize == autoSizeNone )
- {
- if ( ! doWordWrap() )
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug("Text in TextField %s exceeds width [ _bounds
%s ]", getTarget(), _bounds);
+#endif
+
+ // no wrap and no resize --> truncate
+ if ( ! doWordWrap() && autoSize == autoSizeNone )
{
- //log_debug(" autoSize=NONE!");
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug(" wordWrap=false, autoSize=none");
+#endif
// truncate long line, but keep
expanding text box
bool newlinefound = false;
while ( it != e )
@@ -1528,7 +1529,7 @@
// Expand the bounding-box to
the lower-right corner of each glyph,
// even if we don't display it
m_text_bounding_box.expandTo(x,
y + fontDescent);
-#ifdef GNASH_DEBUG_TEXTFIELDS
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
log_debug("Text bbox expanded
to %s (width: %f)", m_text_bounding_box, m_text_bounding_box.width());
#endif
@@ -1544,18 +1545,21 @@
}
if ( ! newlinefound ) break;
}
- else
+ else if ( doWordWrap() )
{
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug(" wordWrap=true");
+#endif // DEBUG_MOUSE_ENTITY_FINDING
- // Insert newline.
+ // Insert newline if there's space or autosize
!= none
// Close out this stretch of glyphs.
m_text_glyph_records.push_back(rec);
+
float previous_x = x;
x = leftMargin + blockIndent +
PADDING_TWIPS;
y += fontHeight + leading;
-
// Start a new record on the next line.
rec.m_glyphs.resize(0);
rec.m_style.setFont(_font.get());
@@ -1599,10 +1603,29 @@
last_space_glyph = -1;
last_line_start_record =
m_text_glyph_records.size();
+
}
+ else
+ {
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug(" wordWrap=%d, autoSize=%d",
_wordWrap, _autoSize);
+#endif // DEBUG_MOUSE_ENTITY_FINDING
}
}
+
+ if ( (y) > (defBounds.height() - PADDING_TWIPS) && autoSize ==
autoSizeNone )
+ {
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug("Text with wordWrap exceeds height of box");
+#endif
+ rec.m_glyphs.clear();
+ // TODO: should still compute m_text_bounds !
+ LOG_ONCE(log_unimpl("Computing text bounds of a
TextField containing text that doesn't fit the box vertically"));
+ break;
+ }
+
+
if (m_cursor > character_idx)
{
m_xcursor = x;
@@ -1618,13 +1641,9 @@
{
_bounds.expandTo(x+PADDING_TWIPS, y+PADDING_TWIPS);
}
- else
- {
- _bounds.expandTo(_bounds.getMaxX(), y);
- }
// Add this line to our output.
- m_text_glyph_records.push_back(rec);
+ if ( ! rec.m_glyphs.empty() ) m_text_glyph_records.push_back(rec);
float extra_space = align_line(textAlignment, last_line_start_record,
x);
Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- testsuite/actionscript.all/TextField.as 27 Apr 2008 18:13:16 -0000
1.53
+++ testsuite/actionscript.all/TextField.as 29 Apr 2008 17:22:43 -0000
1.54
@@ -20,7 +20,7 @@
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: TextField.as,v 1.53 2008/04/27 18:13:16 strk Exp $";
+rcsid="$Id: TextField.as,v 1.54 2008/04/29 17:22:43 strk Exp $";
#include "check.as"
#if OUTPUT_VERSION > 5
@@ -785,15 +785,16 @@
check_equals(tf.textWidth, origTextWidth); // textWidth isn't influenced by
autoSize
tf.autoSize = 'none';
tf.wordWrap = true;
-note("textWidth: "+tf.textWidth+" origTextWidth:"+origTextWidth);
+note("After setting wordWrap flat: textWidth: "+tf.textWidth+"
origTextWidth:"+origTextWidth);
check_equals(tf.textWidth, origTextWidth);
tf._width = 10;
+note("After reducing _width: textWidth: "+tf.textWidth+"
origTextWidth:"+origTextWidth);
check_equals(tf._width, 10);
#if OUTPUT_VERSION < 8
- xcheck_equals(origTextWidth, tf.textWidth); // textWidth isn't influenced by
wordWrap
+ check_equals(origTextWidth, tf.textWidth);
#else
- check(origTextWidth > tf.textWidth);
+ xcheck(origTextWidth > tf.textWidth);
#endif
// test that adding a newline doesn't change the bounds width
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., (continued)
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., Sandro Santilli, 2008/04/10
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., Sandro Santilli, 2008/04/10
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., Sandro Santilli, 2008/04/11
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., Sandro Santilli, 2008/04/19
- Re: [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., zou lunkai, 2008/04/28
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., Benjamin Wolsey, 2008/04/28
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ..., Benjamin Wolsey, 2008/04/28
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...,
Sandro Santilli <=