[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11558: Various changes to simplify
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11558: Various changes to simplify DisplayObjects. |
Date: |
Mon, 12 Oct 2009 16:00:53 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11558 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-10-12 16:00:53 +0200
message:
Various changes to simplify DisplayObjects.
Minor ActionScript fixes.
Tests to help implement DisplayObjects properly.
modified:
gui/gui.cpp
libcore/Bitmap.cpp
libcore/Bitmap.h
libcore/BitmapMovie.cpp
libcore/Button.cpp
libcore/Button.h
libcore/DisplayList.cpp
libcore/DisplayObject.cpp
libcore/DisplayObject.h
libcore/DisplayObjectContainer.h
libcore/InteractiveObject.h
libcore/MorphShape.cpp
libcore/MorphShape.h
libcore/Movie.h
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/Shape.h
libcore/StaticText.h
libcore/TextField.cpp
libcore/TextField.h
libcore/Video.cpp
libcore/Video.h
libcore/as_object.cpp
libcore/as_object.h
libcore/asobj/Globals.cpp
libcore/asobj/LoadableObject.cpp
libcore/asobj/flash/display/MovieClip_as.cpp
libcore/parser/BitmapMovieDefinition.cpp
libcore/parser/BitmapMovieDefinition.h
libcore/parser/SWFMovieDefinition.h
libcore/parser/sprite_definition.cpp
libcore/parser/sprite_definition.h
libcore/swf/DefineButtonTag.cpp
libcore/swf/DefineButtonTag.h
libcore/swf/DefineEditTextTag.cpp
libcore/swf/DefineEditTextTag.h
libcore/swf/DefineMorphShapeTag.cpp
libcore/swf/DefineMorphShapeTag.h
libcore/swf/DefineShapeTag.cpp
libcore/swf/DefineShapeTag.h
libcore/swf/DefineTextTag.cpp
libcore/swf/DefineTextTag.h
libcore/swf/DefineVideoStreamTag.cpp
libcore/swf/DefineVideoStreamTag.h
libcore/swf/DefinitionTag.h
testsuite/DummyCharacter.h
testsuite/DummyMovieDefinition.h
testsuite/actionscript.all/MovieClip.as
testsuite/swfdec/PASSING
=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp 2009-10-01 13:19:43 +0000
+++ b/gui/gui.cpp 2009-10-12 09:42:13 +0000
@@ -1087,7 +1087,6 @@
{
std::stringstream ss;
ss << ch->getTarget() << " (" + typeName(*ch)
- << " - id:" << ch->get_id()
<< " - depth:" << ch->get_depth()
<< " - useHandCursor:" << ch->allowHandCursor()
<< ")";
@@ -1099,7 +1098,7 @@
{
std::stringstream ss;
ss << ch->getTarget() << " (" + typeName(*ch)
- << " - id:" << ch->get_id() << " - depth:" << ch->get_depth()
+ << " - depth:" << ch->get_depth()
<< ")";
firstLevelIter = tr->append_child(topIter, StringPair("Topmost entity
under mouse pointer", ss.str()));
}
@@ -1109,7 +1108,6 @@
{
std::stringstream ss;
ss << ch->getTarget() << " (" + typeName(*ch)
- << " - id:" << ch->get_id()
<< " - depth:" << ch->get_depth() << ")";
firstLevelIter = tr->append_child(topIter, StringPair("Dragging
character: ", ss.str()));
}
=== modified file 'libcore/Bitmap.cpp'
--- a/libcore/Bitmap.cpp 2009-10-01 13:19:43 +0000
+++ b/libcore/Bitmap.cpp 2009-10-12 09:42:13 +0000
@@ -28,10 +28,9 @@
namespace gnash {
-Bitmap::Bitmap(BitmapData_as* bd, DisplayObject* parent,
- int id)
+Bitmap::Bitmap(BitmapData_as* bd, DisplayObject* parent)
:
- DisplayObject(parent, id),
+ DisplayObject(parent),
_bitmapData(bd),
_bitmapInfo(0),
_width(_bitmapData->getWidth()),
@@ -40,10 +39,9 @@
_shape.setBounds(SWFRect(0, 0, pixelsToTwips(_width),
pixelsToTwips(_height)));
}
-Bitmap::Bitmap(const BitmapMovieDefinition* const def, DisplayObject* parent,
- int id)
+Bitmap::Bitmap(const BitmapMovieDefinition* const def, DisplayObject* parent)
:
- DisplayObject(parent, id),
+ DisplayObject(parent),
_def(def),
_bitmapData(0),
_bitmapInfo(0),
=== modified file 'libcore/Bitmap.h'
--- a/libcore/Bitmap.h 2009-10-01 13:19:43 +0000
+++ b/libcore/Bitmap.h 2009-10-12 09:42:13 +0000
@@ -45,11 +45,9 @@
{
public:
- Bitmap(BitmapData_as* bd, DisplayObject* parent,
- int id);
+ Bitmap(BitmapData_as* bd, DisplayObject* parent);
- Bitmap(const BitmapMovieDefinition* const def, DisplayObject* parent,
- int id);
+ Bitmap(const BitmapMovieDefinition* const def, DisplayObject* parent);
~Bitmap();
=== modified file 'libcore/BitmapMovie.cpp'
--- a/libcore/BitmapMovie.cpp 2009-07-13 18:15:25 +0000
+++ b/libcore/BitmapMovie.cpp 2009-10-12 09:42:13 +0000
@@ -27,7 +27,7 @@
_def(def)
{
assert(def);
- boost::intrusive_ptr<DisplayObject> ch = def->createDisplayObject(this, 1);
+ boost::intrusive_ptr<DisplayObject> ch = def->createDisplayObject(this);
const int depth = 1 + DisplayObject::staticDepthOffset;
placeDisplayObject(ch.get(), depth);
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp 2009-10-08 14:33:35 +0000
+++ b/libcore/Button.cpp 2009-10-12 12:06:51 +0000
@@ -174,6 +174,16 @@
namespace gnash {
namespace {
+ as_value button_blendMode(const fn_call& fn);
+ as_value button_cacheAsBitmap(const fn_call& fn);
+ as_value button_filters(const fn_call& fn);
+ as_value button_scale9Grid(const fn_call& fn);
+ as_value button_setTabIndex(const fn_call& fn);
+ as_value button_getTabIndex(const fn_call& fn);
+ as_value button_getDepth(const fn_call& fn);
+}
+
+namespace {
class ButtonActionExecutor {
public:
@@ -259,13 +269,30 @@
const int unprotected = 0;
o.init_member(NSV::PROP_ENABLED, true, unprotected);
o.init_member("useHandCursor", true, unprotected);
+
+ const int swf8Flags = PropFlags::onlySWF8Up;
+ VM& vm = getVM(o);
+
+ o.init_property("tabIndex", *vm.getNative(105, 1), *vm.getNative(105, 2),
+ swf8Flags);
+
+ o.init_member("getDepth", vm.getNative(105, 3), unprotected);
+
+ NativeFunction* gs;
+ gs = vm.getNative(105, 4);
+ o.init_property("scale9Grid", *gs, *gs, swf8Flags);
+ gs = vm.getNative(105, 5);
+ o.init_property("filters", *gs, *gs, swf8Flags);
+ gs = vm.getNative(105, 6);
+ o.init_property("cacheAsBitmap", *gs, *gs, swf8Flags);
+ gs = vm.getNative(105, 7);
+ o.init_property("blendMode", *gs, *gs, swf8Flags);
}
-Button::Button(const SWF::DefineButtonTag* const def, DisplayObject* parent,
- int id)
+Button::Button(const SWF::DefineButtonTag* const def, DisplayObject* parent)
:
- InteractiveObject(parent, id),
+ InteractiveObject(parent),
_lastMouseFlags(FLAG_IDLE),
_mouseFlags(FLAG_IDLE),
_mouseState(MOUSESTATE_UP),
@@ -900,7 +927,7 @@
}
int
-Button::getMovieVersion() const
+Button::getDefinitionVersion() const
{
return _def->getSWFVersion();
}
@@ -939,9 +966,16 @@
}
void
-registerButtonNative(as_object& /*global*/)
+registerButtonNative(as_object& global)
{
- // TODO: button.getDepth
+ VM& vm = getVM(global);
+ vm.registerNative(button_setTabIndex, 105, 1);
+ vm.registerNative(button_getTabIndex, 105, 2);
+ vm.registerNative(button_getDepth, 105, 3);
+ vm.registerNative(button_scale9Grid, 105, 4);
+ vm.registerNative(button_filters, 105, 5);
+ vm.registerNative(button_cacheAsBitmap, 105, 6);
+ vm.registerNative(button_blendMode, 105, 7);
}
#ifdef USE_SWFTREE
@@ -985,6 +1019,65 @@
}
}
+namespace {
+
+as_value
+button_blendMode(const fn_call& fn)
+{
+ as_object* obj = ensureType<Button>(fn.this_ptr).get();
+ UNUSED(obj);
+ return as_value();
+}
+
+as_value
+button_cacheAsBitmap(const fn_call& fn)
+{
+ as_object* obj = ensureType<Button>(fn.this_ptr).get();
+ UNUSED(obj);
+ return as_value();
+}
+
+as_value
+button_filters(const fn_call& fn)
+{
+ as_object* obj = ensureType<Button>(fn.this_ptr).get();
+ UNUSED(obj);
+ return as_value();
+}
+
+as_value
+button_scale9Grid(const fn_call& fn)
+{
+ as_object* obj = ensureType<Button>(fn.this_ptr).get();
+ UNUSED(obj);
+ return as_value();
+}
+
+as_value
+button_getTabIndex(const fn_call& fn)
+{
+ as_object* obj = ensureType<Button>(fn.this_ptr).get();
+ UNUSED(obj);
+ return as_value();
+}
+
+as_value
+button_setTabIndex(const fn_call& fn)
+{
+ as_object* obj = ensureType<Button>(fn.this_ptr).get();
+ UNUSED(obj);
+ return as_value();
+}
+
+as_value
+button_getDepth(const fn_call& fn)
+{
+ as_object* obj = ensureType<Button>(fn.this_ptr).get();
+ UNUSED(obj);
+ return as_value();
+}
+
+} // anonymous namespace
} // end of namespace gnash
=== modified file 'libcore/Button.h'
--- a/libcore/Button.h 2009-10-08 14:33:35 +0000
+++ b/libcore/Button.h 2009-10-12 09:42:13 +0000
@@ -70,8 +70,7 @@
MOUSESTATE_HIT
};
- Button(const SWF::DefineButtonTag* const def, DisplayObject* parent,
- int id);
+ Button(const SWF::DefineButtonTag* const def, DisplayObject* parent);
~Button();
@@ -192,10 +191,8 @@
///
void get_active_records(ActiveRecords& list, MouseState state);
- /// \brief
- /// Return version of the SWF containing
- /// the button definition this is an instance of.
- int getMovieVersion() const;
+ /// Return version of the SWF containing the button definition.
+ virtual int getDefinitionVersion() const;
};
=== modified file 'libcore/DisplayList.cpp'
--- a/libcore/DisplayList.cpp 2009-07-10 15:44:55 +0000
+++ b/libcore/DisplayList.cpp 2009-10-12 09:42:13 +0000
@@ -753,9 +753,8 @@
endIt = _charsByDepth.end(); it != endIt; ++it) {
const DisplayItem& dobj = *it;
- log_debug(_("Item %d at depth %d (char id %d, name %s, type %s)"),
- num, dobj->get_depth(), dobj->get_id(),
- dobj->get_name(), typeName(*dobj));
+ log_debug(_("Item %d at depth %d (char name %s, type %s)"),
+ num, dobj->get_depth(), dobj->get_name(), typeName(*dobj));
num++;
}
}
@@ -1143,9 +1142,8 @@
const DisplayItem& item = *it;
if (it != dl._charsByDepth.begin()) os << " | ";
- os << "ch id:" << item->get_id()
- << " name:" << item->get_name()
- << " depth:" << item->get_depth();
+ os << " name:" << item->get_name()
+ << " depth:" << item->get_depth();
}
return os;
=== modified file 'libcore/DisplayObject.cpp'
--- a/libcore/DisplayObject.cpp 2009-10-09 07:50:35 +0000
+++ b/libcore/DisplayObject.cpp 2009-10-12 09:42:13 +0000
@@ -74,12 +74,11 @@
const int DisplayObject::removedDepthOffset;
const int DisplayObject::noClipDepthValue;
-DisplayObject::DisplayObject(DisplayObject* parent, int id)
+DisplayObject::DisplayObject(DisplayObject* parent)
:
m_parent(parent),
m_invalidated(true),
m_child_invalidated(true),
- m_id(id),
m_depth(0),
_xscale(100),
_yscale(100),
@@ -96,7 +95,6 @@
_scriptTransformed(false),
_dynamicallyCreated(false)
{
- assert((!parent && m_id == -1) || ((parent) && m_id >= 0));
assert(m_old_invalidated_ranges.isNull());
// This informs the core that the object is a DisplayObject.
=== modified file 'libcore/DisplayObject.h'
--- a/libcore/DisplayObject.h 2009-10-08 16:10:00 +0000
+++ b/libcore/DisplayObject.h 2009-10-12 09:42:13 +0000
@@ -96,7 +96,7 @@
{
public:
- DisplayObject(DisplayObject* parent, int id);
+ DisplayObject(DisplayObject* parent);
virtual ~DisplayObject() {}
@@ -170,9 +170,6 @@
return m_parent->get_environment();
}
- // Accessors for basic display info.
- int get_id() const { return m_id; }
-
/// \brief
/// Return the parent of this DisplayObject, or NULL if
/// the DisplayObject has no parent.
@@ -209,6 +206,11 @@
///
int getWorldVolume() const;
+ /// DisplayObjects can return the version of the SWF they were parsed from.
+ virtual int getDefinitionVersion() const {
+ return -1;
+ }
+
/// Get local transform SWFMatrix for this DisplayObject
const SWFMatrix& getMatrix() const { return m_matrix; }
@@ -1060,8 +1062,6 @@
/// Build the _target member recursive on parent
std::string computeTargetPath() const;
- int m_id;
-
int m_depth;
cxform m_color_transform;
SWFMatrix m_matrix;
=== modified file 'libcore/DisplayObjectContainer.h'
--- a/libcore/DisplayObjectContainer.h 2009-06-04 07:14:33 +0000
+++ b/libcore/DisplayObjectContainer.h 2009-10-12 09:42:13 +0000
@@ -48,9 +48,9 @@
public:
- DisplayObjectContainer(DisplayObject* parent, int id)
+ DisplayObjectContainer(DisplayObject* parent)
:
- InteractiveObject(parent, id)
+ InteractiveObject(parent)
{}
virtual ~DisplayObjectContainer();
=== modified file 'libcore/InteractiveObject.h'
--- a/libcore/InteractiveObject.h 2009-10-07 11:54:54 +0000
+++ b/libcore/InteractiveObject.h 2009-10-12 09:42:13 +0000
@@ -43,9 +43,9 @@
public:
- InteractiveObject(DisplayObject* parent, int id)
+ InteractiveObject(DisplayObject* parent)
:
- DisplayObject(parent, id)
+ DisplayObject(parent)
{
}
=== modified file 'libcore/MorphShape.cpp'
--- a/libcore/MorphShape.cpp 2009-10-01 13:19:43 +0000
+++ b/libcore/MorphShape.cpp 2009-10-12 09:42:13 +0000
@@ -28,9 +28,9 @@
MorphShape::MorphShape(const SWF::DefineMorphShapeTag* const def,
- DisplayObject* parent, int id)
+ DisplayObject* parent)
:
- DisplayObject(parent, id),
+ DisplayObject(parent),
_def(def),
_shape(_def->shape1())
{
=== modified file 'libcore/MorphShape.h'
--- a/libcore/MorphShape.h 2009-10-01 13:19:43 +0000
+++ b/libcore/MorphShape.h 2009-10-12 09:42:13 +0000
@@ -51,7 +51,7 @@
public:
MorphShape(const SWF::DefineMorphShapeTag* const def,
- DisplayObject* parent, int id);
+ DisplayObject* parent);
virtual void display(Renderer& renderer);
=== modified file 'libcore/Movie.h'
--- a/libcore/Movie.h 2009-04-15 06:22:17 +0000
+++ b/libcore/Movie.h 2009-10-12 09:42:13 +0000
@@ -51,7 +51,7 @@
Movie(const movie_definition* const def, DisplayObject* parent)
:
- MovieClip(def, this, parent, parent ? 0 : -1)
+ MovieClip(def, this, parent)
{}
virtual ~Movie() {}
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2009-10-09 09:03:05 +0000
+++ b/libcore/MovieClip.cpp 2009-10-12 09:42:13 +0000
@@ -415,9 +415,9 @@
MovieClip::MovieClip(const movie_definition* const def, Movie* r,
- DisplayObject* parent, int id)
+ DisplayObject* parent)
:
- DisplayObjectContainer(parent, id),
+ DisplayObjectContainer(parent),
_def(def),
_swf(r),
_playState(PLAYSTATE_PLAY),
@@ -454,7 +454,7 @@
}
int
-MovieClip::getMovieVersion() const
+MovieClip::getDefinitionVersion() const
{
return _swf->version();
}
@@ -616,7 +616,7 @@
DisplayObject*
MovieClip::add_empty_movieclip(const std::string& name, int depth)
{
- MovieClip* movieclip = new MovieClip(0, _swf, this, 0);
+ MovieClip* movieclip = new MovieClip(0, _swf, this);
movieclip->set_name(name);
movieclip->setDynamic();
@@ -674,7 +674,7 @@
}
boost::intrusive_ptr<MovieClip> newmovieclip = new MovieClip(_def.get(),
- _swf, parent, get_id());
+ _swf, parent);
newmovieclip->set_name(newname);
newmovieclip->setDynamic();
@@ -1329,7 +1329,7 @@
void
MovieClip::attachBitmap(BitmapData_as* bd, int depth)
{
- DisplayObject* ch = new Bitmap(bd, this, 0);
+ DisplayObject* ch = new Bitmap(bd, this);
attachCharacter(*ch, depth, 0);
}
@@ -1357,8 +1357,7 @@
if (existing_char) return NULL;
- boost::intrusive_ptr<DisplayObject> ch =
- cdef->createDisplayObject(this, tag->getID());
+ boost::intrusive_ptr<DisplayObject> ch = cdef->createDisplayObject(this);
if (tag->hasName()) ch->set_name(tag->getName());
else if (ch->wantsInstanceName())
@@ -1436,8 +1435,7 @@
return;
}
- boost::intrusive_ptr<DisplayObject> ch =
- cdef->createDisplayObject(this, tag->getID());
+ boost::intrusive_ptr<DisplayObject> ch = cdef->createDisplayObject(this);
// TODO: check if we can drop this for REPLACE!
// should we rename the DisplayObject when it's REPLACE tag?
@@ -2514,7 +2512,7 @@
// SWF version is > 6
int topSWFVersion = getRoot(*this).getRootMovie().version();
- if (getMovieVersion() > 6 || topSWFVersion > 6) {
+ if (getDefinitionVersion() > 6 || topSWFVersion > 6) {
if (getLockRoot()) return this;
}
=== modified file 'libcore/MovieClip.h'
--- a/libcore/MovieClip.h 2009-10-08 13:09:26 +0000
+++ b/libcore/MovieClip.h 2009-10-12 09:42:13 +0000
@@ -121,7 +121,7 @@
/// definition, which should know its id...
///
MovieClip(const movie_definition* const def, Movie* root,
- DisplayObject* parent, int id);
+ DisplayObject* parent);
virtual ~MovieClip();
@@ -710,14 +710,14 @@
void lineTo(boost::int32_t x, boost::int32_t y)
{
set_invalidated();
- _drawable.lineTo(x, y, getMovieVersion());
+ _drawable.lineTo(x, y, getDefinitionVersion());
}
void curveTo(boost::int32_t cx, boost::int32_t cy,
boost::int32_t ax, boost::int32_t ay)
{
set_invalidated();
- _drawable.curveTo(cx, cy, ax, ay, getMovieVersion());
+ _drawable.curveTo(cx, cy, ax, ay, getDefinitionVersion());
}
void clear()
@@ -772,11 +772,8 @@
/// false otherwise. True for relative root.
void setLockRoot(bool lr) { _lockroot=lr; }
- /// \brief
- /// Return version of the SWF definition of this instance
- /// as been parsed from.
- //
- int getMovieVersion() const;
+ /// Return the version of the SWF this MovieClip was parsed from.
+ virtual int getDefinitionVersion() const;
protected:
=== modified file 'libcore/Shape.h'
--- a/libcore/Shape.h 2009-10-01 13:19:43 +0000
+++ b/libcore/Shape.h 2009-10-12 09:42:13 +0000
@@ -39,17 +39,17 @@
public:
- Shape(boost::shared_ptr<DynamicShape> sh, DisplayObject* parent, int id)
+ Shape(boost::shared_ptr<DynamicShape> sh, DisplayObject* parent)
:
- DisplayObject(parent, id),
+ DisplayObject(parent),
_shape(sh)
{
assert(_shape.get());
}
- Shape(const SWF::DefineShapeTag* const def, DisplayObject* parent, int
id)
+ Shape(const SWF::DefineShapeTag* const def, DisplayObject* parent)
:
- DisplayObject(parent, id),
+ DisplayObject(parent),
_def(def)
{
assert(_def);
=== modified file 'libcore/StaticText.h'
--- a/libcore/StaticText.h 2009-10-01 13:19:43 +0000
+++ b/libcore/StaticText.h 2009-10-12 09:42:13 +0000
@@ -43,10 +43,9 @@
{
public:
- StaticText(const SWF::DefineTextTag* const def, DisplayObject* parent,
- int id)
+ StaticText(const SWF::DefineTextTag* const def, DisplayObject* parent)
:
- DisplayObject(parent, id),
+ DisplayObject(parent),
_def(def),
_selectionColor(0, 255, 255, 255)
{
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp 2009-10-08 10:02:31 +0000
+++ b/libcore/TextField.cpp 2009-10-12 12:15:41 +0000
@@ -127,10 +127,9 @@
as_value textfield_textHeight(const fn_call& fn);
}
-TextField::TextField(DisplayObject* parent, const SWF::DefineEditTextTag& def,
- int id)
+TextField::TextField(DisplayObject* parent, const SWF::DefineEditTextTag& def)
:
- InteractiveObject(parent, id),
+ InteractiveObject(parent),
_tag(&def),
_textDefined(def.hasText()),
_htmlTextDefined(def.hasText()),
@@ -198,8 +197,7 @@
TextField::TextField(DisplayObject* parent, const SWFRect& bounds)
:
- // the id trick is to fool assertions in DisplayObject ctor
- InteractiveObject(parent, parent ? 0 : -1),
+ InteractiveObject(parent),
_textDefined(false),
_htmlTextDefined(false),
_restrictDefined(false),
@@ -1981,6 +1979,14 @@
}
}
+int
+TextField::getDefinitionVersion() const
+{
+ // TODO: work out if this correct.
+ return get_root()->getDefinitionVersion();
+}
+
+
TextField::VariableRef
TextField::parseTextVariableRef(const std::string& variableName) const
{
@@ -3172,13 +3178,10 @@
as_value
textfield_getDepth(const fn_call& fn)
{
- // TODO: make this a DisplayObject::getDepth_method function...
+ // Unlike MovieClip.getDepth this works only for TextFields.
boost::intrusive_ptr<TextField> text = ensureType<TextField>(fn.this_ptr);
-
- int n = text->get_depth();
-
+ const int n = text->get_depth();
return as_value(n);
-
}
as_value
=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h 2009-10-07 11:54:54 +0000
+++ b/libcore/TextField.h 2009-10-12 09:42:13 +0000
@@ -105,10 +105,9 @@
_htmltags["P"] = htmlptag;
//_htmltags.insert(std::make_pair("P",ptag*()));
}
-
/// Constructs a TextField as specified in a DefineEditText tag.
- TextField(DisplayObject* parent, const SWF::DefineEditTextTag& def, int
id);
+ TextField(DisplayObject* parent, const SWF::DefineEditTextTag& def);
/// Constructs a TextField with default values and the specified bounds.
//
@@ -133,6 +132,11 @@
// Text fields need to handle cxform specially
virtual cxform get_world_cxform() const;
+ /// Return the version of the SWF this was parsed from.
+ //
+ /// TODO: work out what this means for dynamic TextFields.
+ virtual int getDefinitionVersion() const;
+
bool wantsInstanceName() const
{
return true; // text fields can be referenced
=== modified file 'libcore/Video.cpp'
--- a/libcore/Video.cpp 2009-10-04 09:05:59 +0000
+++ b/libcore/Video.cpp 2009-10-12 09:42:13 +0000
@@ -52,10 +52,9 @@
as_value video_height(const fn_call& fn);
}
-Video::Video(const SWF::DefineVideoStreamTag* const def,
- DisplayObject* parent, int id)
+Video::Video(const SWF::DefineVideoStreamTag* const def, DisplayObject* parent)
:
- DisplayObject(parent, id),
+ DisplayObject(parent),
m_def(def),
_ns(0),
_embeddedStream(m_def ? true : false),
=== modified file 'libcore/Video.h'
--- a/libcore/Video.h 2009-10-01 13:19:43 +0000
+++ b/libcore/Video.h 2009-10-12 09:42:13 +0000
@@ -48,8 +48,7 @@
public:
- Video(const SWF::DefineVideoStreamTag* const def, DisplayObject* parent,
- int id);
+ Video(const SWF::DefineVideoStreamTag* const def, DisplayObject*
parent);
~Video();
=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp 2009-10-08 16:09:55 +0000
+++ b/libcore/as_object.cpp 2009-10-12 08:56:07 +0000
@@ -1460,6 +1460,14 @@
_members.visitNonHiddenValues(visitor, *this);
}
+bool
+isNativeType(as_object* obj, DisplayObject*& relay)
+{
+ if (!obj || !obj->displayObject()) return false;
+ relay = static_cast<DisplayObject*>(obj);
+ return true;
+}
+
/// Get the VM from an as_object
VM&
getVM(const as_object& o)
=== modified file 'libcore/as_object.h'
--- a/libcore/as_object.h 2009-10-08 12:24:21 +0000
+++ b/libcore/as_object.h 2009-10-12 08:56:07 +0000
@@ -1027,6 +1027,11 @@
return _relay.get();
}
+ /// Return true if this is a DisplayObject.
+ bool displayObject() const {
+ return _displayObject;
+ }
+
/// Indicate that this object is a DisplayObject
//
/// This enables DisplayObject properties such as _x and _y. A flag
@@ -1219,6 +1224,12 @@
return relay;
}
+/// An overload of isNativeType for DisplayObjects
+//
+/// This uses the DisplayObject flag.
+bool
+isNativeType(as_object* obj, DisplayObject*& relay);
+
/// Ensure that the object is of a particular native type.
//
/// This checks that the object's relay member is the expected type.
=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-09-14 09:40:43 +0000
+++ b/libcore/asobj/Globals.cpp 2009-10-12 11:37:04 +0000
@@ -150,6 +150,10 @@
as_value global_clearTimeout(const fn_call& fn);
as_value global_clearInterval(const fn_call& fn);
as_value global_setInterval(const fn_call& fn);
+
+ // These are present in the standalone, not sure about the plugin.
+ as_value global_enableDebugConsole(const fn_call& fn);
+ as_value global_showRedrawRegions(const fn_call& fn);
// This is a help function for the silly AsSetupError function.
as_value local_errorConstructor(const fn_call& fn);
@@ -337,13 +341,22 @@
init_member("setInterval", _vm.getNative(250, 0));
init_member("clearInterval", _vm.getNative(250, 1));
- init_member("setTimeout", createFunction(global_setTimeout));
- init_member("clearTimeout", createFunction(global_clearInterval));
+ init_member("setTimeout", _vm.getNative(250, 2));
+
+ // This is an odd function with no properties. There ought to be
+ // a better way of implementing this. See also TextFormat.getTextExtent.
+ as_function* edc = createFunction(global_enableDebugConsole);
+ edc->clearProperties();
+ init_member("enableDebugConsole", edc);
+ init_member("showRedrawRegions", _vm.getNative(1021, 1));
+
+ string_table& st = getStringTable(*this);
+ init_member("clearTimeout", getMember(st.find("clearInterval")));
_classes.declareAll(avm1Classes());
// SWF8 visibility:
- const string_table::key NS_FLASH = getStringTable(*this).find("flash");
+ const string_table::key NS_FLASH = st.find("flash");
flash_package_init(*this, ObjectURI(NS_FLASH, NS_GLOBAL));
const int version = _vm.getSWFVersion();
@@ -1368,7 +1381,19 @@
return as_value(ret);
}
+as_value
+global_showRedrawRegions(const fn_call& /*fn*/)
+{
+ LOG_ONCE(log_unimpl("_global.showRedrawRegions"));
+ return as_value();
+}
+as_value
+global_enableDebugConsole(const fn_call& /*fn*/)
+{
+ LOG_ONCE(log_unimpl("_global.enableDebugConsole"));
+ return as_value();
+}
/// Construct an instance of the specified global class.
//
/// If the class is not present or is not a constructor function, this
@@ -1431,6 +1456,9 @@
vm.registerNative(global_isfinite, 200, 19);
vm.registerNative(global_setInterval, 250, 0);
vm.registerNative(global_clearInterval, 250, 1);
+ vm.registerNative(global_setTimeout, 250, 2);
+
+ vm.registerNative(global_showRedrawRegions, 1021, 1);
registerObjectNative(global);
registerFunctionNative(global);
=== modified file 'libcore/asobj/LoadableObject.cpp'
--- a/libcore/asobj/LoadableObject.cpp 2009-08-21 09:05:53 +0000
+++ b/libcore/asobj/LoadableObject.cpp 2009-10-12 12:52:36 +0000
@@ -35,6 +35,7 @@
#include <sstream>
#include <map>
+#include <boost/tokenizer.hpp>
namespace gnash {
@@ -91,10 +92,10 @@
target.set_member(NSV::PROP_LOADED, false);
const RunResources& ri = getRunResources(owner());
- URL url(urlstr, ri.baseURL());
+ URL url(urlstr, ri.baseURL());
- std::auto_ptr<IOChannel> str;
- if (post)
+ std::auto_ptr<IOChannel> str;
+ if (post)
{
as_value customHeaders;
@@ -153,7 +154,7 @@
/// It doesn't matter if there are no request headers.
str = ri.streamProvider().getStream(url, strval, headers);
}
- else
+ else
{
// Convert the object to a string to send. XML should
// not be URL encoded for the GET method.
@@ -172,13 +173,13 @@
str = ri.streamProvider().getStream(url.str());
}
- log_security(_("Loading from url: '%s'"), url.str());
-
+ log_security(_("Loading from url: '%s'"), url.str());
+
LoadableObject* loadObject;
if (isNativeType(&target, loadObject)) {
loadObject->queueLoad(str);
}
-
+
}
void
@@ -186,15 +187,15 @@
{
// Set loaded property to false; will be updated (hopefully)
// when loading is complete.
- owner().set_member(NSV::PROP_LOADED, false);
+ owner().set_member(NSV::PROP_LOADED, false);
const RunResources& ri = getRunResources(owner());
- URL url(urlstr, ri.baseURL());
+ URL url(urlstr, ri.baseURL());
// Checks whether access is allowed.
std::auto_ptr<IOChannel> str(ri.streamProvider().getStream(url));
- log_security(_("Loading from url: '%s'"), url.str());
+ log_security(_("Loading from url: '%s'"), url.str());
queueLoad(str);
}
@@ -244,12 +245,12 @@
boost::scoped_array<char> buf(new char[dataSize + 1]);
size_t actuallyRead = lt->read(buf.get(), dataSize);
if ( actuallyRead != dataSize )
- {
- // This would be either a bug of LoadThread or
an expected
- // possibility which lacks documentation (thus
a bug in
+ {
+ // This would be either a bug of LoadThread or an expected
+ // possibility which lacks documentation (thus a bug in
// documentation)
- //
- }
+ //
+ }
buf[actuallyRead] = '\0';
// Strip BOM, if any.
@@ -311,7 +312,7 @@
as_value
LoadableObject::loadableobject_getBytesLoaded(const fn_call& fn)
{
- boost::intrusive_ptr<as_object> ptr =
ensureType<as_object>(fn.this_ptr);
+ boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
as_value bytesLoaded;
string_table& st = getStringTable(fn);
@@ -322,7 +323,7 @@
as_value
LoadableObject::loadableobject_getBytesTotal(const fn_call& fn)
{
- boost::intrusive_ptr<as_object> ptr =
ensureType<as_object>(fn.this_ptr);
+ boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
as_value bytesTotal;
string_table& st = getStringTable(fn);
@@ -449,26 +450,45 @@
as_value
loadableobject_decode(const fn_call& fn)
{
- boost::intrusive_ptr<as_object> ptr =
ensureType<as_object>(fn.this_ptr);
-
- if (!fn.nargs) return as_value(false);
-
- typedef std::map<std::string, std::string> ValuesMap;
-
- ValuesMap vals;
+ boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
+
+ if (!fn.nargs) return as_value(false);
+
+ typedef std::map<std::string, std::string> ValuesMap;
+ ValuesMap vals;
const int version = getSWFVersion(fn);
-
- URL::parse_querystring(fn.arg(0).to_string_versioned(version), vals);
-
- string_table& st = getStringTable(fn);
- for (ValuesMap::const_iterator it=vals.begin(), itEnd=vals.end();
- it != itEnd; ++it)
- {
- ptr->set_member(st.find(it->first), as_value(it->second));
- }
-
- return as_value();
+ const std::string qs = fn.arg(0).to_string_versioned(version);
+
+ if (qs.empty()) return as_value();
+
+ typedef boost::char_separator<char> Sep;
+ typedef boost::tokenizer<Sep> Tok;
+ Tok t1(qs, Sep("&"));
+
+ string_table& st = getStringTable(fn);
+
+ for (Tok::iterator tit=t1.begin(); tit!=t1.end(); ++tit) {
+
+ const std::string& nameval = *tit;
+
+ std::string name;
+ std::string value;
+
+ size_t eq = nameval.find("=");
+ if (eq == std::string::npos) name = nameval;
+ else {
+ name = nameval.substr(0, eq);
+ value = nameval.substr(eq + 1);
+ }
+
+ URL::decode(name);
+ URL::decode(value);
+
+ if (!name.empty()) ptr->set_member(st.find(name), value);
+ }
+
+ return as_value();
}
/// Returns true if the arguments are valid, otherwise false. The
@@ -479,78 +499,78 @@
as_value
loadableobject_sendAndLoad(const fn_call& fn)
{
- LoadableObject* ptr = ensureNativeType<LoadableObject>(fn.this_ptr);
-
- if ( fn.nargs < 2 )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("sendAndLoad() requires at least two arguments"));
- );
- return as_value(false);
- }
-
- const std::string& urlstr = fn.arg(0).to_string();
- if ( urlstr.empty() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("sendAndLoad(): invalid empty url"));
- );
- return as_value(false);
- }
-
- if (!fn.arg(1).is_object())
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("sendAndLoad(): invalid target (must be an "
- "XML or LoadVars object)"));
- );
- return as_value(false);
- }
+ LoadableObject* ptr = ensureNativeType<LoadableObject>(fn.this_ptr);
+
+ if ( fn.nargs < 2 )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("sendAndLoad() requires at least two arguments"));
+ );
+ return as_value(false);
+ }
+
+ const std::string& urlstr = fn.arg(0).to_string();
+ if ( urlstr.empty() )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("sendAndLoad(): invalid empty url"));
+ );
+ return as_value(false);
+ }
+
+ if (!fn.arg(1).is_object())
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("sendAndLoad(): invalid target (must be an "
+ "XML or LoadVars object)"));
+ );
+ return as_value(false);
+ }
// TODO: if this isn't an XML or LoadVars, it won't work, but we should
// check how far things get before it fails.
- boost::intrusive_ptr<as_object> target =
+ boost::intrusive_ptr<as_object> target =
fn.arg(1).to_object(*getGlobal(fn));
// According to the Flash 8 Cookbook (Joey Lott, Jeffrey Bardzell), p 427,
// this method sends by GET unless overridden, and always by GET in the
// standalone player. We have no tests for this, but a Twitter widget
// gets Bad Request from the server if we send via POST.
- bool post = false;
- if (fn.nargs > 2) {
+ bool post = false;
+ if (fn.nargs > 2) {
const std::string& method = fn.arg(2).to_string();
StringNoCaseEqual nc;
post = nc(method, "post");
}
- ptr->sendAndLoad(urlstr, *target, post);
- return as_value(true);
+ ptr->sendAndLoad(urlstr, *target, post);
+ return as_value(true);
}
as_value
loadableobject_load(const fn_call& fn)
{
- LoadableObject* obj = ensureNativeType<LoadableObject>(fn.this_ptr);
-
- if ( fn.nargs < 1 )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("load() requires at least one argument"));
- );
- return as_value(false);
- }
-
- const std::string& urlstr = fn.arg(0).to_string();
- if ( urlstr.empty() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("load(): invalid empty url"));
- );
- return as_value(false);
- }
-
- obj->load(urlstr);
+ LoadableObject* obj = ensureNativeType<LoadableObject>(fn.this_ptr);
+
+ if ( fn.nargs < 1 )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("load() requires at least one argument"));
+ );
+ return as_value(false);
+ }
+
+ const std::string& urlstr = fn.arg(0).to_string();
+ if ( urlstr.empty() )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("load(): invalid empty url"));
+ );
+ return as_value(false);
+ }
+
+ obj->load(urlstr);
string_table& st = getStringTable(fn);
fn.this_ptr->set_member(st.find("_bytesLoaded"), 0.0);
=== modified file 'libcore/asobj/flash/display/MovieClip_as.cpp'
--- a/libcore/asobj/flash/display/MovieClip_as.cpp 2009-10-08 09:35:24
+0000
+++ b/libcore/asobj/flash/display/MovieClip_as.cpp 2009-10-12 12:15:41
+0000
@@ -549,7 +549,7 @@
boost::int32_t depthValue = static_cast<boost::int32_t>(depth);
boost::intrusive_ptr<DisplayObject> newch =
- exported_movie->createDisplayObject(movieclip.get(), 0);
+ exported_movie->createDisplayObject(movieclip.get());
#ifndef GNASH_USE_GC
assert(newch->get_ref_count() > 0);
@@ -672,9 +672,9 @@
as_value
movieclip_getDepth(const fn_call& fn)
{
- // TODO: make this a DisplayObject::getDepth_method function...
- boost::intrusive_ptr<MovieClip> movieclip =
- ensureType<MovieClip>(fn.this_ptr);
+ // Unlike TextField.getDepth this works for any DisplayObject
+ boost::intrusive_ptr<DisplayObject> movieclip =
+ ensureType<DisplayObject>(fn.this_ptr);
const int n = movieclip->get_depth();
@@ -1326,10 +1326,9 @@
as_value
movieclip_getSWFVersion(const fn_call& fn)
{
- boost::intrusive_ptr<MovieClip> movieclip =
- ensureType<MovieClip>(fn.this_ptr);
-
- return as_value(movieclip->getMovieVersion());
+ DisplayObject* o;
+ if (!isNativeType(fn.this_ptr, o)) return as_value(-1);
+ return as_value(o->getDefinitionVersion());
}
// MovieClip.meth(<string>) : Number
@@ -2573,7 +2572,7 @@
// a MovieClip.
Movie* m = getRoot(fn).topLevelMovie();
- return new MovieClip(0, m, 0, -1);
+ return new MovieClip(0, m, 0);
}
=== modified file 'libcore/parser/BitmapMovieDefinition.cpp'
--- a/libcore/parser/BitmapMovieDefinition.cpp 2009-07-13 09:39:21 +0000
+++ b/libcore/parser/BitmapMovieDefinition.cpp 2009-10-12 09:42:13 +0000
@@ -48,10 +48,10 @@
}
DisplayObject*
-BitmapMovieDefinition::createDisplayObject(DisplayObject* parent, int id) const
+BitmapMovieDefinition::createDisplayObject(DisplayObject* parent) const
{
/// What should we do if construction of the bitmap fails?
- return new Bitmap(this, parent, id);
+ return new Bitmap(this, parent);
}
#ifdef GNASH_USE_GC
=== modified file 'libcore/parser/BitmapMovieDefinition.h'
--- a/libcore/parser/BitmapMovieDefinition.h 2009-10-01 13:19:43 +0000
+++ b/libcore/parser/BitmapMovieDefinition.h 2009-10-12 09:42:13 +0000
@@ -60,7 +60,7 @@
BitmapMovieDefinition(std::auto_ptr<GnashImage> image, Renderer*
renderer,
const std::string& url);
- virtual DisplayObject* createDisplayObject(DisplayObject*, int) const;
+ virtual DisplayObject* createDisplayObject(DisplayObject*) const;
virtual int get_version() const {
return _version;
=== modified file 'libcore/parser/SWFMovieDefinition.h'
--- a/libcore/parser/SWFMovieDefinition.h 2009-10-01 13:19:43 +0000
+++ b/libcore/parser/SWFMovieDefinition.h 2009-10-12 09:42:13 +0000
@@ -390,7 +390,7 @@
///
Movie* createMovie(DisplayObject* parent=0);
- virtual DisplayObject* createDisplayObject(DisplayObject*, int) const {
+ virtual DisplayObject* createDisplayObject(DisplayObject*) const {
return 0;
}
=== modified file 'libcore/parser/sprite_definition.cpp'
--- a/libcore/parser/sprite_definition.cpp 2009-07-13 09:04:26 +0000
+++ b/libcore/parser/sprite_definition.cpp 2009-10-12 09:42:13 +0000
@@ -41,12 +41,12 @@
namespace gnash {
DisplayObject*
-sprite_definition::createDisplayObject(DisplayObject* parent, int id) const
+sprite_definition::createDisplayObject(DisplayObject* parent) const
{
#ifdef DEBUG_REGISTER_CLASS
log_debug(_("Instantiating sprite_def %p"), (void*)this);
#endif
- MovieClip* si = new MovieClip(this, parent->get_root(), parent, id);
+ MovieClip* si = new MovieClip(this, parent->get_root(), parent);
return si;
}
=== modified file 'libcore/parser/sprite_definition.h'
--- a/libcore/parser/sprite_definition.h 2009-10-01 13:19:43 +0000
+++ b/libcore/parser/sprite_definition.h 2009-10-12 09:42:13 +0000
@@ -235,8 +235,7 @@
// the parent movie's display list.
//
// overloads from SWF::DefinitionTag
- virtual DisplayObject* createDisplayObject(DisplayObject* parent, int
id)
- const;
+ virtual DisplayObject* createDisplayObject(DisplayObject* parent) const;
// See dox in movie_definition.h
virtual void addControlTag(SWF::ControlTag* c)
=== modified file 'libcore/swf/DefineButtonTag.cpp'
--- a/libcore/swf/DefineButtonTag.cpp 2009-07-13 08:06:09 +0000
+++ b/libcore/swf/DefineButtonTag.cpp 2009-10-12 09:42:13 +0000
@@ -234,9 +234,9 @@
}
DisplayObject*
-DefineButtonTag::createDisplayObject(DisplayObject* parent, int id) const
+DefineButtonTag::createDisplayObject(DisplayObject* parent) const
{
- DisplayObject* ch = new Button(this, parent, id);
+ DisplayObject* ch = new Button(this, parent);
return ch;
}
@@ -327,7 +327,7 @@
assert(button);
assert(_definitionTag);
- DisplayObject* o = _definitionTag->createDisplayObject(button, _id);
+ DisplayObject* o = _definitionTag->createDisplayObject(button);
o->setMatrix(_matrix, true);
o->set_cxform(_cxform);
=== modified file 'libcore/swf/DefineButtonTag.h'
--- a/libcore/swf/DefineButtonTag.h 2009-07-13 08:06:09 +0000
+++ b/libcore/swf/DefineButtonTag.h 2009-10-12 09:42:13 +0000
@@ -208,7 +208,7 @@
virtual ~DefineButtonTag();
/// Create a mutable instance of our definition.
- DisplayObject* createDisplayObject(DisplayObject* parent, int id) const;
+ DisplayObject* createDisplayObject(DisplayObject* parent) const;
/// Access the ButtonRecords directly. Used for modifying the
/// Cxform by a DefineButtonCxform tag.
=== modified file 'libcore/swf/DefineEditTextTag.cpp'
--- a/libcore/swf/DefineEditTextTag.cpp 2009-07-13 18:32:52 +0000
+++ b/libcore/swf/DefineEditTextTag.cpp 2009-10-12 09:42:13 +0000
@@ -39,11 +39,11 @@
}
DisplayObject*
-DefineEditTextTag::createDisplayObject(DisplayObject* parent, int id) const
+DefineEditTextTag::createDisplayObject(DisplayObject* parent) const
{
// Resolve the font, if possible
getFont();
- TextField* ch = new TextField(parent, *this, id);
+ TextField* ch = new TextField(parent, *this);
// This gives an "instance name" to the TextField, but
// it is not really what we need.
=== modified file 'libcore/swf/DefineEditTextTag.h'
--- a/libcore/swf/DefineEditTextTag.h 2009-10-01 13:19:43 +0000
+++ b/libcore/swf/DefineEditTextTag.h 2009-10-12 09:42:13 +0000
@@ -67,7 +67,7 @@
const SWFRect& bounds() const { return _rect; }
- DisplayObject* createDisplayObject(DisplayObject* parent, int id) const;
+ DisplayObject* createDisplayObject(DisplayObject* parent) const;
/// Return a reference to the default text associated
/// with this EditText definition.
=== modified file 'libcore/swf/DefineMorphShapeTag.cpp'
--- a/libcore/swf/DefineMorphShapeTag.cpp 2009-10-01 13:19:43 +0000
+++ b/libcore/swf/DefineMorphShapeTag.cpp 2009-10-12 09:42:13 +0000
@@ -55,9 +55,9 @@
}
DisplayObject*
-DefineMorphShapeTag::createDisplayObject(DisplayObject* parent, int id) const
+DefineMorphShapeTag::createDisplayObject(DisplayObject* parent) const
{
- return new MorphShape(this, parent, id);
+ return new MorphShape(this, parent);
}
void
=== modified file 'libcore/swf/DefineMorphShapeTag.h'
--- a/libcore/swf/DefineMorphShapeTag.h 2009-10-01 13:19:43 +0000
+++ b/libcore/swf/DefineMorphShapeTag.h 2009-10-12 09:42:13 +0000
@@ -50,8 +50,7 @@
virtual ~DefineMorphShapeTag() {}
- virtual DisplayObject* createDisplayObject(DisplayObject* parent, int
id)
- const;
+ virtual DisplayObject* createDisplayObject(DisplayObject* parent) const;
virtual void display(Renderer& renderer, const MorphShape& inst) const;
=== modified file 'libcore/swf/DefineShapeTag.cpp'
--- a/libcore/swf/DefineShapeTag.cpp 2009-07-13 08:06:09 +0000
+++ b/libcore/swf/DefineShapeTag.cpp 2009-10-12 09:42:13 +0000
@@ -63,9 +63,9 @@
}
DisplayObject*
-DefineShapeTag::createDisplayObject(DisplayObject* parent, int id) const
+DefineShapeTag::createDisplayObject(DisplayObject* parent) const
{
- return new Shape(this, parent, id);
+ return new Shape(this, parent);
}
bool
=== modified file 'libcore/swf/DefineShapeTag.h'
--- a/libcore/swf/DefineShapeTag.h 2009-10-01 13:19:43 +0000
+++ b/libcore/swf/DefineShapeTag.h 2009-10-12 09:42:13 +0000
@@ -42,8 +42,7 @@
virtual void display(Renderer& renderer, const DisplayObject& inst) const;
// Create a Shape DisplayObject.
- virtual DisplayObject* createDisplayObject(DisplayObject* parent, int
id)
- const;
+ virtual DisplayObject* createDisplayObject(DisplayObject* parent) const;
/// Get cached bounds of this shape.
const SWFRect& bounds() const { return _shape.getBounds(); }
=== modified file 'libcore/swf/DefineTextTag.cpp'
--- a/libcore/swf/DefineTextTag.cpp 2009-07-13 08:06:09 +0000
+++ b/libcore/swf/DefineTextTag.cpp 2009-10-12 09:42:13 +0000
@@ -40,9 +40,9 @@
}
DisplayObject*
-DefineTextTag::createDisplayObject(DisplayObject* parent, int id) const
+DefineTextTag::createDisplayObject(DisplayObject* parent) const
{
- return new StaticText(this, parent, id);
+ return new StaticText(this, parent);
}
bool
=== modified file 'libcore/swf/DefineTextTag.h'
--- a/libcore/swf/DefineTextTag.h 2009-10-01 13:19:43 +0000
+++ b/libcore/swf/DefineTextTag.h 2009-10-12 09:42:13 +0000
@@ -67,8 +67,7 @@
bool extractStaticText(std::vector<const TextRecord*>& to, size_t& size)
const;
- virtual DisplayObject* createDisplayObject(DisplayObject* parent, int id)
- const;
+ virtual DisplayObject* createDisplayObject(DisplayObject* parent) const;
private:
=== modified file 'libcore/swf/DefineVideoStreamTag.cpp'
--- a/libcore/swf/DefineVideoStreamTag.cpp 2009-07-13 08:06:09 +0000
+++ b/libcore/swf/DefineVideoStreamTag.cpp 2009-10-12 09:42:13 +0000
@@ -133,9 +133,9 @@
}
DisplayObject*
-DefineVideoStreamTag::createDisplayObject(DisplayObject* parent, int id) const
+DefineVideoStreamTag::createDisplayObject(DisplayObject* parent) const
{
- DisplayObject* ch = new Video(this, parent, id);
+ DisplayObject* ch = new Video(this, parent);
return ch;
}
=== modified file 'libcore/swf/DefineVideoStreamTag.h'
--- a/libcore/swf/DefineVideoStreamTag.h 2009-10-01 13:19:43 +0000
+++ b/libcore/swf/DefineVideoStreamTag.h 2009-10-12 09:42:13 +0000
@@ -83,7 +83,7 @@
~DefineVideoStreamTag();
- DisplayObject* createDisplayObject(DisplayObject* parent, int id) const;
+ DisplayObject* createDisplayObject(DisplayObject* parent) const;
/// Read tag SWF::DEFINEVIDEOSTREAM
//
=== modified file 'libcore/swf/DefinitionTag.h'
--- a/libcore/swf/DefinitionTag.h 2009-10-01 13:19:43 +0000
+++ b/libcore/swf/DefinitionTag.h 2009-10-12 09:42:13 +0000
@@ -50,8 +50,7 @@
/// Calling this function creates a new DisplayObject from the
/// DefinitionTag and adds it as a child of the specified parent
/// DisplayObject.
- virtual DisplayObject* createDisplayObject(DisplayObject* parent,
- int id) const = 0;
+ virtual DisplayObject* createDisplayObject(DisplayObject* parent) const
= 0;
};
=== modified file 'testsuite/DummyCharacter.h'
--- a/testsuite/DummyCharacter.h 2009-10-01 13:19:43 +0000
+++ b/testsuite/DummyCharacter.h 2009-10-12 09:50:35 +0000
@@ -47,7 +47,7 @@
DummyCharacter(DisplayObject* parent)
:
- InteractiveObject(parent, parent ? 0 : -1)
+ InteractiveObject(parent)
{
}
=== modified file 'testsuite/DummyMovieDefinition.h'
--- a/testsuite/DummyMovieDefinition.h 2009-10-01 13:19:43 +0000
+++ b/testsuite/DummyMovieDefinition.h 2009-10-12 09:42:13 +0000
@@ -50,7 +50,9 @@
public:
- virtual DisplayObject* createDisplayObject(DisplayObject*, int /* id */) {
return 0; }
+ virtual DisplayObject* createDisplayObject(DisplayObject*) {
+ return 0;
+ }
/// Default constructor
=== modified file 'testsuite/actionscript.all/MovieClip.as'
--- a/testsuite/actionscript.all/MovieClip.as 2009-10-04 09:23:36 +0000
+++ b/testsuite/actionscript.all/MovieClip.as 2009-10-12 09:12:02 +0000
@@ -118,15 +118,15 @@
#endif
#if OUTPUT_VERSION == 6
- check_totals(903); // SWF6
+ check_totals(910); // SWF6
#endif
#if OUTPUT_VERSION == 7
- check_totals(920); // SWF7
+ check_totals(927); // SWF7
#endif
#if OUTPUT_VERSION >= 8
- check_totals(1010); // SWF8+
+ check_totals(1017); // SWF8+
#endif
play();
@@ -2343,7 +2343,7 @@
check_equals(_root.getSWFVersion(), OUTPUT_VERSION);
o.getSWFVersion = MovieClip.prototype.getSWFVersion;
-xcheck_equals(o.getSWFVersion(), -1);
+check_equals(o.getSWFVersion(), -1);
createTextField("t1", 3, 0, 100, 100, 100);
#if OUTPUT_VERSION > 5
check_equals(_level0.t1.getSWFVersion(), undefined);
@@ -2353,11 +2353,58 @@
xcheck_equals(_level0.t1.toString(), "[object Object]");
#endif
_level0.t1.getSWFVersion = MovieClip.prototype.getSWFVersion;
-xcheck_equals(_level0.t1.getSWFVersion(), OUTPUT_VERSION);
+check_equals(_level0.t1.getSWFVersion(), OUTPUT_VERSION);
o.meth = MovieClip.prototype.meth;
check_equals(o.meth("post"), 2);
check_equals(o.meth(), 0);
+// Check that MovieClip data is separate from Relay data.
+
+#if OUTPUT_VERSION > 5
+
+// Run the Date constructor
+dc = function(const) {
+ this.__proto__.__constructor__ = const;
+ super();
+};
+
+createEmptyMovieClip("mc", 3);
+mc.lineStyle(2, 0, 100);
+mc.lineTo(100, 100);
+o = new Object();
+o.getTime = Date.prototype.getTime;
+mc.getTime = Date.prototype.getTime;
+
+mc.dc = dc;
+o.dc = dc;
+
+mc.dc(Date);
+o.dc(Date);
+
+check_equals(typeof(o.getTime()), "number");
+
+// mc is now a Date.
+check_equals(typeof(mc.getTime()), "number");
+
+mc.lineStyle(2, 0xff, 100);
+mc.lineTo(60, 20);
+
+// But it is still a MovieClip.
+check_equals(mc._x, 17);
+
+mc.toString = Boolean.prototype.toString;
+check_equals(mc.toString(), undefined);
+
+mc.dc(Boolean);
+
+// mc is now a Boolean
+check_equals(typeof(mc.getTime()), "undefined");
+check_equals(mc.toString(), "false");
+
+// But it is still a MovieClip
+check_equals(mc._x, 17);
+
+#endif
//endOfTest();
=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING 2009-10-08 13:13:25 +0000
+++ b/testsuite/swfdec/PASSING 2009-10-12 12:55:10 +0000
@@ -146,6 +146,10 @@
boolean-properties-7.swf:f01da3f46a6a70f22682ad6655e1be6a
boolean-properties-8.swf:bcb5f70be1ae877fb31c198925ba1375
builtin-construction-5.swf:c3bcb8608999fa7a42a04b22e9e4929a
+button-properties-5.swf:fedec2281d5dc7dede06a97b0bbd99c7
+button-properties-6.swf:1b1446f8218029e92e527901ea267ce2
+button-properties-7.swf:44605cb6a7b2649c18d155434cc57b83
+button-properties-8.swf:794f9c47e03aa3b0c75eeff87ba8a140
call-arguments-5.swf:422c391a2abd3e864eb8ed8a1e05ad31
callfunction-stack.swf:21d0c957f4caf0eb0ccd0dcadaf17500
camera-properties-5.swf:495e39b641f89aa49a927cf0a8413028
@@ -538,6 +542,9 @@
getBounds-local_to_global-7.swf:184bf53fab95a2f0614118ce2aae3ec9
getBounds-local_to_global-8.swf:a0011c41fa749a423c024b23e138f13f
get-depth-5.swf:3bcb54d583b5b4bfb8b332ccb821d064
+get-depth-6.swf:e03348f551a9e6a34ff0b7b9948dc79c
+get-depth-7.swf:165c1dfd22a8d70853b6d966917ab962
+get-depth-8.swf:29c5ebbf38ad27cd1fd996c6a5ca9f76
getsetproperty-target-5.swf:03e0f34befd1de66083128dd7810d211
getsetproperty-target-6.swf:cd70c0eac0ac31400859178f7d877fe1
getsetproperty-target-7.swf:d7d730794e6318c1b69a7e946cb2fedd
@@ -564,6 +571,10 @@
getvariable-various-6.swf:1488b4d8e200bcad7027ae618a6c08d2
getvariable-various-7.swf:d8a5c5449de5bcc427877c655033811e
getvariable-various-8.swf:7211050a012850e666db0fa4032abc72
+global-function-properties-5.swf:fa9650886ed073bb2423b4d4da1ac247
+global-function-properties-6.swf:6a47348c50727ccec51e857401ba5c1d
+global-function-properties-7.swf:92e4978f6b2edd010f5bc32f499e918b
+global-function-properties-8.swf:1c092b3ef149f62f1744cc85ed70ab4a
global-variable-properties-5.swf:dcc9514f7d195414152b7fe1ec630c63
global-variable-properties-6.swf:82a3684af003d93e1fc8d7df8c05e347
global-variable-properties-7.swf:5f2609296a34202f4a2e8a45fc75fefc
@@ -637,6 +648,8 @@
loadobject-addrequestheader-8.swf:50ab764a31bff4a679a86e48d7000343
loadvariables-5.swf:a24997be9ca59d8da2216f9527d0279a
loadvars-5.swf:378a93e3fc7821a72f61332dcfa6cbf7
+loadvars-decode-7.swf:c56b42214f26888edba5d991f711c209
+loadvars-decode-8.swf:ed7cb98e1a1ec7f7e6a6730a3d884f9a
loadvars-decode-return-5.swf:7d961f35feb3d46db0725e93c26bb90a
loadvars-decode-return-6.swf:b087145545a09db783e43093e1ed6731
loadvars-decode-return-7.swf:86b9a3bf16c7f8927a63b048b7886dbf
@@ -702,6 +715,10 @@
movieclip-get-swf-version-load-6.swf:d246d697a86c555d0858dde03e471610
movieclip-get-swf-version-load-7.swf:e9e67de054ea546c767af5dca82ecd6a
movieclip-get-swf-version-load-8.swf:a0ee7aae28219fa92f4036c7fd2f0174
+movieclip-get-swf-version-object-5.swf:c6ca6fe3a07dfcd74397cf87cbeb7754
+movieclip-get-swf-version-object-6.swf:c36e6620c2b193f6c8bac7693904ec4e
+movieclip-get-swf-version-object-7.swf:c75023287829bab42227a4a5b38de3a6
+movieclip-get-swf-version-object-8.swf:5f1bae8461aeaf8f05dfdd8ae377d1f9
movieclip-hittest-5.swf:60c92ba987df3a6019ced7ed3ae063b6
movieclip-hittest-parent-5.swf:2dd3e6daa46ad81705a6f239971e5520
movieclip-hittest-target-5.swf:6d484ea1799df7f08eac134be82bacd4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11558: Various changes to simplify DisplayObjects.,
Benjamin Wolsey <=