[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11555: Drop more overrides and prep
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11555: Drop more overrides and prepare for refactoring. |
Date: |
Fri, 09 Oct 2009 07:39:24 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11555 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2009-10-09 07:39:24 +0200
message:
Drop more overrides and prepare for refactoring.
modified:
libcore/Button.cpp
libcore/Button.h
libcore/DisplayObject.cpp
libcore/DisplayObject.h
libcore/MovieClip.cpp
libcore/as_environment.cpp
libcore/as_object.cpp
libcore/vm/VM.cpp
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp 2009-10-07 11:54:54 +0000
+++ b/libcore/Button.cpp 2009-10-08 14:33:35 +0000
@@ -768,46 +768,6 @@
return false;
}
-as_object*
-Button::get_path_element(string_table::key key)
-{
- as_object* ch = getPathElementSeparator(key);
- if ( ch ) return ch;
-
- const std::string& name = getStringTable(*this).value(key);
- return getChildByName(name); // possibly NULL
-}
-
-DisplayObject *
-Button::getChildByName(const std::string& name)
-{
- // Get all currently active DisplayObjects, including unloaded
- DisplayObjects actChars;
- getActiveCharacters(actChars, true);
-
- // Lower depth first for duplicated names, so we sort
- std::sort(actChars.begin(), actChars.end(), charDepthLessThen);
-
- for (DisplayObjects::iterator i=actChars.begin(), e=actChars.end(); i!=e;
++i)
- {
-
- DisplayObject* const child = *i;
- const std::string& childname = child->get_name();
-
- if (getSWFVersion(*this) >= 7 )
- {
- if ( childname == name ) return child;
- }
- else
- {
- StringNoCaseEqual noCaseCompare;
- if ( noCaseCompare(childname, name) ) return child;
- }
- }
-
- return NULL;
-}
-
void
Button::stagePlacementCallback(as_object* initObj)
{
=== modified file 'libcore/Button.h'
--- a/libcore/Button.h 2009-10-07 11:54:54 +0000
+++ b/libcore/Button.h 2009-10-08 14:33:35 +0000
@@ -102,9 +102,6 @@
return true; // buttons can be referenced
}
- /// Overridden to look in button records for a match
- virtual as_object* get_path_element(string_table::key key);
-
virtual void mouseEvent(const event_id& event);
virtual bool handleFocus();
@@ -195,16 +192,6 @@
///
void get_active_records(ActiveRecords& list, MouseState state);
- /// Return any state DisplayObject whose name matches the given string
- //
- /// NOTE: both active and inactive childs are scanned for
- ///
- /// @param name
- /// Name to match, search is case sensitive for SWF7 and higher,
- /// case insensitive up to SWF6.
- ///
- DisplayObject* getChildByName(const std::string& name);
-
/// \brief
/// Return version of the SWF containing
/// the button definition this is an instance of.
=== modified file 'libcore/DisplayObject.cpp'
--- a/libcore/DisplayObject.cpp 2009-10-08 10:34:32 +0000
+++ b/libcore/DisplayObject.cpp 2009-10-08 16:10:00 +0000
@@ -152,7 +152,7 @@
as_object*
-DisplayObject::getPathElementSeparator(string_table::key key)
+DisplayObject::get_path_element(string_table::key key)
{
if (getSWFVersion(*this) > 4 && key == NSV::PROP_uROOT)
{
=== modified file 'libcore/DisplayObject.h'
--- a/libcore/DisplayObject.h 2009-10-07 11:54:54 +0000
+++ b/libcore/DisplayObject.h 2009-10-08 16:10:00 +0000
@@ -521,10 +521,7 @@
/// In ActionScript 1.0, everything seems to be CASE
/// INSENSITIVE.
///
- virtual as_object* get_path_element(string_table::key key)
- {
- return getPathElementSeparator(key);
- }
+ virtual as_object* get_path_element(string_table::key key);
/// Advance this DisplayObject to next frame.
//
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2009-10-08 10:34:32 +0000
+++ b/libcore/MovieClip.cpp 2009-10-08 16:10:00 +0000
@@ -835,7 +835,7 @@
as_object*
MovieClip::get_path_element(string_table::key key)
{
- as_object* obj = getPathElementSeparator(key);
+ as_object* obj = DisplayObject::get_path_element(key);
if (obj) return obj;
std::string name = getStringTable(*this).value(key);
=== modified file 'libcore/as_environment.cpp'
--- a/libcore/as_environment.cpp 2009-08-21 12:29:40 +0000
+++ b/libcore/as_environment.cpp 2009-10-08 16:09:26 +0000
@@ -556,6 +556,13 @@
}
as_object*
+getElement(as_object* obj, string_table::key key)
+{
+ //Global_as* gl = getGlobal(*obj);
+ return obj->get_path_element(key);
+}
+
+as_object*
as_environment::find_object(const std::string& path,
const ScopeStack* scopeStack) const
{
@@ -563,8 +570,7 @@
log_debug(_("find_object(%s) called"), path);
#endif
- if (path.empty())
- {
+ if (path.empty()) {
#ifdef DEBUG_TARGET_FINDING
log_debug(_("Returning m_target (empty path)"));
#endif
@@ -573,7 +579,7 @@
VM& vm = _vm;
string_table& st = vm.getStringTable();
- int swfVersion = vm.getSWFVersion();
+ int swfVersion = vm.getSWFVersion();
as_object* env = 0;
env = m_target;
@@ -586,24 +592,21 @@
{
// Absolute path. Start at the (AS) root (handle _lockroot)
MovieClip* root = 0;
- if ( m_target ) root = m_target->getAsRoot();
+ if (m_target) root = m_target->getAsRoot();
else {
- if ( _original_target )
- {
+ if (_original_target) {
log_debug("current target is undefined on "
"as_environment::find_object, we'll use original");
root = _original_target->getAsRoot();
}
- else
- {
+ else {
log_debug("both current and original target are undefined "
"on as_environment::find_object, we'll return 0");
return 0;
}
}
- if ( ! *(++p) )
- {
+ if (!*(++p)) {
#ifdef DEBUG_TARGET_FINDING
log_debug(_("Path is '/', return the root (%p)"), (void*)root);
#endif
@@ -620,8 +623,7 @@
}
#ifdef DEBUG_TARGET_FINDING
- else
- {
+ else {
log_debug(_("Relative path, start at (%s)"), m_target->getTarget());
}
#endif
@@ -631,35 +633,30 @@
std::string subpart;
while (1)
{
- while ( *p == ':' ) ++p;
+ while (*p == ':') ++p;
// No more components to scan
- if ( ! *p )
- {
+ if (!*p) {
#ifdef DEBUG_TARGET_FINDING
log_debug(_("Path is %s, returning whatever we were up to"), path);
#endif
-
return env;
}
const char* next_slash = next_slash_or_dot(p);
subpart = p;
- if (next_slash == p)
- {
+ if (next_slash == p) {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("invalid path '%s' (p=next_slash=%s)"),
path, next_slash);
);
return NULL;
}
- else if (next_slash)
- {
- if ( *next_slash == '.' )
+ else if (next_slash) {
+ if (*next_slash == '.')
{
- if ( ! dot_allowed )
- {
+ if (!dot_allowed) {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("invalid path '%s' (dot not allowed "
"after having seen a slash)"), path);
@@ -667,8 +664,7 @@
return NULL;
}
}
- else if ( *next_slash == '/' )
- {
+ else if (*next_slash == '/') {
dot_allowed = false;
}
@@ -679,8 +675,7 @@
assert(subpart[0] != ':');
// No more components to scan
- if ( subpart.empty() )
- {
+ if (subpart.empty()) {
#ifdef DEBUG_TARGET_FINDING
log_debug(_("No more subparts, env is %p"), (void*)env);
#endif
@@ -689,15 +684,12 @@
string_table::key subpartKey = st.find(subpart);
- if ( ! firstElementParsed )
- {
- as_object* element = NULL;
+ if (!firstElementParsed) {
+ as_object* element(0);
do {
-
// Try scope stack
- if ( scopeStack )
- {
+ if (scopeStack) {
for (size_t i = scopeStack->size(); i > 0; --i)
{
// const_cast needed due to non-const
@@ -705,37 +697,32 @@
as_object* obj =
const_cast<as_object*>((*scopeStack)[i-1].get());
- element = obj->get_path_element(subpartKey);
- if ( element ) break;
+ element = getElement(obj, subpartKey);
+ if (element) break;
}
- if ( element ) break;
+ if (element) break;
}
// Try current target (if any)
assert(env == m_target);
- if ( env )
- {
- element = env->get_path_element(subpartKey);
- if ( element ) break;
+ if (env) {
+ element = getElement(env, subpartKey);
+ if (element) break;
}
- // else if ( _original_target) // TODO: try orig target too ?
// Looking for _global ?
as_object* global = _vm.getGlobal();
- if ( swfVersion > 5 && subpartKey == NSV::PROP_uGLOBAL )
+ if (swfVersion > 5 && subpartKey == NSV::PROP_uGLOBAL)
{
element = global;
break;
}
-
// Try globals
- element = global->get_path_element(subpartKey);
- //if ( element ) break;
+ element = getElement(global, subpartKey);
} while (0);
- if ( ! element )
- {
+ if (!element) {
#ifdef DEBUG_TARGET_FINDING
log_debug("subpart %s of path %s not found in any "
"scope stack element", subpart, path);
@@ -746,8 +733,7 @@
env = element;
firstElementParsed = true;
}
- else
- {
+ else {
assert(env);
@@ -756,9 +742,8 @@
"%p"), subpart, (void *)env);
#endif
- as_object* element = env->get_path_element(subpartKey);
- if ( ! element )
- {
+ as_object* element = getElement(env, subpartKey);
+ if (!element) {
#ifdef DEBUG_TARGET_FINDING
log_debug(_("Path element %s not found in "
"object %p"), subpart, (void *)env);
=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp 2009-10-08 12:33:01 +0000
+++ b/libcore/as_object.cpp 2009-10-08 16:09:55 +0000
@@ -1308,7 +1308,7 @@
//#define DEBUG_TARGET_FINDING 1
as_value tmp;
- if ( ! get_member(key, &tmp ) )
+ if (!get_member(key, &tmp))
{
#ifdef DEBUG_TARGET_FINDING
log_debug("Member %s not found in object %p",
@@ -1316,7 +1316,7 @@
#endif
return NULL;
}
- if ( ! tmp.is_object() )
+ if (!tmp.is_object())
{
#ifdef DEBUG_TARGET_FINDING
log_debug("Member %s of object %p is not an object (%s)",
=== modified file 'libcore/vm/VM.cpp'
--- a/libcore/vm/VM.cpp 2009-10-08 19:53:02 +0000
+++ b/libcore/vm/VM.cpp 2009-10-09 05:39:24 +0000
@@ -351,7 +351,7 @@
}
as_value
-newLessThan(const as_value& op1, const as_value& op2, VM& /* vm */)
+newLessThan(const as_value& op1, const as_value& op2, VM& /*vm*/)
{
as_value operand1(op1);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11555: Drop more overrides and prepare for refactoring.,
Benjamin Wolsey <=