gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11360: Don't crash when the scroll


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11360: Don't crash when the scroll exceeds the number of lines (the fix may not
Date: Tue, 04 Aug 2009 09:09:08 +0200
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11360 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-08-04 09:09:08 +0200
message:
  Don't crash when the scroll exceeds the number of lines (the fix may not
  be the correct behaviour, but doesn't fail any tests). Fixes testsuite again.
  
  Expect passes in actionscript.all.
modified:
  libcore/TextField.cpp
  testsuite/actionscript.all/TextField.as
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2009-07-31 20:59:28 +0000
+++ b/libcore/TextField.cpp     2009-08-04 05:54:12 +0000
@@ -1464,9 +1464,16 @@
 TextField::changeTopVisibleLine(size_t current_line)
 {
     if (_linesindisplay > 0) {
-        size_t manylines = _line_starts.size();
-        size_t lastvisibleline = _scroll + _linesindisplay;
-        assert (manylines >= _scroll);
+        const size_t manylines = _line_starts.size();
+        const size_t lastvisibleline = _scroll + _linesindisplay;
+
+        // If there aren't as many lines as we have scrolled, display the
+        // end of the text.
+        if (manylines < _scroll) {
+            _scroll = manylines - _linesindisplay;
+            return;
+        }
+
         if (manylines - _scroll <= _linesindisplay) {
             if (manylines < _linesindisplay) _scroll = 0;
             else {

=== modified file 'testsuite/actionscript.all/TextField.as'
--- a/testsuite/actionscript.all/TextField.as   2009-07-31 10:42:46 +0000
+++ b/testsuite/actionscript.all/TextField.as   2009-08-04 07:09:08 +0000
@@ -394,7 +394,7 @@
 
 // Check TextField.maxscroll
 
-xcheck_equals(typeof(tf.maxscroll), 'number');
+check_equals(typeof(tf.maxscroll), 'number');
 check(!tf.hasOwnProperty('maxscroll'));
 xcheck_equals(tf.maxscroll, 1);
 tf.maxscroll = 10;
@@ -550,7 +550,7 @@
 // Check TextField.scroll
 
 // TODO: better test for this, might do nothing if there's no scrollin
-xcheck_equals(typeof(tf.scroll), 'number');
+check_equals(typeof(tf.scroll), 'number');
 check( ! tf.hasOwnProperty('scroll') ); 
 xcheck_equals(tf.scroll, 1);
 tf.scroll = 10;


reply via email to

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