[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11323: Fix other people's compiler
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11323: Fix other people's compiler warnings. Fix testsuite breakages. Expect |
Date: |
Tue, 28 Jul 2009 11:50:09 +0200 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11323
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-07-28 11:50:09 +0200
message:
Fix other people's compiler warnings. Fix testsuite breakages. Expect
passes in testsuite.
modified:
libcore/TextField.cpp
libcore/TextField.h
libcore/asobj/TextFormat_as.cpp
libcore/asobj/TextFormat_as.h
testsuite/actionscript.all/TextFormat.as
testsuite/misc-haxe.all/classes.all/text/TextFormat_as.hx
------------------------------------------------------------
revno: 11322.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 09:25:34 +0200
message:
Expect passes in TextFormat.
modified:
testsuite/actionscript.all/TextFormat.as
------------------------------------------------------------
revno: 11322.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 09:40:18 +0200
message:
Expect passes in haxe.
modified:
testsuite/misc-haxe.all/classes.all/text/TextFormat_as.hx
------------------------------------------------------------
revno: 11322.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 09:49:39 +0200
message:
Remove odd characters from testcase.
modified:
testsuite/misc-haxe.all/classes.all/text/TextFormat_as.hx
------------------------------------------------------------
revno: 11322.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 10:20:12 +0200
message:
Use operator= for assigning to vectors. Also fixes compiler warning by
removing unsigned/signed comparison.
modified:
libcore/asobj/TextFormat_as.h
------------------------------------------------------------
revno: 11322.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 10:50:43 +0200
message:
Fix undefined behaviour by returning a value from non-void functions. The
compiler warned about these, so they should have been fixed.
modified:
libcore/asobj/TextFormat_as.cpp
------------------------------------------------------------
revno: 11322.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 10:54:22 +0200
message:
Fix signed/unsigned compiler warnings. Use a typedef for clarity and
easier
refactoring. Use size_t when storing sizes, and for all variables that are
compared to these sizes.
Pass vectors by const reference. Don't reimplement vector assignment; just
use operator=().
Limit line length to 80 characters.
Fix compiler warnings about initialization order. These should have been
fixed before the original commit.
modified:
libcore/TextField.cpp
libcore/TextField.h
------------------------------------------------------------
revno: 11322.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 11:03:11 +0200
message:
Restore doWordWrap() condition, fixing testsuite again.
modified:
libcore/TextField.cpp
------------------------------------------------------------
revno: 11322.1.8
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 11:03:44 +0200
message:
Tabs to spaces.
modified:
libcore/TextField.cpp
------------------------------------------------------------
revno: 11322.1.9
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-07-28 11:23:14 +0200
message:
Fix one last flaky comparison.
modified:
libcore/TextField.cpp
libcore/TextField.h
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp 2009-07-27 21:26:18 +0000
+++ b/libcore/TextField.cpp 2009-07-28 09:23:14 +0000
@@ -52,7 +52,7 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
-#include <stdlib.h>
+#include <cstdlib>
#include <typeinfo>
// Text fields have a fixed 2 pixel padding for each side (regardless of
border)
@@ -119,11 +119,11 @@
_tag(&def),
_textDefined(def.hasText()),
_underlined(false),
- _bullet(false),
+ _bullet(false),
_url(""),
_target(""),
+ _display(),
_tabStops(),
- _display(),
_leading(def.leading()),
_alignment(def.alignment()),
_indent(def.indent()),
@@ -134,7 +134,7 @@
_font(0),
m_has_focus(false),
m_cursor(0u),
- _top_visible_line(0u),
+ _top_visible_line(0u),
m_xcursor(0.0f),
m_ycursor(0.0f),
_multiline(def.multiline()),
@@ -182,11 +182,11 @@
InteractiveObject(parent, parent ? 0 : -1),
_textDefined(false),
_underlined(false),
- _bullet(false),
+ _bullet(false),
_url(""),
_target(""),
+ _display(),
_tabStops(),
- _display(),
_leading(0),
_alignment(ALIGN_LEFT),
_indent(0),
@@ -197,7 +197,7 @@
_font(0),
m_has_focus(false),
m_cursor(0u),
- _top_visible_line(0u),
+ _top_visible_line(0u),
m_xcursor(0.0f),
m_ycursor(0.0f),
_multiline(false),
@@ -443,13 +443,13 @@
// maybe _text is changed in ActionScript
m_cursor = std::min<size_t>(m_cursor, _text.size());
-
- int cur_cursor = m_cursor;
- int previouslinesize = 0;
- int nextlinesize = 0;
- int manylines = _line_starts.size();
- std::vector<int>::iterator linestartit =
_line_starts.begin();
- std::vector<int>::const_iterator linestartend =
_line_starts.end();
+
+ size_t cur_cursor = m_cursor;
+ size_t previouslinesize = 0;
+ size_t nextlinesize = 0;
+ size_t manylines = _line_starts.size();
+ LineStarts::iterator linestartit = _line_starts.begin();
+ LineStarts::const_iterator linestartend = _line_starts.end();
switch (c)
{
@@ -474,96 +474,108 @@
break;
case key::HOME:
- while ( linestartit < linestartend &&
*linestartit <= m_cursor ) {
- cur_cursor = *linestartit;
- linestartit++;
- }
- m_cursor = cur_cursor;
- format_text();
- break;
-
+ while ( linestartit < linestartend && *linestartit <=
m_cursor ) {
+ cur_cursor = *linestartit;
+ linestartit++;
+ }
+ m_cursor = cur_cursor;
+ format_text();
+ break;
+
case key::PGUP:
- // if going a page up is too far...
- if(_top_visible_line - _linesindisplay
< 0) {
- _top_visible_line = 0;
- m_cursor = 0;
- } else { // go a page up
- _top_visible_line -=
_linesindisplay;
- m_cursor =
_line_starts[_top_visible_line];
- }
- format_text();
- break;
-
+ // if going a page up is too far...
+ if(_top_visible_line < _linesindisplay) {
+ _top_visible_line = 0;
+ m_cursor = 0;
+ } else { // go a page up
+ _top_visible_line -= _linesindisplay;
+ m_cursor = _line_starts[_top_visible_line];
+ }
+ format_text();
+ break;
+
case key::UP:
- while ( linestartit < linestartend &&
*linestartit <= m_cursor ) {
- cur_cursor = *linestartit;
- linestartit++;
- }
- //if there is no previous line
- if ( linestartit-_line_starts.begin() -
2 < 0 ) {
- m_cursor = 0;
- format_text();
- break;
- }
- previouslinesize =
_displayRecords[linestartit-_line_starts.begin() - 2].glyphs().size();
- //if the previous line is smaller
- if (m_cursor - cur_cursor >
previouslinesize)
- m_cursor = *(--(--linestartit))
+ previouslinesize;
- else
- m_cursor = *(--(--linestartit))
+ (m_cursor - cur_cursor);
- if (m_cursor <
_line_starts[_top_visible_line] && _line_starts[_top_visible_line] != 0)
- --_top_visible_line;
+ while ( linestartit < linestartend && *linestartit <=
m_cursor ) {
+ cur_cursor = *linestartit;
+ linestartit++;
+ }
+ //if there is no previous line
+ if ( linestartit-_line_starts.begin() - 2 < 0 ) {
+ m_cursor = 0;
+ format_text();
+ break;
+ }
+ previouslinesize =
_displayRecords[linestartit-_line_starts.begin() - 2].glyphs().size();
+ //if the previous line is smaller
+ if (m_cursor - cur_cursor > previouslinesize)
+ m_cursor = *(--(--linestartit)) + previouslinesize;
+ else
+ m_cursor = *(--(--linestartit)) + (m_cursor -
cur_cursor);
+ if (m_cursor < _line_starts[_top_visible_line] &&
_line_starts[_top_visible_line] != 0)
+ --_top_visible_line;
format_text();
break;
case key::END:
- while ( linestartit < linestartend &&
*linestartit <= m_cursor ) {
- linestartit++;
- }
- m_cursor = linestartit != linestartend
? *linestartit - 1 : _text.size();
- format_text();
- break;
-
+ while ( linestartit < linestartend && *linestartit <=
m_cursor ) {
+ linestartit++;
+ }
+ m_cursor = linestartit != linestartend ? *linestartit - 1
: _text.size();
+ format_text();
+ break;
+
case key::PGDN:
- //if going another page down is too
far...
- if(_top_visible_line + _linesindisplay
>= manylines) {
- if(manylines - _linesindisplay
<= 0) {
- _top_visible_line = 0;
- } else {
- _top_visible_line =
manylines - _linesindisplay;
- }
- if(m_cursor <
_line_starts[_top_visible_line-1]) {
- m_cursor =
_line_starts[_top_visible_line-1];
- } else {
- m_cursor = _text.size();
- }
- } else { //go a page down
- _top_visible_line +=
_linesindisplay;
- m_cursor =
_line_starts[_top_visible_line];
- }
- format_text();
- break;
-
+ //if going another page down is too far...
+ if(_top_visible_line + _linesindisplay >= manylines) {
+ if(manylines - _linesindisplay <= 0) {
+ _top_visible_line = 0;
+ } else {
+ _top_visible_line = manylines - _linesindisplay;
+ }
+ if(m_cursor < _line_starts[_top_visible_line-1]) {
+ m_cursor = _line_starts[_top_visible_line-1];
+ } else {
+ m_cursor = _text.size();
+ }
+ } else { //go a page down
+ _top_visible_line += _linesindisplay;
+ m_cursor = _line_starts[_top_visible_line];
+ }
+ format_text();
+ break;
+
case key::DOWN:
- while ( linestartit < linestartend && *linestartit <=
m_cursor ) {
- cur_cursor = *linestartit;
- linestartit++;
- }
- //if there is no next line
- if ( linestartit-_line_starts.begin()
>= manylines ) {
- m_cursor = _text.size();
- format_text();
- break;
- }
- nextlinesize =
_displayRecords[linestartit-_line_starts.begin()].glyphs().size();
- //if the next line is smaller
- if (m_cursor - cur_cursor >
nextlinesize)
- m_cursor = *linestartit +
nextlinesize;
- else //put the cursor at the same
character distance
- m_cursor = *(linestartit) +
(m_cursor - cur_cursor);
+ {
+ while (linestartit < linestartend &&
+ *linestartit <= m_cursor ) {
+
+ cur_cursor = *linestartit;
+ linestartit++;
+ }
+
+ // linestartit should never be before _line_starts.begin()
+ const size_t currentLine = linestartit -
+ _line_starts.begin();
+
+ //if there is no next line
+ if (currentLine >= manylines ) {
+ m_cursor = _text.size();
+ format_text();
+ break;
+ }
+ nextlinesize =
_displayRecords[currentLine].glyphs().size();
+
+ //if the next line is smaller
+ if (m_cursor - cur_cursor > nextlinesize) {
+ m_cursor = *linestartit + nextlinesize;
+ }
+ else {
+ //put the cursor at the same character distance
+ m_cursor = *(linestartit) + (m_cursor - cur_cursor);
+ }
format_text();
break;
-
+ }
case key::LEFT:
m_cursor = m_cursor > 0 ? m_cursor - 1 : 0;
@@ -575,10 +587,10 @@
_text.size();
format_text();
break;
-
- case key::ENTER:
- if ( !multiline() )
- break;
+
+ case key::ENTER:
+ if ( !multiline() )
+ break;
default:
wchar_t t = static_cast<wchar_t>(
@@ -999,65 +1011,66 @@
}
//~ else
//~ {
- //~ std::vector<int> tabStops;
- //~ tabStops = _tabStops;
- //~
- //~ std::sort(_tabStops.begin(), _tabStops.end());
+ //~ std::vector<int> tabStops;
+ //~ tabStops = _tabStops;
+ //~
+ //~ std::sort(_tabStops.begin(), _tabStops.end());
//~
- //~ int tab = 0;
- //~ if ( !_tabStops.empty() )
- //~ {
- //~ tab = _tabStops.back();
- //~
- //~ for (int i = 0; i < tabStops.size(); ++i)
- //~ {
- //~ if (tabStops[i] > x)
- //~ {
- //~ if((tabStops[i] - x) < tab)
- //~ {
- //~ tab = tabStops[i] - x;
- //~ }
- //~ }
- //~ SWF::TextRecord::GlyphEntry ge;
- //~ ge.index = index;
- //~ ge.advance = scale * tab;
- //~ rec.addGlyph(ge);
- //~ x+=ge.advance;
- //~ }
- //~ }
- else
- {
- SWF::TextRecord::GlyphEntry ge;
- ge.index = index;
- ge.advance = scale * rec.getFont()->get_advance(index,
- _embedFonts);
+ //~ int tab = 0;
+ //~ if ( !_tabStops.empty() )
+ //~ {
+ //~ tab = _tabStops.back();
+ //~
+ //~ for (int i = 0; i < tabStops.size(); ++i)
+ //~ {
+ //~ if (tabStops[i] > x)
+ //~ {
+ //~ if((tabStops[i] - x) < tab)
+ //~ {
+ //~ tab = tabStops[i] - x;
+ //~ }
+ //~ }
+ //~ SWF::TextRecord::GlyphEntry ge;
+ //~ ge.index = index;
+ //~ ge.advance = scale * tab;
+ //~ rec.addGlyph(ge);
+ //~ x+=ge.advance;
+ //~ }
+ //~ }
+ else
+ {
+ SWF::TextRecord::GlyphEntry ge;
+ ge.index = index;
+ ge.advance = scale * rec.getFont()->get_advance(index,
+ _embedFonts);
- const int tabstop = 8;
- rec.addGlyph(ge, tabstop);
- x += ge.advance * tabstop;
- }
- //}
+ const int tabstop = 8;
+ rec.addGlyph(ge, tabstop);
+ x += ge.advance * tabstop;
+ }
+ //}
}
void
TextField::format_text()
{
_textRecords.clear();
- _displayRecords.clear();
- _line_starts.clear();
-
- // nothing more to do if text is empty
+ _displayRecords.clear();
+ _line_starts.clear();
+
+ // nothing more to do if text is empty
if ( _text.empty() )
{
// TODO: should we still reset _bounds if autoSize != autoSizeNone ?
// not sure we should...
reset_bounding_box(0, 0);
- m_xcursor = PADDING_TWIPS + std::max(0, getLeftMargin() +
getIndent() + getBlockIndent());
+ m_xcursor = PADDING_TWIPS +
+ std::max(0, getLeftMargin() + getIndent() + getBlockIndent());
return;
}
-
- std::vector<int>::iterator linestartit = _line_starts.begin();
- std::vector<int>::const_iterator linestartend = _line_starts.end();
+
+ LineStarts::iterator linestartit = _line_starts.begin();
+ LineStarts::const_iterator linestartend = _line_starts.end();
// See bug #24266
const rect& defBounds = _bounds;
@@ -1094,7 +1107,6 @@
float fontDescent = _font->descent() * scale;
float fontLeading = _font->leading() * scale;
boost::uint16_t leftMargin = getLeftMargin();
- boost::uint16_t rightMargin = getRightMargin();
boost::uint16_t indent = getIndent();
boost::uint16_t blockIndent = getBlockIndent();
bool underlined = getUnderlined();
@@ -1110,40 +1122,35 @@
std::max(0, leftMargin + indent + blockIndent));
rec.setYOffset(PADDING_TWIPS + fontHeight + (fontLeading - fontDescent));
rec.setTextHeight(fontHeight);
-
- // BULLET CASE:
+
+ // BULLET CASE:
// First, we indent 10 spaces, and then place the bullet
- // character (in this case, an asterik), then we pad it
+ // character (in this case, an asterisk), then we pad it
// again with 10 spaces
// Note: this works only for additional lines of a
// bulleted list, so that is why there is a bullet format
// in the beginning of format_text()
if ( _bullet )
{
- int space = rec.getFont()->get_glyph_index(
- 32, _embedFonts);
+ int space = rec.getFont()->get_glyph_index(32, _embedFonts);
+
SWF::TextRecord::GlyphEntry ge;
ge.index = space;
- ge.advance = scale * rec.getFont()->get_advance(space,
- _embedFonts);
+ ge.advance = scale * rec.getFont()->get_advance(space, _embedFonts);
rec.addGlyph(ge, 10);
- // We use an asterik instead of a bullet
- int bullet = rec.getFont()->get_glyph_index(
- 42, _embedFonts);
+ // We use an asterisk instead of a bullet
+ int bullet = rec.getFont()->get_glyph_index(42, _embedFonts);
ge.index = bullet;
- ge.advance = scale * rec.getFont()->get_advance(bullet,
- _embedFonts);
+ ge.advance = scale * rec.getFont()->get_advance(bullet, _embedFonts);
rec.addGlyph(ge);
- space = rec.getFont()->get_glyph_index(
- 32, _embedFonts);
+ space = rec.getFont()->get_glyph_index(32, _embedFonts);
ge.index = space;
- ge.advance = scale * rec.getFont()->get_advance(space,
- _embedFonts);
- rec.addGlyph(ge, 9);
- }
+ ge.advance = scale * rec.getFont()->get_advance(space, _embedFonts);
+ rec.addGlyph(ge, 9);
+ }
boost::int32_t x = static_cast<boost::int32_t>(rec.xOffset());
boost::int32_t y = static_cast<boost::int32_t>(rec.yOffset());
@@ -1153,12 +1160,13 @@
float leading = getLeading();
leading += fontLeading * scale; // not sure this is correct...
-
- int last_code = -1; // only used if _embedFonts
- int last_space_glyph = -1;
- int last_line_start_record = 0;
- _line_starts.push_back(0);
- _linesindisplay = (defBounds.height() / (fontHeight + leading));
+
+ int last_code = -1; // only used if _embedFonts
+ int last_space_glyph = -1;
+ size_t last_line_start_record = 0;
+
+ _line_starts.push_back(0);
+ _linesindisplay = (defBounds.height() / (fontHeight + leading));
m_xcursor = x;
m_ycursor = y;
@@ -1172,8 +1180,9 @@
const std::wstring::const_iterator e = _text.end();
///handleChar takes care of placing the glyphs
- handleChar(it, e, x, y, rec, last_code, last_space_glyph,
last_line_start_record);
-
+ handleChar(it, e, x, y, rec, last_code, last_space_glyph,
+ last_line_start_record);
+
// Expand bounding box to include the whole text (if autoSize)
if ( _autoSize != autoSizeNone )
{
@@ -1181,528 +1190,558 @@
}
// Add the last line to our output.
- //if (!rec.glyphs().empty()) _textRecords.push_back(rec);
- _textRecords.push_back(rec);
-
- linestartit = _line_starts.begin();
- linestartend = _line_starts.end();
- int current_line;
- int linestart = 0;
- int manylines = _line_starts.size();
- int manyrecords = _textRecords.size();
- SWF::TextRecord cursorposition_line;
- while (linestartit != linestartend && *linestartit <= m_cursor) {
- linestart = *linestartit++;
- }
- current_line = linestartit - _line_starts.begin();
- changeTopVisibleLine(current_line);
-
- ///ASSIGN THE VISIBLE LINES TO _displayRecord
- int yoffset = _top_visible_line*(fontHeight + leading) + PADDING_TWIPS;
- for (unsigned int i = 0; i < manyrecords; ++i) {
- //if the record is in the section we want to show
- if(_textRecords[i].yOffset() - yoffset < defBounds.height() &&
- _textRecords[i].yOffset() - yoffset > 0) {
- _displayRecords.push_back(_textRecords[i]);
-
_displayRecords.back().setYOffset(_displayRecords.back().yOffset() - yoffset);
- }
- }
- ///POSITION THE CURSOR IN X-DIRECTION
- if ( current_line <= manylines && current_line >= 1) {
- float lineposition = (current_line * (fontHeight + leading)) +
PADDING_TWIPS;
- for (unsigned int i = current_line - 1; i < manyrecords &&
_textRecords[i].yOffset() == lineposition; ++i) {
- cursorposition_line = _textRecords[i];
- if (linestart + _textRecords[i].glyphs().size() <
m_cursor - _line_starts[current_line-1]) {
- linestart += _textRecords[i].glyphs().size();
- }
- }
- m_xcursor = cursorposition_line.xOffset();
- //extra checks keep MemCheck happy!
- for (unsigned int i = linestart; i < m_cursor && i-linestart <
cursorposition_line.glyphs().size(); ++i) {
- m_xcursor +=
cursorposition_line.glyphs()[i-linestart].advance;
- }
- }
- ///POSITION THE CURSOR IN Y-DIRECTION
- m_ycursor = PADDING_TWIPS - _top_visible_line*(fontHeight + leading);
- if (current_line >= 0) {
- for(unsigned int i = 0; i < current_line-1; ++i) {
- m_ycursor += (fontHeight+leading);
- }
- }
-
- float extra_space = align_line(textAlignment, last_line_start_record,
x);
+ //if (!rec.glyphs().empty()) _textRecords.push_back(rec);
+ _textRecords.push_back(rec);
+
+ linestartit = _line_starts.begin();
+ linestartend = _line_starts.end();
+ size_t linestart = 0;
+ size_t manylines = _line_starts.size();
+ size_t manyrecords = _textRecords.size();
+
+ SWF::TextRecord cursorposition_line;
+ while (linestartit != linestartend && *linestartit <= m_cursor) {
+ linestart = *linestartit++;
+ }
+ const size_t current_line = linestartit - _line_starts.begin();
+ changeTopVisibleLine(current_line);
+
+ ///ASSIGN THE VISIBLE LINES TO _displayRecord
+ int yoffset = _top_visible_line*(fontHeight + leading) + PADDING_TWIPS;
+ for (size_t i = 0; i < manyrecords; ++i) {
+ //if the record is in the section we want to show
+ if(_textRecords[i].yOffset() - yoffset < defBounds.height() &&
+ _textRecords[i].yOffset() - yoffset > 0) {
+ _displayRecords.push_back(_textRecords[i]);
+ _displayRecords.back().setYOffset(_displayRecords.back().yOffset()
- yoffset);
+ }
+ }
+ ///POSITION THE CURSOR IN X-DIRECTION
+ if ( current_line <= manylines && current_line >= 1) {
+ float lineposition = (current_line * (fontHeight + leading)) +
PADDING_TWIPS;
+ for (size_t i = current_line - 1; i < manyrecords &&
_textRecords[i].yOffset() == lineposition; ++i) {
+ cursorposition_line = _textRecords[i];
+ if (linestart + _textRecords[i].glyphs().size() < m_cursor -
_line_starts[current_line-1]) {
+ linestart += _textRecords[i].glyphs().size();
+ }
+ }
+ m_xcursor = cursorposition_line.xOffset();
+ //extra checks keep MemCheck happy!
+ for (size_t i = linestart; i < m_cursor && i-linestart <
cursorposition_line.glyphs().size(); ++i) {
+ m_xcursor += cursorposition_line.glyphs()[i-linestart].advance;
+ }
+ }
+ ///POSITION THE CURSOR IN Y-DIRECTION
+ m_ycursor = PADDING_TWIPS - _top_visible_line*(fontHeight + leading);
+
+ for (size_t i = 0; (i + 1) < current_line; ++i) {
+ m_ycursor += (fontHeight+leading);
+ }
+
+ float extra_space = align_line(textAlignment, last_line_start_record, x);
m_xcursor += static_cast<int>(extra_space);
- set_invalidated(); //redraw
-}
-
-void
-TextField::changeTopVisibleLine(int current_line)
-{
- if (_linesindisplay > 0) {
- int manylines = _line_starts.size();
- int lastvisibleline = _top_visible_line + _linesindisplay;
- if (manylines - _top_visible_line <= _linesindisplay) {
- if(manylines - _linesindisplay <= 0)
- _top_visible_line = 0;
- else {
- _top_visible_line = manylines - _linesindisplay;
- }
- //if we are at a higher position, scoot the lines down
- } else if ( m_cursor < (_line_starts[_top_visible_line]) ) {
- _top_visible_line -= _top_visible_line-current_line;
- //if we are at a lower position, scoot the lines up
- } else if (manylines > _top_visible_line+_linesindisplay) {
- if ( m_cursor >= (_line_starts[lastvisibleline])) {
- _top_visible_line += current_line -
(lastvisibleline);
- }
- }
- }
-}
-
-void
-TextField::newLine(std::wstring::const_iterator& it, boost::int32_t& x,
boost::int32_t& y, SWF::TextRecord& rec,
- int& last_space_glyph, int&
last_line_start_record, float div)
-{
-
- // newline.
- std::vector<int>::iterator linestartit = _line_starts.begin();
- std::vector<int>::const_iterator linestartend = _line_starts.end();
-
- float scale = _fontHeight / (float)_font->unitsPerEM(_embedFonts);
- float fontDescent = _font->descent() * scale;
+ set_invalidated(); //redraw
+}
+
+void
+TextField::changeTopVisibleLine(size_t current_line)
+{
+ if (_linesindisplay > 0) {
+ size_t manylines = _line_starts.size();
+ size_t lastvisibleline = _top_visible_line + _linesindisplay;
+ assert (manylines >= _top_visible_line);
+ if (manylines - _top_visible_line <= _linesindisplay) {
+ if (manylines < _linesindisplay) _top_visible_line = 0;
+ else {
+ _top_visible_line = manylines - _linesindisplay;
+ }
+ return;
+ }
+
+ if (m_cursor < (_line_starts[_top_visible_line])) {
+ //if we are at a higher position, scoot the lines down
+ _top_visible_line -= _top_visible_line - current_line;
+ return;
+ }
+
+ if (manylines > _top_visible_line + _linesindisplay) {
+ //if we are at a lower position, scoot the lines up
+ if (m_cursor >= (_line_starts[lastvisibleline])) {
+ _top_visible_line += current_line - (lastvisibleline);
+ }
+ }
+ return;
+ }
+}
+
+void
+TextField::newLine(std::wstring::const_iterator& it, boost::int32_t& x,
+ boost::int32_t& y, SWF::TextRecord& rec, int& last_space_glyph,
+ LineStarts::value_type& last_line_start_record, float div)
+{
+
+ // newline.
+ LineStarts::iterator linestartit = _line_starts.begin();
+ LineStarts::const_iterator linestartend = _line_starts.end();
+
+ float scale = _fontHeight / (float)_font->unitsPerEM(_embedFonts);
float fontLeading = _font->leading() * scale;
- float leading = getLeading();
+ float leading = getLeading();
leading += fontLeading * scale; // not sure this is correct...
-
- // Close out this stretch of glyphs.
- _textRecords.push_back(rec);
- align_line(getTextAlignment(), last_line_start_record, x);
-
- // Expand bounding box to include last column of text ...
- if ( _autoSize != autoSizeNone )
- {
- _bounds.expand_to_point(x + PADDING_TWIPS,
- y + PADDING_TWIPS);
- }
-
- // new paragraphs get the indent.
- x = std::max(0, getLeftMargin() + getIndent()) + PADDING_TWIPS;
- y += div * (getFontHeight() + leading);
-
- // Start a new record on the next line. Other properties of the
- // TextRecord should be left unchanged.
- rec.clearGlyphs();
- rec.setXOffset(x);
- rec.setYOffset(y);
-
- last_space_glyph = -1;
- last_line_start_record = _textRecords.size();
-
- linestartit = _line_starts.begin();
- linestartend = _line_starts.end();
- //Fit a line_start in the correct place
- while ( linestartit < linestartend && *linestartit < it-_text.begin())
- {
- linestartit++;
- }
- _line_starts.insert(linestartit, it-_text.begin());
-
- // BULLET CASE:
+
+ // Close out this stretch of glyphs.
+ _textRecords.push_back(rec);
+ align_line(getTextAlignment(), last_line_start_record, x);
+
+ // Expand bounding box to include last column of text ...
+ if ( _autoSize != autoSizeNone )
+ {
+ _bounds.expand_to_point(x + PADDING_TWIPS,
+ y + PADDING_TWIPS);
+ }
+
+ // new paragraphs get the indent.
+ x = std::max(0, getLeftMargin() + getIndent()) + PADDING_TWIPS;
+ y += div * (getFontHeight() + leading);
+
+ // Start a new record on the next line. Other properties of the
+ // TextRecord should be left unchanged.
+ rec.clearGlyphs();
+ rec.setXOffset(x);
+ rec.setYOffset(y);
+
+ last_space_glyph = -1;
+ last_line_start_record = _textRecords.size();
+
+ linestartit = _line_starts.begin();
+ linestartend = _line_starts.end();
+ //Fit a line_start in the correct place
+ const size_t currentPos = it - _text.begin();
+
+ while (linestartit < linestartend && *linestartit < currentPos)
+ {
+ ++linestartit;
+ }
+ _line_starts.insert(linestartit, currentPos);
+
+ // BULLET CASE:
// First, we indent 10 spaces, and then place the bullet
- // character (in this case, an asterik), then we pad it
+ // character (in this case, an asterisk), then we pad it
// again with 10 spaces
// Note: this works only for additional lines of a
// bulleted list, so that is why there is a bullet format
// in the beginning of format_text()
- if (_bullet)
+ if (_bullet)
{
- int space = rec.getFont()->get_glyph_index(
- 32, _embedFonts);
- SWF::TextRecord::GlyphEntry ge;
- ge.index = space;
- ge.advance = scale * rec.getFont()->get_advance(space,
- _embedFonts);
-
- rec.addGlyph(ge,10);
+ int space = rec.getFont()->get_glyph_index(32, _embedFonts);
+ SWF::TextRecord::GlyphEntry ge;
+ ge.index = space;
+ ge.advance = scale * rec.getFont()->get_advance(space, _embedFonts);
+
+ rec.addGlyph(ge,10);
- int bullet = rec.getFont()->get_glyph_index(42, _embedFonts);
- ge.index = bullet;
- ge.advance = scale * rec.getFont()->get_advance(bullet,
- _embedFonts);
- rec.addGlyph(ge);
+ int bullet = rec.getFont()->get_glyph_index(42, _embedFonts);
+ ge.index = bullet;
+ ge.advance = scale * rec.getFont()->get_advance(bullet, _embedFonts);
+ rec.addGlyph(ge);
- ge.index = space;
- ge.advance = scale * rec.getFont()->get_advance(space,
- _embedFonts);
-
- rec.addGlyph(ge,9);
- }
+ ge.index = space;
+ ge.advance = scale * rec.getFont()->get_advance(space, _embedFonts);
+
+ rec.addGlyph(ge,9);
+ }
}
void
-TextField::handleChar(std::wstring::const_iterator& it, const
std::wstring::const_iterator& e,
- boost::int32_t& x, boost::int32_t& y, SWF::TextRecord& rec, int&
last_code, int& last_space_glyph,
- int& last_line_start_record)
+TextField::handleChar(std::wstring::const_iterator& it,
+ const std::wstring::const_iterator& e, boost::int32_t& x,
+ boost::int32_t& y, SWF::TextRecord& rec, int& last_code,
+ int& last_space_glyph, LineStarts::value_type& last_line_start_record)
{
- std::vector<int>::iterator linestartit = _line_starts.begin();
- std::vector<int>::const_iterator linestartend = _line_starts.end();
-
- float scale = _fontHeight / (float)_font->unitsPerEM(_embedFonts);
+ LineStarts::iterator linestartit = _line_starts.begin();
+ LineStarts::const_iterator linestartend = _line_starts.end();
+
+ float scale = _fontHeight / (float)_font->unitsPerEM(_embedFonts);
float fontDescent = _font->descent() * scale;
float fontLeading = _font->leading() * scale;
- float leading = getLeading();
+ float leading = getLeading();
leading += fontLeading * scale; // not sure this is correct...
-
- boost::uint32_t code = 0;
- while (it != e)
- {
- code = *it++;
- if (!code) break;
-
- if ( _embedFonts )
- {
- x += rec.getFont()->get_kerning_adjustment(last_code,
- static_cast<int>(code)) * scale;
- last_code = static_cast<int>(code);
- }
-
- // Expand the bounding-box to the lower-right corner of each
glyph as
- // we generate it.
- m_text_bounding_box.expand_to_point(x, y + fontDescent);
- switch (code)
- {
- case 27:
- // Ignore escape
- break;
- case 9:
- insertTab(rec, x, scale);
- break;
- case 8:
- // Backspace
-
- // This is a limited hack to enable overstrike
effects.
- // It backs the cursor up by one DisplayObject
and then continues
- // the layout. E.g. you can use this to
display an underline
- // cursor inside a simulated text-entry box.
- //
- // ActionScript understands the '\b' escape
sequence
- // for inserting a BS DisplayObject.
- //
- // ONLY WORKS FOR BACKSPACING OVER ONE
CHARACTER, WON'T BS
- // OVER NEWLINES, ETC.
-
- if (!rec.glyphs().empty())
- {
- // Peek at the previous glyph, and zero
out its advance
- // value, so the next char overwrites
it.
- float advance =
rec.glyphs().back().advance;
- x -= advance;
- // Remove one glyph
- rec.clearGlyphs(1);
- }
- continue;
- case 13:
- case 10:
- {
-
newLine(it,x,y,rec,last_space_glyph,last_line_start_record,1.0);
- break;
- }
- case '<':
- if (doHtml())
- {
- //close out this stretch of glyphs
- _textRecords.push_back(rec);
- if (*it == '/') {
- while (it != e && *it != '>') {
- ++it;
- }
- ++it;
- return;
- }
- rec.clearGlyphs();
- LOG_ONCE(log_debug(_("HTML in a text
field is unsupported, "
-
"gnash will just ignore the tags and "
-
"print their content")));
-
- std::wstring discard;
- std::map<std::string, std::string>
attributes;
- SWF::TextRecord newrec;
- newrec.setFont(rec.getFont());
- newrec.setUnderline(rec.underline());
- newrec.setColor(rec.color());
- newrec.setTextHeight(rec.textHeight());
- newrec.setXOffset(x);
- newrec.setYOffset(y);
- bool complete = parseHTML(discard,
attributes, it, e);
- std::string s(discard.begin(),
discard.end());
- s.assign(discard.begin(),
discard.end());
- if (!complete) continue;
- else {
- //Don't think this is the best
way to match with tags...
- if (s == "u") {
- //underline
-
newrec.setUnderline(true);
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "a") {
- //anchor
- log_unimpl("<a> html
tag in TextField");
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "b") {
- //bold
- Font* boldfont = new
Font(rec.getFont()->name(), true, rec.getFont()->isItalic());
-
newrec.setFont(boldfont);
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "font") {
- //font
- log_unimpl("<font> html
tag in TextField");
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "img") {
- //image
- log_unimpl("<img> html
tag in TextField");
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "i") {
- //italic
- Font* italicfont = new
Font(rec.getFont()->name(), rec.getFont()->isBold(), true);
-
newrec.setFont(italicfont);
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "li") {
- //list item (bullet)
- log_unimpl("<li> html
tag in TextField");
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "span") {
- //span
- log_unimpl("<span> html
tag in TextField");
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "textformat") {
- //text format
-
log_unimpl("<textformat> html tag in TextField");
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- } else if (s == "p") {
- //paragraph
- log_unimpl("<p> html
tag in TextField");
- if ( _display == 0)
- {
-
newLine(it,x,y,rec,last_space_glyph,last_line_start_record,1.5);
- handleChar(it,
e, x, y, newrec, last_code, last_space_glyph, last_line_start_record);
-
newLine(it,x,y,rec,last_space_glyph,last_line_start_record,1.0);
- }
- else
- {
- handleChar(it,
e, x, y, newrec, last_code, last_space_glyph, last_line_start_record);
- }
- } else if (s == "br") {
- //line break
- log_unimpl("<br> html
tag in TextField");
- } else {
- log_debug("<%s> tag is
unsupported", s);
- ///THIS IS DANGEROUS.
IF TAG HAS NO CLOSING TAG, THIS MAY PRODUCE UNDESIRED RESULTS
- handleChar(it, e, x, y,
newrec, last_code, last_space_glyph, last_line_start_record);
- }
- }
- rec.setXOffset(x);
- rec.setYOffset(y);
- continue;
- }
- // If HTML isn't enabled, carry on and insert
the glyph.
- case 32:
- last_space_glyph = rec.glyphs().size();
- // Don't break, as we still need to insert the
space glyph.
-
- default:
- {
-
- if ( password() )
- {
- SWF::TextRecord::GlyphEntry ge;
- int bullet =
rec.getFont()->get_glyph_index(42, _embedFonts);
+
+ boost::uint32_t code = 0;
+ while (it != e)
+ {
+ code = *it++;
+ if (!code) break;
+
+ if ( _embedFonts )
+ {
+ x += rec.getFont()->get_kerning_adjustment(last_code,
+ static_cast<int>(code)) * scale;
+ last_code = static_cast<int>(code);
+ }
+
+ // Expand the bounding-box to the lower-right corner of each glyph as
+ // we generate it.
+ m_text_bounding_box.expand_to_point(x, y + fontDescent);
+ switch (code)
+ {
+ case 27:
+ // Ignore escape
+ break;
+ case 9:
+ insertTab(rec, x, scale);
+ break;
+ case 8:
+ // Backspace
+
+ // This is a limited hack to enable overstrike effects.
+ // It backs the cursor up by one DisplayObject and then
continues
+ // the layout. E.g. you can use this to display an underline
+ // cursor inside a simulated text-entry box.
+ //
+ // ActionScript understands the '\b' escape sequence
+ // for inserting a BS DisplayObject.
+ //
+ // ONLY WORKS FOR BACKSPACING OVER ONE CHARACTER, WON'T BS
+ // OVER NEWLINES, ETC.
+
+ if (!rec.glyphs().empty())
+ {
+ // Peek at the previous glyph, and zero out its advance
+ // value, so the next char overwrites it.
+ float advance = rec.glyphs().back().advance;
+ x -= advance;
+ // Remove one glyph
+ rec.clearGlyphs(1);
+ }
+ continue;
+ case 13:
+ case 10:
+ {
+
newLine(it,x,y,rec,last_space_glyph,last_line_start_record,1.0);
+ break;
+ }
+ case '<':
+ if (doHtml())
+ {
+ //close out this stretch of glyphs
+ _textRecords.push_back(rec);
+ if (*it == '/') {
+ while (it != e && *it != '>') {
+ ++it;
+ }
+ ++it;
+ return;
+ }
+ rec.clearGlyphs();
+ LOG_ONCE(log_debug(_("HTML in a text field is unsupported,
"
+ "gnash will just ignore the tags and "
+ "print their content")));
+
+ std::wstring discard;
+ std::map<std::string, std::string> attributes;
+ SWF::TextRecord newrec;
+ newrec.setFont(rec.getFont());
+ newrec.setUnderline(rec.underline());
+ newrec.setColor(rec.color());
+ newrec.setTextHeight(rec.textHeight());
+ newrec.setXOffset(x);
+ newrec.setYOffset(y);
+ bool complete = parseHTML(discard, attributes, it, e);
+ std::string s(discard.begin(), discard.end());
+ s.assign(discard.begin(), discard.end());
+ if (!complete) continue;
+ else {
+ //Don't think this is the best way to match with
tags...
+ if (s == "u") {
+ //underline
+ newrec.setUnderline(true);
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "a") {
+ //anchor
+ log_unimpl("<a> html tag in TextField");
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "b") {
+ //bold
+ Font* boldfont = new Font(rec.getFont()->name(),
+ true, rec.getFont()->isItalic());
+ newrec.setFont(boldfont);
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "font") {
+ //font
+ log_unimpl("<font> html tag in TextField");
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "img") {
+ //image
+ log_unimpl("<img> html tag in TextField");
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "i") {
+ //italic
+ Font* italicfont = new Font(rec.getFont()->name(),
+ rec.getFont()->isBold(), true);
+ newrec.setFont(italicfont);
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "li") {
+ //list item (bullet)
+ log_unimpl("<li> html tag in TextField");
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "span") {
+ //span
+ log_unimpl("<span> html tag in TextField");
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "textformat") {
+ //text format
+ log_unimpl("<textformat> html tag in TextField");
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ } else if (s == "p") {
+ //paragraph
+ log_unimpl("<p> html tag in TextField");
+ if (_display == BLOCK)
+ {
+ newLine(it, x, y, rec, last_space_glyph,
+ last_line_start_record, 1.5);
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph,
+ last_line_start_record);
+ newLine(it, x, y, rec, last_space_glyph,
+ last_line_start_record, 1.0);
+ }
+ else
+ {
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph,
+ last_line_start_record);
+ }
+ } else if (s == "br") {
+ //line break
+ log_unimpl("<br> html tag in TextField");
+ } else {
+ log_debug("<%s> tag is unsupported", s);
+ // THIS IS DANGEROUS. IF TAG HAS NO CLOSING TAG,
+ // THIS MAY PRODUCE UNDESIRED RESULTS
+ handleChar(it, e, x, y, newrec, last_code,
+ last_space_glyph, last_line_start_record);
+ }
+ }
+ rec.setXOffset(x);
+ rec.setYOffset(y);
+ continue;
+ }
+ // If HTML isn't enabled, carry on and insert the glyph.
+ case 32:
+ last_space_glyph = rec.glyphs().size();
+ // Don't break, as we still need to insert the space glyph.
+
+ default:
+ {
+
+ if ( password() )
+ {
+ SWF::TextRecord::GlyphEntry ge;
+ int bullet = rec.getFont()->get_glyph_index(42,
_embedFonts);
ge.index = bullet;
ge.advance = scale * rec.getFont()->get_advance(bullet,
_embedFonts);
rec.addGlyph(ge);
- break;
- }
- // The font table holds up to 65535 glyphs.
Casting
- // from uint32_t would, in the event that the
code
- // is higher than 65535, result in the wrong
DisplayObject
- // being chosen. Flash can currently only
handle 16-bit
- // values.
- int index = rec.getFont()->get_glyph_index(
-
static_cast<boost::uint16_t>(code), _embedFonts);
-
- IF_VERBOSE_MALFORMED_SWF (
- if (index == -1)
- {
- // Missing glyph! Log the first
few errors.
- static int s_log_count = 0;
- if (s_log_count < 10)
- {
- s_log_count++;
- if (_embedFonts)
- {
-
log_swferror(_("TextField: missing embedded "
- "glyph
for char %d. Make sure DisplayObject "
- "shapes
for font %s are being exported "
- "into
your SWF file"),
- code,
_font->name());
- }
- else
- {
-
log_swferror(_("TextField: missing device "
- "glyph
for char %d. Maybe you don't have "
- "font
'%s' installed in your system."),
- code,
_font->name());
- }
- }
-
- // Drop through and use index
== -1; this will display
- // using the empty-box glyph
- }
- );
-
- SWF::TextRecord::GlyphEntry ge;
- ge.index = index;
- ge.advance = scale *
rec.getFont()->get_advance(index,
- _embedFonts);
-
- rec.addGlyph(ge);
-
- x += ge.advance;
- }
- }
-
- float width = _bounds.width();
- if (x >= width - getRightMargin() - PADDING_TWIPS)
- {
-#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() && getAutoSize() == autoSizeNone)
- {
-#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)
- {
- code = *it++;
- if (_embedFonts)
- {
- x +=
rec.getFont()->get_kerning_adjustment(last_code,
-
static_cast<int>(code)) * scale;
- last_code = code;
- }
- // Expand the bounding-box to the
lower-right corner
- // of each glyph, even if we don't
display it
- m_text_bounding_box.expand_to_point(x,
y + fontDescent);
-#ifdef GNASH_DEBUG_TEXT_FORMATTING
- log_debug("Text bbox expanded to %s
(width: %f)",
- m_text_bounding_box,
m_text_bounding_box.width());
-#endif
-
- if (code == 13 || code == 10)
- {
- newlinefound = true;
- break;
- }
-
- int index =
rec.getFont()->get_glyph_index(
-
static_cast<boost::uint16_t>(code), _embedFonts);
- x += scale *
rec.getFont()->get_advance(index, _embedFonts);
-
- }
- if (!newlinefound) break;
- }
-
-#ifdef GNASH_DEBUG_TEXT_FORMATTING
- log_debug(" wordWrap=true");
-#endif
-
-
- // Insert newline if there's space or autosize
!= none
-
- // Close out this stretch of glyphs.
- _textRecords.push_back(rec);
-
- float previous_x = x;
- x = std::max(0, getLeftMargin() + getIndent())
+ PADDING_TWIPS;
- y += _fontHeight + leading;
-
- // Start a new record on the next line.
- rec.clearGlyphs();
- rec.setXOffset(x);
- rec.setYOffset(y);
-
- // TODO : what if m_text_glyph_records is empty
?
- // Is it possible ?
- assert(!_textRecords.empty());
- SWF::TextRecord& last_line =
_textRecords.back();
-
- linestartit = _line_starts.begin();
- linestartend = _line_starts.end();
- if (last_space_glyph == -1)
- {
- // Pull the previous glyph down onto the
- // new line.
- if (!last_line.glyphs().empty())
- {
-
rec.addGlyph(last_line.glyphs().back());
- x +=
last_line.glyphs().back().advance;
- previous_x -=
last_line.glyphs().back().advance;
- last_line.clearGlyphs(1);
- //record the new line start
- while ( linestartit !=
linestartend && *linestartit <= (it-_text.begin())-1)
- {
- linestartit++;
- }
-
_line_starts.insert(linestartit, (it-_text.begin()));
- }
- } else {
- // Move the previous word down onto the
next line.
-
- previous_x -=
last_line.glyphs()[last_space_glyph].advance;
-
- const
SWF::TextRecord::Glyphs::size_type lineSize =
- last_line.glyphs().size();
- for (unsigned int i = last_space_glyph
+ 1; i < lineSize;
- ++i)
- {
-
rec.addGlyph(last_line.glyphs()[i]);
- x +=
last_line.glyphs()[i].advance;
- previous_x -=
last_line.glyphs()[i].advance;
- }
- last_line.clearGlyphs(lineSize -
last_space_glyph);
-
- //record the position at the start of
this line as a line_start
- int linestartpos =
(it-_text.begin())-rec.glyphs().size();
- while ( linestartit < linestartend &&
*linestartit < linestartpos)
- {
- linestartit++;
- }
- _line_starts.insert(linestartit,
linestartpos);
- }
-
- align_line(getTextAlignment(),
last_line_start_record, previous_x);
-
- last_space_glyph = -1;
- last_line_start_record = _textRecords.size();
-
- }
- else
- {
-#ifdef GNASH_DEBUG_TEXT_FORMATTING
- log_debug(" wordWrap=%d, autoSize=%d",
_wordWrap, _autoSize);
-#endif
- }
- }
-
- // TODO: HTML markup
-
+ break;
+ }
+ // The font table holds up to 65535 glyphs. Casting
+ // from uint32_t would, in the event that the code
+ // is higher than 65535, result in the wrong DisplayObject
+ // being chosen. Flash can currently only handle 16-bit
+ // values.
+ int index = rec.getFont()->get_glyph_index(
+ static_cast<boost::uint16_t>(code), _embedFonts);
+
+ IF_VERBOSE_MALFORMED_SWF (
+ if (index == -1)
+ {
+ // Missing glyph! Log the first few errors.
+ static int s_log_count = 0;
+ if (s_log_count < 10)
+ {
+ s_log_count++;
+ if (_embedFonts)
+ {
+ log_swferror(_("TextField: missing embedded "
+ "glyph for char %d. Make sure
DisplayObject "
+ "shapes for font %s are being exported "
+ "into your SWF file"),
+ code, _font->name());
+ }
+ else
+ {
+ log_swferror(_("TextField: missing device "
+ "glyph for char %d. Maybe you don't have "
+ "font '%s' installed in your system."),
+ code, _font->name());
+ }
+ }
+
+ // Drop through and use index == -1; this will display
+ // using the empty-box glyph
+ }
+ );
+
+ SWF::TextRecord::GlyphEntry ge;
+ ge.index = index;
+ ge.advance = scale * rec.getFont()->get_advance(index,
+ _embedFonts);
+
+ rec.addGlyph(ge);
+
+ x += ge.advance;
+ }
+ }
+
+ float width = _bounds.width();
+ if (x >= width - getRightMargin() - PADDING_TWIPS)
+ {
+#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() && getAutoSize() == autoSizeNone)
+ {
+#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)
+ {
+ code = *it++;
+ if (_embedFonts)
+ {
+ x += rec.getFont()->get_kerning_adjustment(last_code,
+ static_cast<int>(code)) * scale;
+ last_code = code;
+ }
+ // Expand the bounding-box to the lower-right corner
+ // of each glyph, even if we don't display it
+ m_text_bounding_box.expand_to_point(x, y + fontDescent);
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug("Text bbox expanded to %s (width: %f)",
+ m_text_bounding_box, m_text_bounding_box.width());
+#endif
+
+ if (code == 13 || code == 10)
+ {
+ newlinefound = true;
+ break;
+ }
+
+ int index = rec.getFont()->get_glyph_index(
+ static_cast<boost::uint16_t>(code), _embedFonts);
+ x += scale * rec.getFont()->get_advance(index,
_embedFonts);
+
+ }
+ if (!newlinefound) break;
+ }
+ else if (doWordWrap()) {
+
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug(" wordWrap=true");
+#endif
+
+ // Insert newline if there's space or autosize != none
+
+ // Close out this stretch of glyphs.
+ _textRecords.push_back(rec);
+
+ float previous_x = x;
+ x = std::max(0, getLeftMargin() + getIndent()) + PADDING_TWIPS;
+ y += _fontHeight + leading;
+
+ // Start a new record on the next line.
+ rec.clearGlyphs();
+ rec.setXOffset(x);
+ rec.setYOffset(y);
+
+ // TODO : what if m_text_glyph_records is empty ?
+ // Is it possible ?
+ assert(!_textRecords.empty());
+ SWF::TextRecord& last_line = _textRecords.back();
+
+ linestartit = _line_starts.begin();
+ linestartend = _line_starts.end();
+ if (last_space_glyph == -1)
+ {
+ // Pull the previous glyph down onto the
+ // new line.
+ if (!last_line.glyphs().empty())
+ {
+ rec.addGlyph(last_line.glyphs().back());
+ x += last_line.glyphs().back().advance;
+ previous_x -= last_line.glyphs().back().advance;
+ last_line.clearGlyphs(1);
+ //record the new line start
+ //
+ const size_t currentPos = it - _text.begin();
+ while (linestartit != linestartend &&
+ *linestartit + 1 <= currentPos)
+ {
+ linestartit++;
+ }
+ _line_starts.insert(linestartit, currentPos);
+ }
+ } else {
+ // Move the previous word down onto the next line.
+
+ previous_x -= last_line.glyphs()[last_space_glyph].advance;
+
+ const SWF::TextRecord::Glyphs::size_type lineSize =
+ last_line.glyphs().size();
+ for (unsigned int i = last_space_glyph + 1; i < lineSize;
+ ++i)
+ {
+ rec.addGlyph(last_line.glyphs()[i]);
+ x += last_line.glyphs()[i].advance;
+ previous_x -= last_line.glyphs()[i].advance;
+ }
+ last_line.clearGlyphs(lineSize - last_space_glyph);
+
+ // record the position at the start of this line as
+ // a line_start
+ const size_t linestartpos = (it - _text.begin()) -
+ rec.glyphs().size();
+
+ while (linestartit < linestartend &&
+ *linestartit < linestartpos)
+ {
+ ++linestartit;
+ }
+ _line_starts.insert(linestartit, linestartpos);
+ }
+
+ align_line(getTextAlignment(), last_line_start_record,
previous_x);
+
+ last_space_glyph = -1;
+ last_line_start_record = _textRecords.size();
+
+ }
+ else
+ {
+#ifdef GNASH_DEBUG_TEXT_FORMATTING
+ log_debug(" wordWrap=%d, autoSize=%d", _wordWrap, _autoSize);
+#endif
+ }
+ }
+ }
+
}
@@ -1865,40 +1904,41 @@
/// tag was incomplete. The iterator is moved to after
/// the closing tag or the end of the string.
bool
-TextField::parseHTML(std::wstring& tag, std::map<std::string, std::string>
attributes,
- std::wstring::const_iterator&
it,
- const std::wstring::const_iterator& e) const
+TextField::parseHTML(std::wstring& tag,
+ std::map<std::string, std::string> /*attributes*/,
+ std::wstring::const_iterator& it,
+ const std::wstring::const_iterator& e) const
{
- std::string attname;
- std::string attvalue;
+ std::string attname;
+ std::string attvalue;
bool complete = false;
while (it != e) {
//if (*it == ' ') {
- //++it;
- //while (it != e && *it != ' ') {
- //while (it != e && *it != '=') {
- //if (*it == 0) break;
- //attname.push_back(*it);
- //++it;
- //}
- //++it
- //if (*it == 0) break;
- //attvalue.push_back(*it);
- //}
- //}
+ //++it;
+ //while (it != e && *it != ' ') {
+ //while (it != e && *it != '=') {
+ //if (*it == 0) break;
+ //attname.push_back(*it);
+ //++it;
+ //}
+ //++it
+ //if (*it == 0) break;
+ //attvalue.push_back(*it);
+ //}
+ //}
- if (*it == '>') {
+ if (*it == '>') {
++it;
complete = true;
break;
}
-
+
// Check for NULL DisplayObject
if (*it == 0) break;
tag.push_back(*it);
- ++it;
+ ++it;
}
#ifdef GNASH_DEBUG_TEXTFIELDS
@@ -2116,40 +2156,27 @@
}
}
-// ADDED
void
TextField::setBullet(bool b)
{
- if ( _bullet != b )
- {
+ if (_bullet != b) {
_bullet = b;
format_text();
}
}
-// ADDED
void
-TextField::setTabStops(std::vector<int> tabStops)
+TextField::setTabStops(const std::vector<int>& tabStops)
{
- _tabStops.resize(tabStops.size());
-
- for (int i = 0; i < tabStops.size(); i++)
- {
- if ( _tabStops[i] != tabStops[i] )
- {
- _tabStops[i]=tabStops[i];
- }
- }
- format_text();
- set_invalidated();
+ _tabStops = tabStops;
+ format_text();
+ set_invalidated();
}
-// ADDED
void
TextField::setURL(std::string url)
{
- if ( _url != url )
- {
+ if ( _url != url ) {
set_invalidated();
_url = url;
}
@@ -2901,13 +2928,13 @@
if ( tf->colorDefined() ) text->setTextColor(tf->color());
if ( tf->underlinedDefined() ) text->setUnderlined(tf->underlined());
- LOG_ONCE( log_unimpl("tf->target(): %s ", tf->target()) );
+ LOG_ONCE( log_unimpl("tf->target(): %s ", tf->target()) );
LOG_ONCE( log_unimpl("tf->display(): %s", tf->display()) );
- LOG_ONCE( log_unimpl("tf->url(): %s", tf->url()) );
+ LOG_ONCE( log_unimpl("tf->url(): %s", tf->url()) );
- // ADDED (completed)
- if ( tf->bulletDefined() ) text->setBullet(tf->bullet());
- if ( tf->displayDefined() ) text->setDisplay(tf->display());
+ // ADDED (completed)
+ if ( tf->bulletDefined() ) text->setBullet(tf->bullet());
+ if ( tf->displayDefined() ) text->setDisplay(tf->display());
// URL CASE:
if ( tf->urlDefined() )
@@ -2921,10 +2948,10 @@
//~ text->setTextColor(color);
//~ text->setUnderlined(true);
- // TARGET CASE:
- // gets correct _target...need to implement
- if (tf->targetDefined() )
- {
+ // TARGET CASE:
+ // gets correct _target...need to implement
+ if (tf->targetDefined() )
+ {
//~ if (tf->target()=="_blank")
//~ system("firefox -remote 'openurl(http://www.blank.org)'");
//~ else if (tf->target()=="_self") {
@@ -2936,15 +2963,15 @@
//~ else if (tf->target()=="_top") {
//~ system("firefox -remote 'openurl(http://www.top.com'");
//~ }
- }
+ }
}
- // TABSTOPS CASE:
- // gets correct _tabStops...need to implement
- if ( tf->tabStopsDefined() )
- {
- text->setTabStops(tf->tabStops());
- }
+ // TABSTOPS CASE:
+ // gets correct _tabStops...need to implement
+ if ( tf->tabStopsDefined() )
+ {
+ text->setTabStops(tf->tabStops());
+ }
if (isAS3(fn)) {
@@ -3122,8 +3149,8 @@
}
// Setter
- int version = getSWFVersion(*ptr);
-
+ const int version = getSWFVersion(*ptr);
+
ptr->setTextValue(
utf8::decodeCanonicalString(fn.arg(0).to_string(), version));
=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h 2009-07-27 20:14:18 +0000
+++ b/libcore/TextField.h 2009-07-28 09:23:14 +0000
@@ -42,6 +42,8 @@
{
public:
+
+ typedef std::vector<size_t> LineStarts;
/// Text alignment values
enum TextAlignment
@@ -470,13 +472,13 @@
return _bullet;
}
- std::vector<int> getTabStops() const
+ const std::vector<int>& getTabStops() const
{
return _tabStops;
}
void setUnderlined(bool v);
- void setTabStops(std::vector<int> tabStops);
+ void setTabStops(const std::vector<int>& tabStops);
void setBullet(bool b);
void setURL(std::string url);
void setTarget(std::string target);
@@ -541,17 +543,20 @@
void format_text();
/// Move viewable lines based on m_cursor
- void changeTopVisibleLine(int current_line);
+ void changeTopVisibleLine(size_t current_line);
/// Handles a new line, this will be called several times, so this
/// will hopefully make code cleaner
- void newLine(std::wstring::const_iterator& it, boost::int32_t& x,
boost::int32_t& y, SWF::TextRecord& rec,
- int& last_space_glyph, int&
last_line_start_record, float div);
+ void newLine(std::wstring::const_iterator& it, boost::int32_t& x,
+ boost::int32_t& y, SWF::TextRecord& rec, int& last_space_glyph,
+ LineStarts::value_type& last_line_start_record, float div);
/// De-reference and do appropriate action for character iterator
- void handleChar(std::wstring::const_iterator& it, const
std::wstring::const_iterator& e,
- boost::int32_t& x, boost::int32_t& y, SWF::TextRecord& rec,
int& last_code,
- int& last_space_glyph, int& last_line_start_record);
+ void handleChar(std::wstring::const_iterator& it,
+ const std::wstring::const_iterator& e, boost::int32_t& x,
+ boost::int32_t& y, SWF::TextRecord& rec, int& last_code,
+ int& last_space_glyph,
+ LineStarts::value_type& last_line_start_record);
/// Extracts an HTML tag.
///
@@ -562,9 +567,10 @@
/// @param e An iterator pointing to the end of the string.
/// @return Whether the tag is complete or not (i.e. whether a '>'
/// was found).
- bool parseHTML(std::wstring& tag, std::map<std::string, std::string>
attributes,
- std::wstring::const_iterator&
it,
- const std::wstring::const_iterator& e) const;
+ bool parseHTML(std::wstring& tag,
+ std::map<std::string, std::string> attributes,
+ std::wstring::const_iterator& it,
+ const std::wstring::const_iterator& e) const;
/// Does LEFT/CENTER/RIGHT alignment on the records in
/// m_text_glyph_records[], starting with
@@ -651,12 +657,14 @@
bool m_has_focus;
size_t m_cursor;
- int _top_visible_line;
+ size_t _top_visible_line;
void show_cursor(Renderer& renderer, const SWFMatrix& mat);
float m_xcursor;
float m_ycursor;
- std::vector<int> _line_starts;
- int _linesindisplay;
+
+ LineStarts _line_starts;
+
+ size_t _linesindisplay;
/// Corresponds to the multiline property.
bool _multiline;
=== modified file 'libcore/asobj/TextFormat_as.cpp'
--- a/libcore/asobj/TextFormat_as.cpp 2009-07-27 21:26:18 +0000
+++ b/libcore/asobj/TextFormat_as.cpp 2009-07-28 08:50:43 +0000
@@ -732,10 +732,12 @@
parseDisplayString(const std::string& display)
{
StringNoCaseEqual cmp;
- if ( cmp(display, "inline") ) return TextField::INLINE;
- if ( cmp(display, "block") ) return TextField::BLOCK;
+ if (cmp(display, "inline")) return TextField::INLINE;
+ if (cmp(display, "block")) return TextField::BLOCK;
+ // Is this correct? We have to return something here...
log_debug("Invalid display string %s ", display);
+ return TextField::BLOCK;
}
const char*
@@ -768,6 +770,7 @@
return "block";
default:
log_error("Unknown display value: %d ", a);
+ return "";
}
}
=== modified file 'libcore/asobj/TextFormat_as.h'
--- a/libcore/asobj/TextFormat_as.h 2009-07-27 20:14:18 +0000
+++ b/libcore/asobj/TextFormat_as.h 2009-07-28 08:20:12 +0000
@@ -65,14 +65,12 @@
std::vector<int> tabStops() const { return _tabStops; }
bool tabStopsDefined() const { return _flags&DEFtabStops; }
- void tabStopsSet(const std::vector<int>& tabStops) {
- _tabStops.resize(tabStops.size());
- for (int i=0;i<tabStops.size();++i)
- {
- _tabStops[i] = tabStops[i];
- }
+
+ void tabStopsSet(const std::vector<int>& tabStops) {
+ _tabStops = tabStops;
_flags |= DEFtabStops;
}
+
/// \brief
/// Return an integer that indicates the indentation from the left
/// margin to the first DisplayObject in the paragraph
=== modified file 'testsuite/actionscript.all/TextFormat.as'
--- a/testsuite/actionscript.all/TextFormat.as 2009-02-25 22:33:03 +0000
+++ b/testsuite/actionscript.all/TextFormat.as 2009-07-28 07:25:34 +0000
@@ -71,8 +71,8 @@
check_equals(typeof(tfObj.underline), 'null');
check_equals(typeof(tfObj.italic), 'null');
check_equals(typeof(tfObj.bold), 'null');
-xcheck_equals(typeof(tfObj.target), 'null');
-xcheck_equals(typeof(tfObj.url), 'null');
+check_equals(typeof(tfObj.target), 'null');
+check_equals(typeof(tfObj.url), 'null');
check_equals(typeof(tfObj.color), 'null');
check_equals(typeof(tfObj.size), 'null');
check_equals(typeof(tfObj.font), 'null');
@@ -92,8 +92,8 @@
check_equals(typeof(tfObj.leftMargin), 'number'); // even if we passed a
string to it
check_equals(tfObj.leftMargin, 23);
check_equals(tfObj.align, 'center');
-xcheck_equals(tfObj.target, 'tgt');
-xcheck_equals(tfObj.url, 'http');
+check_equals(tfObj.target, 'tgt');
+check_equals(tfObj.url, 'http');
check_equals(tfObj.underline, true);
check_equals(typeof(tfObj.italic), 'boolean');
check_equals(tfObj.italic, false);
=== modified file 'testsuite/misc-haxe.all/classes.all/text/TextFormat_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/text/TextFormat_as.hx 2009-07-27
20:14:18 +0000
+++ b/testsuite/misc-haxe.all/classes.all/text/TextFormat_as.hx 2009-07-28
07:49:39 +0000
@@ -319,21 +319,21 @@
#if flash9
if (Std.string(untyped __typeof__(TextFormat) )== 'object'){
- DejaGnu.pass("The type of TextFormat is 'object' in flash 9");
- } else {
- DejaGnu.fail("The type of TextFormat is not 'object' in flash 9");
+ DejaGnu.pass("The type of TextFormat is 'object' in flash 9");
+ } else {
+ DejaGnu.fail("The type of TextFormat is not 'object' in flash 9");
}
#else
if (Std.string(untyped __typeof__(TextFormat) )== 'function'){
- DejaGnu.pass("The type of TextFormat is 'fucntion'");
- } else {
- DejaGnu.fail("The type of TextFormat is not 'fucntion'");
+ DejaGnu.pass("The type of TextFormat is 'fucntion'");
+ } else {
+ DejaGnu.fail("The type of TextFormat is not 'fucntion'");
}
#end
if (Std.string(untyped __typeof__(TextFormat.prototype))== 'object'){
- DejaGnu.pass("The type of TextFormat.prototype is 'object'");
- } else {
+ DejaGnu.pass("The type of TextFormat.prototype is 'object'");
+ } else {
DejaGnu.fail("The type of TextFormat.prototype is not 'object'");
}
@@ -344,15 +344,15 @@
// DejaGnu.note("type of TextFormat" + Type.typeof(tfObj));
if (Std.string(untyped __typeof__(tfObj))== 'object'){
- DejaGnu.pass("The type of tfObj is 'object'");
- } else {
+ DejaGnu.pass("The type of tfObj is 'object'");
+ } else {
DejaGnu.fail("The type of tfObj is not 'object'");
}
#if flash9
if (Std.is(tfObj, TextFormat) ){
- DejaGnu.pass("'tfObj' is an instance of TextFormat");
- } else {
+ DejaGnu.pass("'tfObj' is an instance of TextFormat");
+ } else {
DejaGnu.fail("'tfObj' is not an instance of TextFormat");
}
@@ -362,8 +362,8 @@
//Check "is" a instance
// DejaGnu.note(""+untyped __instanceof__(tfObj, TextFormat));
if (untyped __instanceof__(tfObj,TextFormat) ){
- DejaGnu.pass("'tfObj' is an instance of TextFormat");
- } else {
+ DejaGnu.pass("'tfObj' is an instance of TextFormat");
+ } else {
DejaGnu.fail("'tfObj' is not an instance of TextFormat");
}
#end
@@ -371,117 +371,117 @@
#if (!flash9)
if (untyped TextFormat.prototype.hasOwnProperty("display")) {
- DejaGnu.pass("TextFormat.prototype.'display' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'display' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'display' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'display' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("bullet")) {
- DejaGnu.pass("TextFormat.prototype.'bullet' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'bullet' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'bullet' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'bullet' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("tabStops")) {
- DejaGnu.pass("TextFormat.prototype.'tabStops' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'tabStops' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'tabStops' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'tabStops' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("blockIndent")) {
- DejaGnu.pass("TextFormat.prototype.'blockIndent' property
exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'blockIndent' property does
not exist");
+ DejaGnu.pass("TextFormat.prototype.'blockIndent' property
exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'blockIndent' property does
not exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("leading")) {
- DejaGnu.pass("TextFormat.prototype.'leading' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'leading' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'leading' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'leading' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("indent")) {
- DejaGnu.pass("TextFormat.prototype.'indent' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'indent' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'indent' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'indent' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("rightMargin")) {
- DejaGnu.pass("TextFormat.prototype.'rightMargin' property
exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'rightMargin' property does
not exist");
+ DejaGnu.pass("TextFormat.prototype.'rightMargin' property
exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'rightMargin' property does
not exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("leftMargin")) {
- DejaGnu.pass("TextFormat.prototype.'leftMargin' property
exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'leftMargin' property does
not exist");
+ DejaGnu.pass("TextFormat.prototype.'leftMargin' property
exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'leftMargin' property does
not exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("align")) {
- DejaGnu.pass("TextFormat.prototype.'align' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'align' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'align' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'align' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("underline")) {
- DejaGnu.pass("TextFormat.prototype.'underline' property
exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'underline' property does
not exist");
+ DejaGnu.pass("TextFormat.prototype.'underline' property
exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'underline' property does
not exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("italic")) {
- DejaGnu.pass("TextFormat.prototype.'italic' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'italic' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'italic' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'italic' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("bold")) {
- DejaGnu.pass("TextFormat.prototype.'bold' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'bold' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'bold' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'bold' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("target")) {
- DejaGnu.pass("TextFormat.prototype.'target' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'target' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'target' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'target' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("url")) {
- DejaGnu.pass("TextFormat.prototype.'url' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'url' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'url' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'url' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("color")) {
- DejaGnu.pass("TextFormat.prototype.'color' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'color' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'color' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'color' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("size")) {
- DejaGnu.pass("TextFormat.prototype.'size' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'size' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'size' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'size' property does not
exist");
}
if (untyped TextFormat.prototype.hasOwnProperty("font")) {
- DejaGnu.pass("TextFormat.prototype.'font' property exists");
- } else {
- DejaGnu.fail("TextFormat.prototype.'font' property does not
exist");
+ DejaGnu.pass("TextFormat.prototype.'font' property exists");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'font' property does not
exist");
}
if (untyped !TextFormat.prototype.hasOwnProperty("getTextExtent")) {
- DejaGnu.pass("TextFormat.prototype.'getTextExtent' property
does not exist");
- } else {
- DejaGnu.fail("TextFormat.prototype.'getTextExtent' property
exists! WRONG!");
+ DejaGnu.pass("TextFormat.prototype.'getTextExtent' property
does not exist");
+ } else {
+ DejaGnu.fail("TextFormat.prototype.'getTextExtent' property
exists! WRONG!");
}
if (untyped tfObj.hasOwnProperty("getTextExtent")) {
- DejaGnu.pass("tfObj.'getTextExtent' property exists");
- } else {
- DejaGnu.fail("tfObj.'getTextExtent' property does not exist");
+ DejaGnu.pass("tfObj.'getTextExtent' property exists");
+ } else {
+ DejaGnu.fail("tfObj.'getTextExtent' property does not exist");
}
#else
#end
@@ -494,117 +494,117 @@
#if flash9
#else
if (Std.string(untyped __typeof__(tfObj.display)) == 'string') {
- DejaGnu.xpass("Good, tfObj.display is a 'null'.");
- } else {
+ DejaGnu.xpass("Good, tfObj.display is a 'null'.");
+ } else {
DejaGnu.xfail("Wrong, tfObj.display is not 'null'.");
}
// DejaGnu.note("tfObj.display:"+Std.string(untyped tfObj.display ));
if (Std.string(untyped tfObj.display) == 'block') {
- DejaGnu.xpass("Wrong, tfObj.display equlas to block.");
- } else {
+ DejaGnu.xpass("Wrong, tfObj.display equlas to block.");
+ } else {
DejaGnu.xfail("tfObj.display does not equal to 'block'.");
}
if (Std.string(untyped __typeof__(tfObj.bullet)) == 'null') {
- DejaGnu.pass("Good, tfObj.bullet is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.bullet is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.bullet is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.tabStops)) == 'null') {
- DejaGnu.xpass("Good, tfObj.tabStops is a 'null'.");
- } else {
+ DejaGnu.xpass("Good, tfObj.tabStops is a 'null'.");
+ } else {
DejaGnu.xfail("Wrong, tfObj.tabStops is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.blockIndent)) == 'null') {
- DejaGnu.pass("Good, tfObj.blockIndent is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.blockIndent is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.blockIndent is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.leading)) == 'null') {
- DejaGnu.pass("Good, tfObj.leading is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.leading is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.leading is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.indent)) == 'null') {
- DejaGnu.pass("Good, tfObj.indent is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.indent is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.indent is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.rightMargin)) == 'null') {
- DejaGnu.pass("Good, tfObj.rightMargin is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.rightMargin is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.rightMargin is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.leftMargin)) == 'null') {
- DejaGnu.pass("Good, tfObj.leftMargin is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.leftMargin is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.leftMargin is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.align)) == 'null') {
- DejaGnu.pass("Good, tfObj.align is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.align is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.align is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.underline)) == 'null') {
- DejaGnu.pass("Good, tfObj.underline is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.underline is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.underline is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.italic)) == 'null') {
- DejaGnu.pass("Good, tfObj.italic is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.italic is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.italic is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.bold)) == 'null') {
- DejaGnu.pass("Good, tfObj.bold is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.bold is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.bold is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.target)) == 'null') {
- DejaGnu.pass("Good, tfObj.target is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.target is a 'null'.");
+ } else {
DejaGnu.xfail("Wrong, tfObj.target is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.url)) == 'null') {
- DejaGnu.xpass("Good, tfObj.url is a 'null'.");
- } else {
- DejaGnu.xfail("Wrong, tfObj.url is not 'null'.");
+ DejaGnu.pass("Good, tfObj.url is a 'null'.");
+ } else {
+ DejaGnu.fail("Wrong, tfObj.url is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.color)) == 'null') {
- DejaGnu.pass("Good, tfObj.color is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.color is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.color is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.size)) == 'null') {
- DejaGnu.pass("Good, tfObj.size is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.size is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.size is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.font)) == 'null') {
- DejaGnu.pass("Good, tfObj.font is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.font is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.font is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.getTextExtent))== 'function'){
- DejaGnu.pass("The type of tfObj.getTextExtent is 'function'");
- } else {
+ DejaGnu.pass("The type of tfObj.getTextExtent is 'function'");
+ } else {
DejaGnu.fail("The type of tfObj.getTextExtent is not 'functino'");
}
#end
@@ -626,149 +626,149 @@
#if !flash9
if (Std.string(untyped __typeof__(tfObj.display)) == 'string') {
- DejaGnu.xpass("Good, tfObj.display is a 'null'.");
- } else {
+ DejaGnu.xpass("Good, tfObj.display is a 'null'.");
+ } else {
DejaGnu.xfail("Wrong, tfObj.display is not 'null'.");
}
if (Std.string(untyped tfObj.display) == 'block') {
- DejaGnu.xpass("Wrong, tfObj.display equlas to block.");
- } else {
+ DejaGnu.xpass("Wrong, tfObj.display equlas to block.");
+ } else {
DejaGnu.xfail("tfObj.display does not equal to 'block'.");
}
if (Std.string(untyped __typeof__(tfObj.tabStops)) == 'null') {
- DejaGnu.xpass("Good, tfObj.tabStops is a 'null'.");
- } else {
+ DejaGnu.xpass("Good, tfObj.tabStops is a 'null'.");
+ } else {
DejaGnu.xfail("Wrong, tfObj.tabStops is not 'null'.");
}
if (untyped tfObj.leading == 4) {
- DejaGnu.pass("Good, tfObj.leading equals to 4.");
- } else {
+ DejaGnu.pass("Good, tfObj.leading equals to 4.");
+ } else {
DejaGnu.fail("Wrong, tfObj.leading does not equal to 4." + untyped
tfObj.leading);
}
if (untyped tfObj.indent == 12) {
- DejaGnu.pass("Good, tfObj.indent equals to 12.");
- } else {
+ DejaGnu.pass("Good, tfObj.indent equals to 12.");
+ } else {
DejaGnu.fail("Wrong, tfObj.indent does not equal to 12.");
}
if (Std.string(untyped tfObj.rightMargin) == '32') {
- DejaGnu.pass("Good, tfObj.rightMargin equals to 32.");
- } else {
+ DejaGnu.pass("Good, tfObj.rightMargin equals to 32.");
+ } else {
DejaGnu.fail("Wrong, tfObj.rightMargin does not equal to 32.");
}
if (untyped tfObj.leftMargin == 23) {
- DejaGnu.pass("Good, tfObj.leftMargin equals to 23.");
- } else {
+ DejaGnu.pass("Good, tfObj.leftMargin equals to 23.");
+ } else {
DejaGnu.fail("Wrong, tfObj.leftMargin does not equal to 23.");
}
if (untyped tfObj.font == "fname") {
- DejaGnu.pass("Good, tfObj.font equals to 'fname'.");
- } else {
+ DejaGnu.pass("Good, tfObj.font equals to 'fname'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.font does not equal to 'fname'.");
}
if (tfObj.underline == true) {
- DejaGnu.pass("Good, tfObj.underline equals to true.");
- } else {
+ DejaGnu.pass("Good, tfObj.underline equals to true.");
+ } else {
DejaGnu.fail("Wrong, tfObj.underline does not equal to true.");
}
if (tfObj.italic == false) {
- DejaGnu.pass("Good, tfObj.italic equals to false.");
- } else {
+ DejaGnu.pass("Good, tfObj.italic equals to false.");
+ } else {
DejaGnu.fail("Wrong, tfObj.italic does not equal to false.");
}
if (tfObj.bold == true) {
- DejaGnu.pass("Good, tfObj.bold equals to true.");
- } else {
+ DejaGnu.pass("Good, tfObj.bold equals to true.");
+ } else {
DejaGnu.fail("Wrong, tfObj.bold does not equal to true.");
}
if (tfObj.color == 30) {
- DejaGnu.pass("Good, tfObj.color equals to 30.");
- } else {
+ DejaGnu.pass("Good, tfObj.color equals to 30.");
+ } else {
DejaGnu.fail("Wrong, tfObj.color does not equal to 30.");
}
if (tfObj.size == 2) {
- DejaGnu.pass("Good, tfObj.size equals to 2.");
- } else {
+ DejaGnu.pass("Good, tfObj.size equals to 2.");
+ } else {
DejaGnu.fail("Wrong, tfObj.size does not equal to 2.");
}
if (Std.string(untyped __typeof__(tfObj.rightMargin) )== 'number'){
- DejaGnu.pass("Good, tfObj.rightMargin is a 'number'.");
- } else {
+ DejaGnu.pass("Good, tfObj.rightMargin is a 'number'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.rightMargin is not a 'number'.");
}
if (Std.string(untyped __typeof__(tfObj.leftMargin) )== 'number'){
- DejaGnu.pass("Good, tfObj.leftMargin is a 'number'.");
- } else {
+ DejaGnu.pass("Good, tfObj.leftMargin is a 'number'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.leftMargin is not a 'number'.");
}
if (Std.string(untyped __typeof__(tfObj.italic) )== 'boolean'){
- DejaGnu.pass("Good, tfObj.leftMargin is a 'boolean'.");
- } else {
+ DejaGnu.pass("Good, tfObj.leftMargin is a 'boolean'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.leftMargin is not a 'boolean'.");
}
if (Type.typeof(untyped tfObj.italic)==ValueType.TBool) {
//if (Std.string(untyped __typeof__(tfObj.italic))== 'boolean') {
- DejaGnu.pass("Good, tfObj.italic is a 'boolean'.");
- } else {
+ DejaGnu.pass("Good, tfObj.italic is a 'boolean'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.italic is not 'boolean'.");
}
//#if (flash6 || flash7 || flash8)
if (tfObj.align == "center") {
- DejaGnu.pass("Good, tfObj.align equals to 'center'.");
- } else {
+ DejaGnu.pass("Good, tfObj.align equals to 'center'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.align does not equal to 'center'.");
}
if (Std.string(untyped __typeof__(tfObj.string)) == 'undefined') {
- DejaGnu.pass("Good, tfObj.display is 'undefined'.");
- } else {
+ DejaGnu.pass("Good, tfObj.display is 'undefined'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.display is not 'undefined'.");
}
if (Std.string(untyped __typeof__(tfObj.tabStops)) == 'undefined') {
- DejaGnu.pass("Good, tfObj.tabStops is 'undefined'.");
- } else {
+ DejaGnu.pass("Good, tfObj.tabStops is 'undefined'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.tabStops is not 'undefined'.");
}
if (tfObj.target == "tgt") {
- DejaGnu.xpass("Wrong, tfObj.target equals to 'tgt'.");
- } else {
- DejaGnu.xfail("Good, tfObj.target does not equal to 'tgt'.");
+ DejaGnu.pass("Wrong, tfObj.target equals to 'tgt'.");
+ } else {
+ DejaGnu.fail("Good, tfObj.target does not equal to 'tgt'.");
}
if (tfObj.url == "http") {
- DejaGnu.xpass("Wrong, tfObj.url equals to 'http'.");
- } else {
- DejaGnu.xfail("Good, tfObj.url does not equal to 'http'.");
+ DejaGnu.pass("Wrong, tfObj.url equals to 'http'.");
+ } else {
+ DejaGnu.fail("Good, tfObj.url does not equal to 'http'.");
}
if (Std.string(untyped __typeof__(tfObj.bullet)) == 'null') {
- DejaGnu.pass("Good, tfObj.bullet is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.bullet is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.bullet is not 'null'.");
}
if (Std.string(untyped __typeof__(tfObj.blockIndent)) == 'null') {
- DejaGnu.pass("Good, tfObj.blockIndent is a 'null'.");
- } else {
+ DejaGnu.pass("Good, tfObj.blockIndent is a 'null'.");
+ } else {
DejaGnu.fail("Wrong, tfObj.blockIndent is not 'null'.");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11323: Fix other people's compiler warnings. Fix testsuite breakages. Expect,
Benjamin Wolsey <=