Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 65
View file
lightspark.spec
Changed
@@ -24,7 +24,7 @@ %endif Name: lightspark -Version: 0.7.2.99+git20150403.1618 +Version: 0.7.2.99+git20150419.1419 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/allclasses.h
Changed
@@ -110,6 +110,7 @@ //Events REGISTER_CLASS_NAME(AsyncErrorEvent,"flash.events") +REGISTER_CLASS_NAME(ContextMenuEvent,"flash.events") REGISTER_CLASS_NAME(DRMErrorEvent,"flash.events") REGISTER_CLASS_NAME(DRMStatusEvent,"flash.events") REGISTER_CLASS_NAME(DataEvent,"flash.events") @@ -119,6 +120,7 @@ REGISTER_CLASS_NAME(EventPhase,"flash.events") REGISTER_CLASS_NAME(FocusEvent,"flash.events") REGISTER_CLASS_NAME(FullScreenEvent,"flash.events") +REGISTER_CLASS_NAME(GestureEvent,"flash.events") REGISTER_CLASS_NAME(HTTPStatusEvent,"flash.events") REGISTER_CLASS_NAME(IEventDispatcher,"flash.events") REGISTER_CLASS_NAME(IOErrorEvent,"flash.events") @@ -126,6 +128,7 @@ REGISTER_CLASS_NAME(KeyboardEvent,"flash.events") REGISTER_CLASS_NAME(MouseEvent,"flash.events") REGISTER_CLASS_NAME(NetStatusEvent,"flash.events") +REGISTER_CLASS_NAME(PressAndTapGestureEvent,"flash.events") REGISTER_CLASS_NAME(ProgressEvent,"flash.events") REGISTER_CLASS_NAME(SecurityErrorEvent,"flash.events") REGISTER_CLASS_NAME(StageVideoEvent,"flash.events") @@ -133,7 +136,8 @@ REGISTER_CLASS_NAME(StatusEvent,"flash.events") REGISTER_CLASS_NAME(TextEvent,"flash.events") REGISTER_CLASS_NAME(TimerEvent,"flash.events") -REGISTER_CLASS_NAME(ContextMenuEvent,"flash.events") +REGISTER_CLASS_NAME(TouchEvent,"flash.events") +REGISTER_CLASS_NAME(TransformGestureEvent,"flash.events") REGISTER_CLASS_NAME(UncaughtErrorEvent,"flash.events") //External interface (browser interaction) @@ -166,11 +170,13 @@ //Net REGISTER_CLASS_NAME(NetConnection,"flash.net") REGISTER_CLASS_NAME(NetStream,"flash.net") +REGISTER_CLASS_NAME(NetStreamAppendBytesAction,"flash.net") REGISTER_CLASS_NAME(NetStreamPlayTransitions,"flash.net") REGISTER_CLASS_NAME(NetStreamPlayOptions,"flash.net") REGISTER_CLASS_NAME(ObjectEncoding,"flash.net") REGISTER_CLASS_NAME(Responder,"flash.net") REGISTER_CLASS_NAME(SharedObject,"flash.net") +REGISTER_CLASS_NAME(SharedObjectFlushStatus,"flash.net") REGISTER_CLASS_NAME(URLLoader,"flash.net") REGISTER_CLASS_NAME(URLLoaderDataFormat,"flash.net") REGISTER_CLASS_NAME(URLRequest,"flash.net") @@ -223,12 +229,18 @@ REGISTER_CLASS_NAME(EastAsianJustifier,"flash.text.engine") REGISTER_CLASS_NAME(ElementFormat,"flash.text.engine") REGISTER_CLASS_NAME(FontDescription,"flash.text.engine") +REGISTER_CLASS_NAME(FontMetrics,"flash.text.engine") +REGISTER_CLASS_NAME(FontLookup,"flash.text.engine") REGISTER_CLASS_NAME(FontWeight,"flash.text.engine") +REGISTER_CLASS_NAME(Kerning,"flash.text.engine") +REGISTER_CLASS_NAME(LineJustification,"flash.text.engine") REGISTER_CLASS_NAME(SpaceJustifier,"flash.text.engine") +REGISTER_CLASS_NAME(TextBaseline,"flash.text.engine") REGISTER_CLASS_NAME(TextBlock,"flash.text.engine") REGISTER_CLASS_NAME(TextElement,"flash.text.engine") REGISTER_CLASS_NAME(TextJustifier,"flash.text.engine") REGISTER_CLASS_NAME(TextLine,"flash.text.engine") +REGISTER_CLASS_NAME(TextLineValidity,"flash.text.engine") //Utils REGISTER_CLASS_NAME(ByteArray,"flash.utils")
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -421,7 +421,7 @@ } bool ASObject::isConstructed() const { - return traitsInitialized && constructorCalled; + return traitsInitialized && constructIndicator; } variables_map::variables_map(MemoryAccount* m): Variables(std::less<mapType::key_type>(), reporter_allocator<mapType::value_type>(m)),slots_vars(m) @@ -703,7 +703,8 @@ { //Initializing an already existing variable LOG(LOG_NOT_IMPLEMENTED,"Variable " << name << "already initialized"); - o->decRef(); + if (o != NULL) + o->decRef(); return; } @@ -900,7 +901,21 @@ { if (obj == NULL) // create dynamic object { - if(mainObj->is<Class_base>() && + if (type == Type::anyType) + { + // type could not be found, so it's stored as an uninitialized variable + uninitializedVar v; + mainObj->incRef(); + v.mainObj = mainObj; + v.mname = mname; + v.traitKind = traitKind; + v.typemname = *typemname; + context->uninitializedVars.push_back(v); + + obj = getSys()->getUndefinedRef(); + obj = type->coerce(obj); + } + else if(mainObj->is<Class_base>() && mainObj->as<Class_base>()->class_name.getQualifiedName() == typemname->qualifiedString()) { // avoid recursive construction @@ -915,9 +930,9 @@ else { obj = getSys()->getUndefinedRef(); + obj = type->coerce(obj); } } - obj = type->coerce(obj); } assert(traitKind==DECLARED_TRAIT || traitKind==CONSTANT_TRAIT); @@ -1267,7 +1282,7 @@ } ASObject::ASObject(MemoryAccount* m):Variables(m),classdef(NULL),proxyMultiName(NULL), - type(T_OBJECT),traitsInitialized(false),constructorCalled(false),implEnable(true) + type(T_OBJECT),traitsInitialized(false),constructIndicator(false),implEnable(true) { #ifndef NDEBUG //Stuff only used in debugging @@ -1276,7 +1291,7 @@ } ASObject::ASObject(Class_base* c):Variables((c)?c->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL), - type(T_OBJECT),traitsInitialized(false),constructorCalled(false),implEnable(true) + type(T_OBJECT),traitsInitialized(false),constructIndicator(false),implEnable(true) { setClass(c); #ifndef NDEBUG @@ -1286,7 +1301,7 @@ } ASObject::ASObject(const ASObject& o):Variables((o.classdef)?o.classdef->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL), - type(o.type),traitsInitialized(false),constructorCalled(false),implEnable(true) + type(o.type),traitsInitialized(false),constructIndicator(false),implEnable(true) { if(o.classdef) setClass(o.classdef);
View file
lightspark.tar.xz/src/asobject.h
Changed
@@ -283,7 +283,7 @@ virtual ~ASObject(); SWFOBJECT_TYPE type; bool traitsInitialized:1; - bool constructorCalled:1; + bool constructIndicator:1; void serializeDynamicProperties(ByteArray* out, std::map<tiny_string, uint32_t>& stringMap, std::map<const ASObject*, uint32_t>& objMap, std::map<const Class_base*, uint32_t> traitsMap) const; @@ -428,7 +428,7 @@ bool isPrimitive() const; bool isInitialized() const {return traitsInitialized;} - bool isConstructed() const; + virtual bool isConstructed() const; /* helper functions for calling the "valueOf" and * "toString" AS-functions which may be members of this @@ -495,6 +495,8 @@ void applyProxyProperty(multiname &name); void dumpVariables() { Variables.dumpVariables(); } + + void setConstructIndicator() { constructIndicator = true; } }; class Number;
View file
lightspark.tar.xz/src/backends/netutils.h
Changed
@@ -125,8 +125,6 @@ //-- DOWNLOADED DATA //File length (can change in certain cases, resulting in reallocation of the buffer (non-cached)) uint32_t length; - //Append data to the internal buffer - void append(uint8_t* buffer, uint32_t length); //Set the length of the downloaded file, can be called multiple times to accomodate a growing file void setLength(uint32_t _length); public: @@ -163,7 +161,8 @@ bool isRedirected() { return redirected; } const tiny_string& getOriginalURL() { return originalURL; } uint16_t getRequestStatus() { return requestStatus; } - + //Append data to the internal buffer + void append(uint8_t* buffer, uint32_t length); }; class ThreadedDownloader : public Downloader, public IThreadJob
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -360,10 +360,16 @@ builtin->registerBuiltin("ContentElement","flash.text.engine",Class<ContentElement>::getRef()); builtin->registerBuiltin("ElementFormat","flash.text.engine",Class<ElementFormat>::getRef()); builtin->registerBuiltin("FontDescription","flash.text.engine",Class<FontDescription>::getRef()); + builtin->registerBuiltin("FontMetrics","flash.text.engine",Class<FontMetrics>::getRef()); + builtin->registerBuiltin("FontLookup","flash.text.engine",Class<FontLookup>::getRef()); builtin->registerBuiltin("FontWeight","flash.text.engine",Class<FontWeight>::getRef()); + builtin->registerBuiltin("Kerning","flash.text.engine",Class<Kerning>::getRef()); + builtin->registerBuiltin("LineJustification","flash.text.engine",Class<LineJustification>::getRef()); + builtin->registerBuiltin("TextBaseline","flash.text.engine",Class<TextBaseline>::getRef()); builtin->registerBuiltin("TextBlock","flash.text.engine",Class<TextBlock>::getRef()); builtin->registerBuiltin("TextElement","flash.text.engine",Class<TextElement>::getRef()); builtin->registerBuiltin("TextLine","flash.text.engine",Class<TextLine>::getRef()); + builtin->registerBuiltin("TextLineValidity","flash.text.engine",Class<TextLineValidity>::getRef()); builtin->registerBuiltin("TextJustifier","flash.text.engine",Class<TextJustifier>::getRef()); builtin->registerBuiltin("SpaceJustifier","flash.text.engine",Class<SpaceJustifier>::getRef()); builtin->registerBuiltin("EastAsianJustifier","flash.text.engine",Class<EastAsianJustifier>::getRef()); @@ -389,6 +395,8 @@ builtin->registerBuiltin("clearInterval","flash.utils",_MR(Class<IFunction>::getFunction(clearInterval))); builtin->registerBuiltin("clearTimeout","flash.utils",_MR(Class<IFunction>::getFunction(clearTimeout))); builtin->registerBuiltin("describeType","flash.utils",_MR(Class<IFunction>::getFunction(describeType))); + builtin->registerBuiltin("escapeMultiByte","flash.utils",_MR(Class<IFunction>::getFunction(escapeMultiByte))); + builtin->registerBuiltin("unescapeMultiByte","flash.utils",_MR(Class<IFunction>::getFunction(unescapeMultiByte))); builtin->registerBuiltin("IExternalizable","flash.utils",InterfaceClass<IExternalizable>::getRef()); builtin->registerBuiltin("IDataInput","flash.utils",InterfaceClass<IDataInput>::getRef()); builtin->registerBuiltin("IDataOutput","flash.utils",InterfaceClass<IDataOutput>::getRef()); @@ -424,10 +432,10 @@ builtin->registerBuiltin("DRMStatusEvent","flash.events",Class<DRMStatusEvent>::getRef()); builtin->registerBuiltin("StageVideoEvent","flash.events",Class<StageVideoEvent>::getRef()); builtin->registerBuiltin("StageVideoAvailabilityEvent","flash.events",Class<StageVideoAvailabilityEvent>::getRef()); - builtin->registerBuiltin("TouchEvent","flash.events",Class<ASObject>::getStubClass(QName("TouchEvent","flash.events"))); - builtin->registerBuiltin("GestureEvent","flash.events",Class<ASObject>::getStubClass(QName("GestureEvent","flash.events"))); - builtin->registerBuiltin("PressAndTapGestureEvent","flash.events",Class<ASObject>::getStubClass(QName("PressAndTapGestureEvent","flash.events"))); - builtin->registerBuiltin("TransformGestureEvent","flash.events",Class<ASObject>::getStubClass(QName("TransformGestureEvent","flash.events"))); + builtin->registerBuiltin("TouchEvent","flash.events",Class<TouchEvent>::getRef()); + builtin->registerBuiltin("GestureEvent","flash.events",Class<GestureEvent>::getRef()); + builtin->registerBuiltin("PressAndTapGestureEvent","flash.events",Class<PressAndTapGestureEvent>::getRef()); + builtin->registerBuiltin("TransformGestureEvent","flash.events",Class<TransformGestureEvent>::getRef()); builtin->registerBuiltin("ContextMenuEvent","flash.events",Class<ContextMenuEvent>::getRef()); builtin->registerBuiltin("UncaughtErrorEvent","flash.events",Class<UncaughtErrorEvent>::getRef()); @@ -436,6 +444,7 @@ builtin->registerBuiltin("LocalConnection","flash.net",Class<ASObject>::getStubClass(QName("LocalConnection","flash.net"))); builtin->registerBuiltin("NetConnection","flash.net",Class<NetConnection>::getRef()); builtin->registerBuiltin("NetStream","flash.net",Class<NetStream>::getRef()); + builtin->registerBuiltin("NetStreamAppendBytesAction","flash.net",Class<NetStreamAppendBytesAction>::getRef()); builtin->registerBuiltin("NetStreamPlayOptions","flash.net",Class<NetStreamPlayOptions>::getRef()); builtin->registerBuiltin("NetStreamPlayTransitions","flash.net",Class<NetStreamPlayTransitions>::getRef()); builtin->registerBuiltin("URLLoader","flash.net",Class<URLLoader>::getRef()); @@ -446,6 +455,7 @@ builtin->registerBuiltin("URLRequestMethod","flash.net",Class<URLRequestMethod>::getRef()); builtin->registerBuiltin("URLVariables","flash.net",Class<URLVariables>::getRef()); builtin->registerBuiltin("SharedObject","flash.net",Class<SharedObject>::getRef()); + builtin->registerBuiltin("SharedObjectFlushStatus","flash.net",Class<SharedObjectFlushStatus>::getRef()); builtin->registerBuiltin("ObjectEncoding","flash.net",Class<ObjectEncoding>::getRef()); builtin->registerBuiltin("Socket","flash.net",Class<ASObject>::getStubClass(QName("Socket","flash.net"))); builtin->registerBuiltin("Responder","flash.net",Class<Responder>::getRef()); @@ -1343,7 +1353,7 @@ Class_inherit* derived_class_tmp=static_cast<Class_inherit*>(derived_class); if(derived_class_tmp->isBinded()) { - LOG(LOG_ERROR, "Class already binded to a tag. Not binding"); + LOG(LOG_ERROR, "Class already binded to a tag. Not binding:"<<s<< " class:"<<derived_class_tmp->getQualifiedClassName()); return NULL; } return derived_class_tmp; @@ -1539,6 +1549,17 @@ ret->decRef(); entry->decRef(); + + // initialize vars where type was not known during script init + // this may happen for variables of private classes defined in this script + for (auto it = uninitializedVars.begin(); it != uninitializedVars.end(); it++) + { + uninitializedVar v = *it; + LOG(LOG_CALLS,"initialize uninitialized var:"<< v.mainObj->toDebugString()<<" "<< v.mname << " " <<v.typemname); + v.mainObj->initializeVariableByMultiname(v.mname,NULL,&v.typemname,this,v.traitKind); + v.mainObj->decRef(); + } + uninitializedVars.clear(); LOG(LOG_CALLS, "Finished script init for script " << i ); } @@ -2039,9 +2060,17 @@ //do interfaces have cinit methods? //TODO: call them, set constructor property, do something if(classes[t->classi].cinit != 0) - LOG(LOG_NOT_IMPLEMENTED,"Interface cinit (static):"<<className); + { + method_info* m=&methods[classes[t->classi].cinit]; + if (m->body) + LOG(LOG_NOT_IMPLEMENTED,"Interface cinit (static):"<<className); + } if(instances[t->classi].init != 0) - LOG(LOG_NOT_IMPLEMENTED,"Interface cinit (constructor):"<<className); + { + method_info* m=&methods[instances[t->classi].init]; + if (m->body) + LOG(LOG_NOT_IMPLEMENTED,"Interface cinit (constructor):"<<className); + } ret = ci; } else
View file
lightspark.tar.xz/src/scripting/abc.h
Changed
@@ -142,6 +142,15 @@ ARGS_TYPE type; }; +struct uninitializedVar +{ + uninitializedVar():mname(NULL),mainObj(NULL),typemname(NULL),traitKind(NO_CREATE_TRAIT) {} + multiname mname; + ASObject* mainObj; + multiname typemname; + TRAIT_KIND traitKind; +}; + class ABCContext { friend class ABCVm; @@ -174,6 +183,9 @@ uint32_t namespaceBaseId; std::vector<bool> hasRunScriptInit; + // list of vars that have to be initialized after script init is done + std::vector<uninitializedVar> uninitializedVars; + /** Construct and insert in the a object a given trait @param obj the tarhget object
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -366,7 +366,7 @@ } } - LOG(LOG_NOT_IMPLEMENTED,"callProperty: " << name->normalizedName() << " not found on " << obj->toDebugString()); + LOG(LOG_NOT_IMPLEMENTED,"callProperty: " << name->qualifiedString() << " not found on " << obj->toDebugString()); if(keepReturn) th->runtime_stack_push(getSys()->getUndefinedRef()); @@ -1892,7 +1892,7 @@ namearg->setProxyProperty(*name); proxyArgs[1]=namearg; LOG(LOG_ERROR,"Proxy::getDescend:"<<namearg->toDebugString()<<*name); - + //We now suppress special handling LOG(LOG_CALLS,_("Proxy::callProperty")); f->incRef(); @@ -2044,7 +2044,8 @@ ret->context=th->context; //Null is a "valid" base class - if(baseClass->getObjectType()!=T_NULL) + // Undefined is used in private Classes that will be defined later + if(baseClass->getObjectType()!=T_NULL && baseClass->getObjectType()!=T_UNDEFINED) { assert_and_throw(baseClass->is<Class_base>()); Class_base* base = baseClass->as<Class_base>(); @@ -2075,7 +2076,7 @@ for(unsigned int i=0;i<cur->trait_count;i++) { int kind=cur->traits[i].kind&0xf; - if(kind==traits_info::Method || kind==traits_info::Setter || kind==traits_info::Getter) + if(kind==traits_info::Method || kind==traits_info::Setter || kind==traits_info::Getter || kind==traits_info::Slot) th->context->buildTrait(ret,&cur->traits[i],true); } @@ -2165,7 +2166,7 @@ } assert_and_throw(ret2->is<Undefined>()); ret2->decRef(); - LOG(LOG_CALLS,_("End of Class init ") << ret); + LOG(LOG_CALLS,_("End of Class init ") << *mname <<" " <<ret); th->runtime_stack_push(ret); cinit->decRef();
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.cpp
Changed
@@ -54,14 +54,14 @@ LoaderInfo::LoaderInfo(Class_base* c):EventDispatcher(c),applicationDomain(NullRef),securityDomain(NullRef), contentType("application/x-shockwave-flash"), bytesLoaded(0),bytesTotal(0),sharedEvents(NullRef), - loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),childAllowsParent(true) + loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true) { } LoaderInfo::LoaderInfo(Class_base* c, _R<Loader> l):EventDispatcher(c),applicationDomain(NullRef),securityDomain(NullRef), contentType("application/x-shockwave-flash"), bytesLoaded(0),bytesTotal(0),sharedEvents(NullRef), - loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),childAllowsParent(true) + loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true) { } @@ -81,6 +81,7 @@ c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_getHeight),GETTER_METHOD,true); REGISTER_GETTER(c,parameters); REGISTER_GETTER(c,actionScriptVersion); + REGISTER_GETTER(c,swfVersion); REGISTER_GETTER(c,childAllowsParent); REGISTER_GETTER(c,contentType); } @@ -89,6 +90,7 @@ ASFUNCTIONBODY_GETTER(LoaderInfo,actionScriptVersion); ASFUNCTIONBODY_GETTER(LoaderInfo,childAllowsParent); ASFUNCTIONBODY_GETTER(LoaderInfo,contentType); +ASFUNCTIONBODY_GETTER(LoaderInfo,swfVersion); void LoaderInfo::buildTraits(ASObject* o) { @@ -164,9 +166,6 @@ return; if(!loader.isNull() && obj==waitedObject) loader->setContent(obj); - if (bytesData.isNull()) - bytesData = _NR<ByteArray>(Class<ByteArray>::getInstanceS()); - bytesData->writeObject(obj.getPtr()); sendInit(); waitedObject.reset(); } @@ -253,6 +252,11 @@ ASFUNCTIONBODY(LoaderInfo,_getBytes) { LoaderInfo* th=static_cast<LoaderInfo*>(obj); + if (th->bytesData.isNull()) + th->bytesData = _NR<ByteArray>(Class<ByteArray>::getInstanceS()); + if (!th->loader->getContent().isNull()) + th->bytesData->writeObject(th->loader->getContent().getPtr()); + return th->bytesData.getPtr(); } @@ -317,6 +321,9 @@ // Wait for some data, making sure our check for failure is working sbuf->sgetc(); // peek one byte + if(downloader->getRequestStatus() == 204) // empty answer + return; + if(cache->hasFailed()) //Check to see if the download failed for some reason { LOG(LOG_ERROR, "Loader::execute(): Download of URL failed: " << url);
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.h
Changed
@@ -247,6 +247,7 @@ void sendInit(); public: ASPROPERTY_GETTER(uint32_t,actionScriptVersion); + ASPROPERTY_GETTER(uint32_t,swfVersion); ASPROPERTY_GETTER(bool, childAllowsParent); LoaderInfo(Class_base* c); LoaderInfo(Class_base* c, _R<Loader> l);
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.cpp
Changed
@@ -1285,3 +1285,38 @@ c->setVariableByQName("MENU_ITEM_SELECT","",Class<ASString>::getInstanceS("menuItemSelect"),DECLARED_TRAIT); c->setVariableByQName("MENU_SELECT","",Class<ASString>::getInstanceS("menuSelect"),DECLARED_TRAIT); } + + +void TouchEvent::sinit(Class_base* c) +{ + CLASS_SETUP(c, Event, _constructor, CLASS_SEALED); + c->setVariableByQName("TOUCH_BEGIN","",Class<ASString>::getInstanceS("touchBegin"),DECLARED_TRAIT); + c->setVariableByQName("TOUCH_END","",Class<ASString>::getInstanceS("touchEnd"),DECLARED_TRAIT); + c->setVariableByQName("TOUCH_MOVE","",Class<ASString>::getInstanceS("touchMove"),DECLARED_TRAIT); + c->setVariableByQName("TOUCH_OUT","",Class<ASString>::getInstanceS("touchOut"),DECLARED_TRAIT); + c->setVariableByQName("TOUCH_OVER","",Class<ASString>::getInstanceS("touchOver"),DECLARED_TRAIT); + c->setVariableByQName("TOUCH_ROLL_OUT","",Class<ASString>::getInstanceS("touchRollOut"),DECLARED_TRAIT); + c->setVariableByQName("TOUCH_ROLL_OVER","",Class<ASString>::getInstanceS("touchRollOver"),DECLARED_TRAIT); + c->setVariableByQName("TOUCH_TAP","",Class<ASString>::getInstanceS("touchTap"),DECLARED_TRAIT); +} + +void GestureEvent::sinit(Class_base* c) +{ + CLASS_SETUP(c, Event, _constructor, CLASS_SEALED); + c->setVariableByQName("GESTURE_TWO_FINGER_TAP","",Class<ASString>::getInstanceS("gestureTwoFingerTap"),DECLARED_TRAIT); +} + +void PressAndTapGestureEvent::sinit(Class_base* c) +{ + CLASS_SETUP(c, GestureEvent, _constructor, CLASS_SEALED); + c->setVariableByQName("GESTURE_PRESS_AND_TAP","",Class<ASString>::getInstanceS("gesturePressAndTap"),DECLARED_TRAIT); +} + +void TransformGestureEvent::sinit(Class_base* c) +{ + CLASS_SETUP(c, GestureEvent, _constructor, CLASS_SEALED); + c->setVariableByQName("GESTURE_PAN","",Class<ASString>::getInstanceS("gesturePan"),DECLARED_TRAIT); + c->setVariableByQName("GESTURE_ROTATE","",Class<ASString>::getInstanceS("gestureRotate"),DECLARED_TRAIT); + c->setVariableByQName("GESTURE_SWIPE","",Class<ASString>::getInstanceS("gestureSwipe"),DECLARED_TRAIT); + c->setVariableByQName("GESTURE_ZOOM","",Class<ASString>::getInstanceS("gestureZoom"),DECLARED_TRAIT); +}
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.h
Changed
@@ -536,5 +536,37 @@ static void buildTraits(ASObject* o) {} }; +class TouchEvent: public Event +{ +public: + TouchEvent(Class_base* c) : Event(c, "TouchEvent") {} + static void sinit(Class_base*); + static void buildTraits(ASObject* o) {} +}; + +class GestureEvent: public Event +{ +public: + GestureEvent(Class_base* c, const tiny_string& t = "GestureEvent") : Event(c, t) {} + static void sinit(Class_base*); + static void buildTraits(ASObject* o) {} +}; + +class PressAndTapGestureEvent: public GestureEvent +{ +public: + PressAndTapGestureEvent(Class_base* c) : GestureEvent(c, "PressAndTapGestureEvent") {} + static void sinit(Class_base*); + static void buildTraits(ASObject* o) {} +}; +class TransformGestureEvent: public GestureEvent +{ +public: + TransformGestureEvent(Class_base* c) : GestureEvent(c, "TransformGestureEvent") {} + static void sinit(Class_base*); + static void buildTraits(ASObject* o) {} +}; + + } #endif /* SCRIPTING_FLASH_EVENTS_FLASHEVENTS_H */
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.cpp
Changed
@@ -589,6 +589,13 @@ c->setVariableByQName("BINARY","",Class<ASString>::getInstanceS("binary"),DECLARED_TRAIT); } +void SharedObjectFlushStatus::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL); + c->setVariableByQName("FLUSHED","",Class<ASString>::getInstanceS("flushed"),DECLARED_TRAIT); + c->setVariableByQName("PENDING","",Class<ASString>::getInstanceS("pending"),DECLARED_TRAIT); +} + SharedObject::SharedObject(Class_base* c):EventDispatcher(c) { data=_MR(new_asobject()); @@ -601,7 +608,7 @@ CLASS_SETUP_NO_CONSTRUCTOR(c, EventDispatcher, CLASS_SEALED); c->setDeclaredMethodByQName("getLocal","",Class<IFunction>::getFunction(getLocal),NORMAL_METHOD,false); REGISTER_GETTER(c,data); -}; +} ASFUNCTIONBODY_GETTER(SharedObject,data); @@ -984,6 +991,14 @@ soundTransform = _MNR(Class<SoundTransform>::getInstanceS()); } +void NetStreamAppendBytesAction::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL); + c->setVariableByQName("END_SEQUENCE","",Class<ASString>::getInstanceS("endSequence"),DECLARED_TRAIT); + c->setVariableByQName("RESET_BEGIN","",Class<ASString>::getInstanceS("resetBegin"),DECLARED_TRAIT); + c->setVariableByQName("RESET_SEEK","",Class<ASString>::getInstanceS("resetSeek"),DECLARED_TRAIT); +} + void NetStream::finalize() { EventDispatcher::finalize(); @@ -1019,6 +1034,8 @@ c->setDeclaredMethodByQName("checkPolicyFile","",Class<IFunction>::getFunction(_getCheckPolicyFile),GETTER_METHOD,true); c->setDeclaredMethodByQName("checkPolicyFile","",Class<IFunction>::getFunction(_setCheckPolicyFile),SETTER_METHOD,true); c->setDeclaredMethodByQName("attach","",Class<IFunction>::getFunction(attach),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("appendBytes","",Class<IFunction>::getFunction(appendBytes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("appendBytesAction","",Class<IFunction>::getFunction(appendBytesAction),NORMAL_METHOD,true); REGISTER_GETTER(c, backBufferLength); REGISTER_GETTER_SETTER(c, backBufferTime); REGISTER_GETTER(c, bufferLength); @@ -1253,6 +1270,7 @@ ASFUNCTIONBODY(NetStream,seek) { //NetStream* th=Class<NetStream>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"NetStream.seek is not implemented yet"); assert_and_throw(argslen == 1); return NULL; } @@ -1267,6 +1285,23 @@ th->connection=netConnection; return NULL; } +ASFUNCTIONBODY(NetStream,appendBytes) +{ + NetStream* th=Class<NetStream>::cast(obj); + _NR<ByteArray> bytearray; + ARG_UNPACK(bytearray); + + if(!bytearray.isNull()) + th->downloader->append(bytearray->getBuffer(bytearray->getLength(),false),bytearray->getLength()); + return NULL; +} +ASFUNCTIONBODY(NetStream,appendBytesAction) +{ + //NetStream* th=Class<NetStream>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"NetStream.appendBytesAction is not implemented yet"); + assert_and_throw(argslen == 1); + return NULL; +} //Tick is called from the timer thread, this happens only if a decoder is available void NetStream::tick()
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.h
Changed
@@ -94,6 +94,14 @@ static void sinit(Class_base*); }; + +class SharedObjectFlushStatus: public ASObject +{ +public: + SharedObjectFlushStatus(Class_base* c):ASObject(c){} + static void sinit(Class_base*); +}; + class SharedObject: public EventDispatcher { public: @@ -208,6 +216,14 @@ ASPROPERTY_GETTER_SETTER(NullableRef<ASObject>,client); }; +class NetStreamAppendBytesAction: public ASObject +{ +public: + NetStreamAppendBytesAction(Class_base* c):ASObject(c){} + static void sinit(Class_base*); +}; + + class SoundTransform; class NetStream: public EventDispatcher, public IThreadJob, public ITickJob { @@ -273,6 +289,8 @@ ASFUNCTION(_getCheckPolicyFile); ASFUNCTION(_setCheckPolicyFile); ASFUNCTION(attach); + ASFUNCTION(appendBytes); + ASFUNCTION(appendBytesAction); ASPROPERTY_GETTER(number_t, backBufferLength); ASPROPERTY_GETTER_SETTER(number_t, backBufferTime); ASPROPERTY_GETTER(number_t, bufferLength);
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.cpp
Changed
@@ -287,7 +287,8 @@ LOG(LOG_CALLS,_("Looking for definition of ") << name); ASObject* target; ASObject* o=th->getVariableAndTargetByMultiname(name,target); - assert_and_throw(o); + if(o == NULL) + throwError<ReferenceError>(kClassNotFoundError,name.normalizedName()); //TODO: specs says that also namespaces and function may be returned assert_and_throw(o->getObjectType()==T_CLASS);
View file
lightspark.tar.xz/src/scripting/flash/text/flashtextengine.cpp
Changed
@@ -30,23 +30,102 @@ void ContentElement::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_SEALED); + REGISTER_GETTER_SETTER(c,elementFormat); +} +ASFUNCTIONBODY_GETTER_SETTER(ContentElement,elementFormat) + +ElementFormat::ElementFormat(Class_base *c): ASObject(c), + alignmentBaseline("useDominantBaseline"), + alpha(1.0), + baselineShift(0.0), + breakOpportunity("auto"), + color(0x000000), + digitCase("default"), + digitWidth("default"), + dominantBaseline("roman"), + fontDescription(NULL), + fontSize(12.0), + kerning("on"), + ligatureLevel("common"), + locale("en"), + locked(false), + textRotation("auto"), + trackingLeft(0.0), + trackingRight(0.0), + typographicCase("default") +{ + } void ElementFormat::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); c->setVariableByQName("GRAPHIC_ELEMENT","",abstract_ui(0xFDEF),CONSTANT_TRAIT); + REGISTER_GETTER_SETTER(c,alignmentBaseline); + REGISTER_GETTER_SETTER(c,alpha); + REGISTER_GETTER_SETTER(c,baselineShift); + REGISTER_GETTER_SETTER(c,breakOpportunity); + REGISTER_GETTER_SETTER(c,color); + REGISTER_GETTER_SETTER(c,digitCase); + REGISTER_GETTER_SETTER(c,digitWidth); + REGISTER_GETTER_SETTER(c,dominantBaseline); + REGISTER_GETTER_SETTER(c,fontDescription); + REGISTER_GETTER_SETTER(c,fontSize); + REGISTER_GETTER_SETTER(c,kerning); + REGISTER_GETTER_SETTER(c,ligatureLevel); + REGISTER_GETTER_SETTER(c,locale); + REGISTER_GETTER_SETTER(c,locked); + REGISTER_GETTER_SETTER(c,textRotation); + REGISTER_GETTER_SETTER(c,trackingLeft); + REGISTER_GETTER_SETTER(c,trackingRight); + REGISTER_GETTER_SETTER(c,typographicCase); } +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,alignmentBaseline) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,alpha) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,baselineShift) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,breakOpportunity) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,color) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,digitCase) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,digitWidth) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,dominantBaseline) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,fontDescription) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,fontSize) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,kerning) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,ligatureLevel) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,locale) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,locked) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,textRotation) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,trackingLeft) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,trackingRight) +ASFUNCTIONBODY_GETTER_SETTER(ElementFormat,typographicCase) ASFUNCTIONBODY(ElementFormat, _constructor) { - LOG(LOG_NOT_IMPLEMENTED, "ElementFormat class not implemented"); + ElementFormat* th=static_cast<ElementFormat*>(obj); + ARG_UNPACK(th->fontDescription, NullRef)(th->fontSize, 12.0)(th->color, 0x000000) (th->alpha, 1.0)(th->textRotation, "auto") + (th->dominantBaseline, "roman") (th->alignmentBaseline, "useDominantBaseline") (th->baselineShift, 0.0)(th->kerning, "on") + (th->trackingRight, 0.0)(th->trackingLeft, 0.0)(th->locale, "en")(th->breakOpportunity, "auto")(th->digitCase, "default") + (th->digitWidth, "default")(th->ligatureLevel, "common")(th->typographicCase, "default"); return NULL; } +void FontLookup::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); + c->setVariableByQName("DEVICE","",Class<ASString>::getInstanceS("device"),CONSTANT_TRAIT); + c->setVariableByQName("EMBEDDED_CFF","",Class<ASString>::getInstanceS("embeddedCFF"),CONSTANT_TRAIT); +} + void FontDescription::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); + REGISTER_GETTER_SETTER(c,cffHinting); + REGISTER_GETTER_SETTER(c,fontLookup); + REGISTER_GETTER_SETTER(c,fontName); + REGISTER_GETTER_SETTER(c,fontPosture); + REGISTER_GETTER_SETTER(c,fontWeight); + REGISTER_GETTER_SETTER(c,locked); + REGISTER_GETTER_SETTER(c,renderingMode); } ASFUNCTIONBODY(FontDescription, _constructor) @@ -54,6 +133,13 @@ LOG(LOG_NOT_IMPLEMENTED, "FontDescription class not implemented"); return NULL; } +ASFUNCTIONBODY_GETTER_SETTER(FontDescription,cffHinting) +ASFUNCTIONBODY_GETTER_SETTER(FontDescription,fontLookup) +ASFUNCTIONBODY_GETTER_SETTER(FontDescription,fontName) +ASFUNCTIONBODY_GETTER_SETTER(FontDescription,fontPosture) +ASFUNCTIONBODY_GETTER_SETTER(FontDescription,fontWeight) +ASFUNCTIONBODY_GETTER_SETTER(FontDescription,locked) +ASFUNCTIONBODY_GETTER_SETTER(FontDescription,renderingMode) void FontWeight::sinit(Class_base* c) { @@ -62,6 +148,44 @@ c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),CONSTANT_TRAIT); } +void FontMetrics::sinit(Class_base* c) +{ + CLASS_SETUP(c, ASObject,_constructor, CLASS_FINAL); +} +ASFUNCTIONBODY(FontMetrics, _constructor) +{ + //FontMetrics* th=static_cast<FontMetrics*>(obj); + LOG(LOG_NOT_IMPLEMENTED, "FontMetrics is a stub"); + return NULL; +} + +void Kerning::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); + c->setVariableByQName("AUTO","",Class<ASString>::getInstanceS("auto"),CONSTANT_TRAIT); + c->setVariableByQName("OFF","",Class<ASString>::getInstanceS("off"),CONSTANT_TRAIT); + c->setVariableByQName("ON","",Class<ASString>::getInstanceS("on"),CONSTANT_TRAIT); +} + +void LineJustification::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); + c->setVariableByQName("ALL_BUT_LAST","",Class<ASString>::getInstanceS("allButLast"),CONSTANT_TRAIT); + c->setVariableByQName("ALL_BUT_MANDATORY_BREAK","",Class<ASString>::getInstanceS("allButMandatoryBreak"),CONSTANT_TRAIT); + c->setVariableByQName("ALL_INCLUDING_LAST","",Class<ASString>::getInstanceS("allIncludingLast"),CONSTANT_TRAIT); + c->setVariableByQName("UNJUSTIFIED","",Class<ASString>::getInstanceS("unjustified"),CONSTANT_TRAIT); +} +void TextBaseline::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); + c->setVariableByQName("ASCENT","",Class<ASString>::getInstanceS("ascent"),CONSTANT_TRAIT); + c->setVariableByQName("DESCENT","",Class<ASString>::getInstanceS("descent"),CONSTANT_TRAIT); + c->setVariableByQName("IDEOGRAPHIC_BOTTOM","",Class<ASString>::getInstanceS("ideographicBottom"),CONSTANT_TRAIT); + c->setVariableByQName("IDEOGRAPHIC_CENTER","",Class<ASString>::getInstanceS("ideographicCenter"),CONSTANT_TRAIT); + c->setVariableByQName("IDEOGRAPHIC_TOP","",Class<ASString>::getInstanceS("ideographicTop"),CONSTANT_TRAIT); + c->setVariableByQName("ROMAN","",Class<ASString>::getInstanceS("roman"),CONSTANT_TRAIT); + c->setVariableByQName("USE_DOMINANT_BASELINE","",Class<ASString>::getInstanceS("useDominantBaseline"),CONSTANT_TRAIT); +} void TextJustifier::sinit(Class_base* c) { @@ -78,7 +202,7 @@ } ASFUNCTIONBODY(SpaceJustifier, _constructor) { - SpaceJustifier* th=static_cast<SpaceJustifier*>(obj); + //SpaceJustifier* th=static_cast<SpaceJustifier*>(obj); LOG(LOG_NOT_IMPLEMENTED, "SpaceJustifier is a stub"); return NULL; } @@ -88,7 +212,7 @@ } ASFUNCTIONBODY(EastAsianJustifier, _constructor) { - EastAsianJustifier* th=static_cast<EastAsianJustifier*>(obj); + //EastAsianJustifier* th=static_cast<EastAsianJustifier*>(obj); LOG(LOG_NOT_IMPLEMENTED, "EastAsianJustifier is a stub"); return NULL; } @@ -97,12 +221,15 @@ { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); c->setDeclaredMethodByQName("createTextLine","",Class<IFunction>::getFunction(createTextLine),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("recreateTextLine","",Class<IFunction>::getFunction(recreateTextLine),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c, content); REGISTER_GETTER_SETTER(c, textJustifier); + REGISTER_GETTER_SETTER(c, bidiLevel); } ASFUNCTIONBODY_GETTER_SETTER(TextBlock, content) ASFUNCTIONBODY_GETTER_SETTER(TextBlock, textJustifier) +ASFUNCTIONBODY_GETTER_SETTER(TextBlock, bidiLevel) ASFUNCTIONBODY(TextBlock, _constructor) { @@ -119,26 +246,87 @@ TextBlock* th=static_cast<TextBlock*>(obj); _NR<TextLine> previousLine;
View file
lightspark.tar.xz/src/scripting/flash/text/flashtextengine.h
Changed
@@ -29,40 +29,104 @@ namespace lightspark { +class ElementFormat; class ContentElement: public ASObject { public: - ContentElement(Class_base* c): ASObject(c) {}; + ContentElement(Class_base* c): ASObject(c),elementFormat(NULL) {} static void sinit(Class_base* c); + ASPROPERTY_GETTER_SETTER(_NR<ElementFormat>,elementFormat); }; +class FontDescription; class ElementFormat: public ASObject { public: - ElementFormat(Class_base* c): ASObject(c) {}; + ElementFormat(Class_base* c); static void sinit(Class_base* c); ASFUNCTION(_constructor); + ASPROPERTY_GETTER_SETTER(tiny_string,alignmentBaseline); + ASPROPERTY_GETTER_SETTER(number_t,alpha); + ASPROPERTY_GETTER_SETTER(number_t,baselineShift); + ASPROPERTY_GETTER_SETTER(tiny_string,breakOpportunity); + ASPROPERTY_GETTER_SETTER(uint,color); + ASPROPERTY_GETTER_SETTER(tiny_string,digitCase); + ASPROPERTY_GETTER_SETTER(tiny_string,digitWidth); + ASPROPERTY_GETTER_SETTER(tiny_string,dominantBaseline); + ASPROPERTY_GETTER_SETTER(_NR<FontDescription>,fontDescription); + ASPROPERTY_GETTER_SETTER(number_t,fontSize); + ASPROPERTY_GETTER_SETTER(tiny_string,kerning); + ASPROPERTY_GETTER_SETTER(tiny_string,ligatureLevel); + ASPROPERTY_GETTER_SETTER(tiny_string,locale); + ASPROPERTY_GETTER_SETTER(bool,locked); + ASPROPERTY_GETTER_SETTER(tiny_string,textRotation); + ASPROPERTY_GETTER_SETTER(number_t,trackingLeft); + ASPROPERTY_GETTER_SETTER(number_t,trackingRight); + ASPROPERTY_GETTER_SETTER(tiny_string,typographicCase); +}; + +class FontLookup: public ASObject +{ +public: + FontLookup(Class_base* c): ASObject(c) {} + static void sinit(Class_base* c); }; class FontDescription: public ASObject { public: - FontDescription(Class_base* c): ASObject(c) {}; + FontDescription(Class_base* c): ASObject(c), + cffHinting("horizontalStem"), fontLookup("device"), fontName("_serif"), fontPosture("normal"), fontWeight("normal"),locked(false), renderingMode("cff") {} static void sinit(Class_base* c); ASFUNCTION(_constructor); + ASPROPERTY_GETTER_SETTER(tiny_string,cffHinting); + ASPROPERTY_GETTER_SETTER(tiny_string,fontLookup); + ASPROPERTY_GETTER_SETTER(tiny_string,fontName); + ASPROPERTY_GETTER_SETTER(tiny_string,fontPosture); + ASPROPERTY_GETTER_SETTER(tiny_string,fontWeight); + ASPROPERTY_GETTER_SETTER(bool,locked); + ASPROPERTY_GETTER_SETTER(tiny_string,renderingMode); }; class FontWeight: public ASObject { public: - FontWeight(Class_base* c): ASObject(c) {}; + FontWeight(Class_base* c): ASObject(c) {} + static void sinit(Class_base* c); +}; + +class FontMetrics: public ASObject +{ +public: + FontMetrics(Class_base* c): ASObject(c) {} + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; + +class Kerning: public ASObject +{ +public: + Kerning(Class_base* c): ASObject(c) {} + static void sinit(Class_base* c); +}; +class LineJustification: public ASObject +{ +public: + LineJustification(Class_base* c): ASObject(c) {} + static void sinit(Class_base* c); +}; + +class TextBaseline: public ASObject +{ +public: + TextBaseline(Class_base* c): ASObject(c) {} static void sinit(Class_base* c); }; class TextJustifier: public ASObject { public: - TextJustifier(Class_base* c): ASObject(c) {}; + TextJustifier(Class_base* c): ASObject(c) {} static void sinit(Class_base* c); ASFUNCTION(_constructor); }; @@ -70,7 +134,7 @@ class SpaceJustifier: public TextJustifier { public: - SpaceJustifier(Class_base* c): TextJustifier(c) {}; + SpaceJustifier(Class_base* c): TextJustifier(c) {} static void sinit(Class_base* c); ASFUNCTION(_constructor); }; @@ -78,7 +142,7 @@ class EastAsianJustifier: public TextJustifier { public: - EastAsianJustifier(Class_base* c): TextJustifier(c) {}; + EastAsianJustifier(Class_base* c): TextJustifier(c) {} static void sinit(Class_base* c); ASFUNCTION(_constructor); }; @@ -86,18 +150,20 @@ class TextBlock: public ASObject { public: - TextBlock(Class_base* c): ASObject(c) {}; + TextBlock(Class_base* c): ASObject(c),bidiLevel(0) {} static void sinit(Class_base* c); ASFUNCTION(_constructor); ASFUNCTION(createTextLine); + ASFUNCTION(recreateTextLine); ASPROPERTY_GETTER_SETTER(_NR<ContentElement>, content); ASPROPERTY_GETTER_SETTER(_NR<TextJustifier>, textJustifier); + ASPROPERTY_GETTER_SETTER(int,bidiLevel); }; class TextElement: public ContentElement { public: - TextElement(Class_base* c): ContentElement(c) {}; + TextElement(Class_base* c): ContentElement(c) {} static void sinit(Class_base* c); ASFUNCTION(_constructor); ASPROPERTY_GETTER_SETTER(tiny_string,text); @@ -114,11 +180,27 @@ void renderImpl(RenderContext& ctxt) const; _NR<DisplayObject> hitTestImpl(_NR<DisplayObject> last, number_t x, number_t y, DisplayObject::HIT_TYPE type); public: - TextLine(Class_base* c, _NR<ContentElement> content=NullRef, _NR<TextBlock> owner=NullRef); + TextLine(Class_base* c,tiny_string linetext = "", _NR<TextBlock> owner=NullRef); static void sinit(Class_base* c); void updateSizes(); ASFUNCTION(_constructor); ASPROPERTY_GETTER(_NR<TextBlock>, textBlock); + ASPROPERTY_GETTER(_NR<TextLine>, nextLine); + ASPROPERTY_GETTER(_NR<TextLine>, previousLine); + ASPROPERTY_GETTER_SETTER(tiny_string,validity); + ASPROPERTY_GETTER_SETTER(_NR<ASObject>,userData); + ASFUNCTION(getDescent); + ASFUNCTION(getAscent); + ASFUNCTION(getTextWidth); + ASFUNCTION(getTextHeight); + +}; + +class TextLineValidity: public ASObject +{ +public: + TextLineValidity(Class_base* c): ASObject(c) {} + static void sinit(Class_base* c); }; }
View file
lightspark.tar.xz/src/scripting/flash/ui/ContextMenuItem.cpp
Changed
@@ -25,6 +25,7 @@ void ContextMenuItem::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_FINAL); + REGISTER_GETTER_SETTER(c, caption); } ASFUNCTIONBODY(ContextMenuItem,_constructor) @@ -33,4 +34,5 @@ return NULL; } +ASFUNCTIONBODY_GETTER_SETTER(ContextMenuItem,caption);
View file
lightspark.tar.xz/src/scripting/flash/ui/ContextMenuItem.h
Changed
@@ -32,6 +32,7 @@ ContextMenuItem(Class_base* c):EventDispatcher(c){} static void sinit(Class_base* c); ASFUNCTION(_constructor); + ASPROPERTY_GETTER_SETTER(tiny_string, caption); }; }
View file
lightspark.tar.xz/src/scripting/flash/utils/flashutils.cpp
Changed
@@ -232,3 +232,16 @@ getSys()->intervalManager->clearInterval(args[0]->toInt(), IntervalRunner::TIMEOUT, true); return NULL; } + +ASFUNCTIONBODY(lightspark,escapeMultiByte) +{ + tiny_string str; + ARG_UNPACK (str, "undefined"); + return Class<ASString>::getInstanceS(URLInfo::encode(str, URLInfo::ENCODE_ESCAPE)); +} +ASFUNCTIONBODY(lightspark,unescapeMultiByte) +{ + tiny_string str; + ARG_UNPACK (str, "undefined"); + return Class<ASString>::getInstanceS(URLInfo::decode(str, URLInfo::ENCODE_ESCAPE)); +}
View file
lightspark.tar.xz/src/scripting/flash/utils/flashutils.h
Changed
@@ -67,6 +67,8 @@ ASObject* clearInterval(ASObject* obj,ASObject* const* args, const unsigned int argslen); ASObject* clearTimeout(ASObject* obj,ASObject* const* args, const unsigned int argslen); ASObject* describeType(ASObject* obj,ASObject* const* args, const unsigned int argslen); +ASObject* escapeMultiByte(ASObject* obj,ASObject* const* args, const unsigned int argslen); +ASObject* unescapeMultiByte(ASObject* obj,ASObject* const* args, const unsigned int argslen); }
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.cpp
Changed
@@ -538,6 +538,8 @@ { case T_STRING: { + if (!this->isConstructed()) + return !r->isConstructed(); const ASString* s=static_cast<const ASString*>(r); return s->data==data; } @@ -548,6 +550,8 @@ return toNumber()==r->toNumber(); case T_NULL: case T_UNDEFINED: + if (!this->isConstructed()) + return true; return false; default: return r->isEqual(this);
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.h
Changed
@@ -88,6 +88,8 @@ o->decRef(); return getSys()->getNullRef(); } + if(!o->isConstructed()) + return o; tiny_string n = o->toString(); o->decRef(); return Class<ASString>::getInstanceS(n);
View file
lightspark.tar.xz/src/scripting/toplevel/Boolean.cpp
Changed
@@ -52,10 +52,10 @@ case T_UINTEGER: return o->as<UInteger>()->val != 0; case T_STRING: + if (!o->isConstructed()) + return false; return !o->as<ASString>()->data.empty(); - case T_CLASS: case T_FUNCTION: - return true; case T_ARRAY: case T_OBJECT: // not constructed objects return false @@ -142,6 +142,9 @@ return b->val==val; } case T_STRING: + if (!r->isConstructed()) + return false; + return val==r->toNumber(); case T_INTEGER: case T_UINTEGER: case T_NUMBER:
View file
lightspark.tar.xz/src/scripting/toplevel/Integer.cpp
Changed
@@ -196,8 +196,8 @@ void Integer::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("MAX_VALUE","",new (c->memoryAccount) Integer(c,numeric_limits<int32_t>::max()),CONSTANT_TRAIT); - c->setVariableByQName("MIN_VALUE","",new (c->memoryAccount) Integer(c,numeric_limits<int32_t>::min()),CONSTANT_TRAIT); + c->setVariableByQName("MAX_VALUE","",abstract_i(numeric_limits<int32_t>::max()),CONSTANT_TRAIT); + c->setVariableByQName("MIN_VALUE","",abstract_i(numeric_limits<int32_t>::min()),CONSTANT_TRAIT); c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(_toFixed,1),NORMAL_METHOD,true); c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(_toExponential,1),NORMAL_METHOD,true);
View file
lightspark.tar.xz/src/scripting/toplevel/Number.cpp
Changed
@@ -260,17 +260,11 @@ void Number::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); - //Must create and link the number the hard way - Number* ninf=new (c->memoryAccount) Number(c, -numeric_limits<double>::infinity()); - Number* pinf=new (c->memoryAccount) Number(c, numeric_limits<double>::infinity()); - Number* pmax=new (c->memoryAccount) Number(c, numeric_limits<double>::max()); - Number* pmin=new (c->memoryAccount) Number(c, numeric_limits<double>::min()); - Number* pnan=new (c->memoryAccount) Number(c, numeric_limits<double>::quiet_NaN()); - c->setVariableByQName("NEGATIVE_INFINITY","",ninf,CONSTANT_TRAIT); - c->setVariableByQName("POSITIVE_INFINITY","",pinf,CONSTANT_TRAIT); - c->setVariableByQName("MAX_VALUE","",pmax,CONSTANT_TRAIT); - c->setVariableByQName("MIN_VALUE","",pmin,CONSTANT_TRAIT); - c->setVariableByQName("NaN","",pnan,CONSTANT_TRAIT); + c->setVariableByQName("NEGATIVE_INFINITY","",abstract_d(-numeric_limits<double>::infinity()),CONSTANT_TRAIT); + c->setVariableByQName("POSITIVE_INFINITY","",abstract_d(numeric_limits<double>::infinity()),CONSTANT_TRAIT); + c->setVariableByQName("MAX_VALUE","",abstract_d(numeric_limits<double>::max()),CONSTANT_TRAIT); + c->setVariableByQName("MIN_VALUE","",abstract_d(numeric_limits<double>::min()),CONSTANT_TRAIT); + c->setVariableByQName("NaN","",abstract_d(numeric_limits<double>::quiet_NaN()),CONSTANT_TRAIT); c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(toFixed,1),NORMAL_METHOD,true); c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(toExponential,1),NORMAL_METHOD,true);
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -85,9 +85,13 @@ case T_NUMBER: case T_INTEGER: case T_UINTEGER: - case T_STRING: case T_BOOLEAN: return false; + case T_FUNCTION: + case T_STRING: + if (!r->isConstructed()) + return true; + return false; default: return r->isEqual(this); } @@ -570,9 +574,13 @@ case T_INTEGER: case T_UINTEGER: case T_NUMBER: - case T_STRING: case T_BOOLEAN: return false; + case T_FUNCTION: + case T_STRING: + if (!r->isConstructed()) + return true; + return false; default: return r->isEqual(this); } @@ -806,11 +814,11 @@ return o; if(o->is<Class_base>()) { /* classes can be cast to the type 'Object' or 'Class' */ - if(this == Class<ASObject>::getClass() + if(this == Class<ASObject>::getClass() || (class_name.name=="Class" && class_name.ns=="")) - return o; /* 'this' is the type of a class */ - else - throwError<TypeError>(kCheckTypeFailedError, o->getClassName(), getQualifiedClassName()); + return o; /* 'this' is the type of a class */ + else + throwError<TypeError>(kCheckTypeFailedError, o->getClassName(), getQualifiedClassName()); } if (o->is<ObjectConstructor>()) return o; @@ -956,13 +964,13 @@ { target->incRef(); ASObject* ret=constructor->call(target,args,argslen); - target->constructorCalled = true; + target->constructIndicator = true; assert_and_throw(ret->is<Undefined>()); ret->decRef(); } else { - target->constructorCalled = true; + target->constructIndicator = true; for(uint32_t i=0;i<argslen;i++) args[i]->decRef(); //throwError<TypeError>(kConstructOfNonFunctionError); @@ -1915,7 +1923,10 @@ { if (argslen > 0) throwError<EvalError>(kFunctionConstructorError); - return getNopFunction(); + ASObject* ret = getNopFunction(); + if (construct) + ret->setConstructIndicator(); + return ret; } Class<IFunction>* Class<IFunction>::getClass() @@ -1937,6 +1948,7 @@ ret->prototype = _MNR(new_functionPrototype(ret, ret->super->prototype)); ret->incRef(); ret->prototype->getObj()->setVariableByQName("constructor","",ret,DYNAMIC_TRAIT); + ret->prototype->getObj()->setConstructIndicator(); ret->incRef(); *retAddr = ret; @@ -2349,7 +2361,7 @@ ObjectPrototype::ObjectPrototype(Class_base* c) : ASObject(c) { traitsInitialized = true; - constructorCalled = true; + constructIndicator = true; } bool ObjectPrototype::isEqual(ASObject* r) {
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -343,6 +343,7 @@ /* returns whether this is this a method of a function */ bool isMethod() const { return inClass != NULL; } bool isBound() const { return closure_this; } + bool isConstructed() const { return constructIndicator; } void finalize(); ASFUNCTION(apply); ASFUNCTION(_call); @@ -372,6 +373,7 @@ ret->setClass(getClass()); } ret->closure_this=c; + ret->constructIndicator = true; //std::cout << "Binding " << ret << std::endl; return ret; } @@ -489,6 +491,7 @@ { Class<IFunction>* c=Class<IFunction>::getClass(); Function* ret=new (c->memoryAccount) Function(c, v); + ret->constructIndicator = true; return ret; } static Function* getFunction(Function::as_function v, int len) @@ -496,12 +499,14 @@ Class<IFunction>* c=Class<IFunction>::getClass(); Function* ret=new (c->memoryAccount) Function(c, v); ret->length = len; + ret->constructIndicator = true; return ret; } static SyntheticFunction* getSyntheticFunction(method_info* m) { Class<IFunction>* c=Class<IFunction>::getClass(); SyntheticFunction* ret=new (c->memoryAccount) SyntheticFunction(c, m); + ret->constructIndicator = true; c->handleConstruction(ret,NULL,0,true); return ret; }
View file
lightspark.tar.xz/src/swf.cpp
Changed
@@ -145,7 +145,7 @@ { Class_base* movieClipClass = Class<MovieClip>::getClass(); RootMovieClip* ret=new (movieClipClass->memoryAccount) RootMovieClip(li, appDomain, secDomain, movieClipClass); - ret->constructorCalled = true; + ret->constructIndicator = true; return ret; } @@ -1346,6 +1346,11 @@ try { parseSWFHeader(root, ver); + if (loader) + { + _NR<LoaderInfo> li=loader->getContentLoaderInfo(); + li->swfVersion = root->version; + } if(root->version < 9) { LOG(LOG_INFO,"SWF version " << root->version << " is not handled by lightspark, falling back to gnash (if available)");
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -43,7 +43,7 @@ tiny_string multiname::qualifiedString() const { - assert_and_throw(ns.size()==1); + assert_and_throw(ns.size()>=1); assert_and_throw(name_type==NAME_STRING); const tiny_string nsName=ns[0].getImpl().name; const tiny_string& name=getSys()->getStringFromUniqueId(name_s_id); @@ -523,10 +523,14 @@ assert(v.version!=0xff); UI8 FillStyleCount; s >> FillStyleCount; + int fsc = FillStyleCount; if(FillStyleCount==0xff) - LOG(LOG_ERROR,_("Fill array extended not supported")); - - for(int i=0;i<FillStyleCount;i++) + { + UI16_SWF ExtendedFillStyleCount; + s >> ExtendedFillStyleCount; + fsc = ExtendedFillStyleCount; + } + for(int i=0;i<fsc;i++) { FILLSTYLE t(v.version); s >> t; @@ -814,7 +818,7 @@ else { LOG(LOG_ERROR,_("Not supported fill style ") << (int)v.FillStyleType); - throw ParseException("Not supported fill style"); + throw ParseException("Not supported fill style"); } return s; }
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.