Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 64
View file
lightspark.spec
Changed
@@ -24,7 +24,7 @@ %endif Name: lightspark -Version: 0.7.2.99+git20150322.1346 +Version: 0.7.2.99+git20150403.1618 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/CMakeLists.txt
Changed
@@ -244,9 +244,9 @@ IF(${LLVM_STRING_VERSION} VERSION_GREATER 3.4) ADD_DEFINITIONS(-DLLVM_35) ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 3.4) -IF(${LLVM_STRING_VERSION} VERSION_GREATER 3.5) +IF(NOT (${LLVM_STRING_VERSION} VERSION_LESS 3.6)) ADD_DEFINITIONS(-DLLVM_36) -ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 3.5) +ENDIF(NOT (${LLVM_STRING_VERSION} VERSION_LESS 3.6)) INCLUDE(FindZLIB REQUIRED) INCLUDE(FindFreetype REQUIRED) IF(NOT(ENABLE_GLES2))
View file
lightspark.tar.xz/ChangeLog
Changed
@@ -2,6 +2,11 @@ Version NEXT: + * Support LLVM up to version 3.6 + * fix event dispatcher handling + * several fixes for object initialization + * partially implement AMF0 decoding + * complete rework of XML subsystem * Support embedded audio * Implement JSON parsing
View file
lightspark.tar.xz/conf/FindFreetype.cmake
Changed
@@ -52,9 +52,13 @@ /sw/include /opt/local/include /usr/freeware/include + PATH_SUFFIXES freetype2 ) -FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h +FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 + NAMES + freetype/config/ftheader.h + config/ftheader.h HINTS $ENV{FREETYPE_DIR}/include/freetype2 PATHS
View file
lightspark.tar.xz/debian/control
Changed
@@ -2,7 +2,7 @@ Section: utils Priority: optional Maintainer: Alessandro Pignotti <a.pignotti@sssup.it> -Build-Depends: g++ (>=4.5), gnash, cmake, cdbs, nasm, debhelper (>= 7), llvm-3.0-dev, libgl1-mesa-dev, libxext-dev, libcurl4-gnutls-dev | libcurl4-openssl-dev, libxml2-dev, zlib1g-dev, libavcodec-dev, libpcre3-dev, libglew1.5-dev, libboost-filesystem-dev, libboost-system-dev, libxml++2.6-dev (>= 2.33.1), libcairo2-dev, libgtk2.0-dev, libjpeg8-dev, libavformat-dev, libpango1.0-dev, libpulse-dev, librtmp-dev, liblzma-dev +Build-Depends: g++ (>=4.5), gnash, cmake, cdbs, nasm, debhelper (>= 7), llvm-dev, libgl1-mesa-dev, libxext-dev, libcurl4-gnutls-dev | libcurl4-openssl-dev, libxml2-dev, zlib1g-dev, libavcodec-dev, libpcre3-dev, libglew1.5-dev, libboost-filesystem-dev, libboost-system-dev, libxml++2.6-dev (>= 2.33.1), libcairo2-dev, libgtk2.0-dev, libjpeg8-dev, libavformat-dev, libavresample-dev, libpango1.0-dev, libpulse-dev, librtmp-dev, liblzma-dev, libfreetype6-dev, libpng-dev Standards-Version: 3.8.4 Homepage: http://lightspark.sf.net Vcs-git: git://github.com/alexp-sssup/lightspark.git
View file
lightspark.tar.xz/src/allclasses.h
Changed
@@ -134,6 +134,7 @@ REGISTER_CLASS_NAME(TextEvent,"flash.events") REGISTER_CLASS_NAME(TimerEvent,"flash.events") REGISTER_CLASS_NAME(ContextMenuEvent,"flash.events") +REGISTER_CLASS_NAME(UncaughtErrorEvent,"flash.events") //External interface (browser interaction) REGISTER_CLASS_NAME(ExternalInterface,"flash.external") @@ -219,11 +220,14 @@ //Text engine REGISTER_CLASS_NAME(ContentElement,"flash.text.engine") +REGISTER_CLASS_NAME(EastAsianJustifier,"flash.text.engine") REGISTER_CLASS_NAME(ElementFormat,"flash.text.engine") REGISTER_CLASS_NAME(FontDescription,"flash.text.engine") REGISTER_CLASS_NAME(FontWeight,"flash.text.engine") +REGISTER_CLASS_NAME(SpaceJustifier,"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") //Utils
View file
lightspark.tar.xz/src/backends/urlutils.cpp
Changed
@@ -311,7 +311,7 @@ } bool URLInfo::isSubPathOf(const tiny_string& parent, const tiny_string& child) { - return child.substr(0, parent.numChars()) == parent; + return child.substr_bytes(0, parent.numBytes()) == parent; } bool URLInfo::isSubDomainOf(const tiny_string& parent, const tiny_string& child) {
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -270,6 +270,7 @@ builtin->registerBuiltin("AccessibilityProperties","flash.accessibility",Class<AccessibilityProperties>::getRef()); builtin->registerBuiltin("AccessibilityImplementation","flash.accessibility",Class<AccessibilityImplementation>::getRef()); + builtin->registerBuiltin("Accessibility","flash.accessibility",Class<ASObject>::getStubClass(QName("Accessibility","flash.accessibility"))); builtin->registerBuiltin("Mutex","flash.concurrent",Class<ASMutex>::getRef()); builtin->registerBuiltin("Condition","flash.concurrent",Class<ASCondition>::getRef()); @@ -363,6 +364,9 @@ 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("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()); builtin->registerBuiltin("XMLDocument","flash.xml",Class<XMLDocument>::getRef()); builtin->registerBuiltin("XMLNode","flash.xml",Class<XMLNode>::getRef()); @@ -425,6 +429,7 @@ 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("ContextMenuEvent","flash.events",Class<ContextMenuEvent>::getRef()); + builtin->registerBuiltin("UncaughtErrorEvent","flash.events",Class<UncaughtErrorEvent>::getRef()); builtin->registerBuiltin("navigateToURL","flash.net",_MR(Class<IFunction>::getFunction(navigateToURL))); builtin->registerBuiltin("sendToURL","flash.net",_MR(Class<IFunction>::getFunction(sendToURL)));
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -384,7 +384,7 @@ !obj->is<IFunction>() && !obj->is<Function_object>() && obj->getClass() && - obj->getClass() != Class_object::getClass()) + (obj->is<Class_inherit>() || (obj->getClass() != Class_object::getClass()))) obj->getClass()->setupDeclaredTraits(obj); } @@ -404,7 +404,7 @@ { LOG(LOG_CALLS, _("getProperty ") << *name << ' ' << obj << ' '<<obj->isInitialized()); checkDeclaredTraits(obj); - + _NR<ASObject> prop=obj->getVariableByMultiname(*name); ASObject *ret; @@ -2269,6 +2269,7 @@ //we silently ignore calling undefined functions if(f->is<Undefined>()) { + LOG(LOG_NOT_IMPLEMENTED,"calling undefined function:"<<obj->toDebugString()); if(keepReturn) th->runtime_stack_push(f); else
View file
lightspark.tar.xz/src/scripting/class.cpp
Changed
@@ -78,7 +78,6 @@ realClass=this; ASObject* ret=NULL; - assert_and_throw(!bindedToRoot); if(tag) { ret=tag->instance(realClass);
View file
lightspark.tar.xz/src/scripting/flash/display/BitmapData.cpp
Changed
@@ -113,8 +113,8 @@ ASFUNCTIONBODY(BitmapData,_constructor) { - uint32_t width; - uint32_t height; + int32_t width; + int32_t height; bool transparent; uint32_t fillColor; BitmapData* th = obj->as<BitmapData>(); @@ -126,6 +126,10 @@ //If the bitmap is already initialized, just return if(width==0 || height==0 || !th->pixels->isEmpty()) return NULL; + if(width<0 || height<0) + throw Class<ArgumentError>::getInstanceS("invalid height or width", kInvalidArgumentError); + if(width>8191 || height>8191) + throw Class<ArgumentError>::getInstanceS("invalid height or width", kInvalidArgumentError); uint32_t *pixelArray=new uint32_t[width*height]; uint32_t c=GUINT32_TO_BE(fillColor); // fromRGB expects big endian data
View file
lightspark.tar.xz/src/scripting/flash/display/DisplayObject.cpp
Changed
@@ -141,7 +141,7 @@ c->setDeclaredMethodByQName("parent","",Class<IFunction>::getFunction(_getParent),GETTER_METHOD,true); c->setDeclaredMethodByQName("root","",Class<IFunction>::getFunction(_getRoot),GETTER_METHOD,true); c->setDeclaredMethodByQName("blendMode","",Class<IFunction>::getFunction(_getBlendMode),GETTER_METHOD,true); - c->setDeclaredMethodByQName("blendMode","",Class<IFunction>::getFunction(undefinedFunction),SETTER_METHOD,true); + c->setDeclaredMethodByQName("blendMode","",Class<IFunction>::getFunction(_setBlendMode),SETTER_METHOD,true); c->setDeclaredMethodByQName("scale9Grid","",Class<IFunction>::getFunction(_getScale9Grid),GETTER_METHOD,true); c->setDeclaredMethodByQName("scale9Grid","",Class<IFunction>::getFunction(undefinedFunction),SETTER_METHOD,true); c->setDeclaredMethodByQName("stage","",Class<IFunction>::getFunction(_getStage),GETTER_METHOD,true); @@ -305,7 +305,7 @@ bool DisplayObject::skipRender() const { - return visible==false || clippedAlpha()==0.0; + return visible==false || clippedAlpha()==0.0 || ClipDepth; } void DisplayObject::defaultRender(RenderContext& ctxt) const @@ -667,8 +667,36 @@ ASFUNCTIONBODY(DisplayObject,_getBlendMode) { - //DisplayObject* th=static_cast<DisplayObject*>(obj); - return getSys()->getUndefinedRef(); + DisplayObject* th=static_cast<DisplayObject*>(obj); + return Class<ASString>::getInstanceS(th->blendMode); +} +ASFUNCTIONBODY(DisplayObject,_setBlendMode) +{ + DisplayObject* th=static_cast<DisplayObject*>(obj); + tiny_string val; + ARG_UNPACK(val); + + if ( + val != "add" && + val != "alpha" && + val != "darken" && + val != "difference" && + val != "erase" && + val != "hardlight" && + val != "invert" && + val != "invert" && + val != "layer" && + val != "lighten" && + val != "multiply" && + val != "normal" && + val != "overlay" && + val != "screen" && + val != "subtract" + ) + val = "normal"; + LOG(LOG_NOT_IMPLEMENTED, "blendmode is set but is not respected during drawing:"<<val); + th->blendMode = val; + return NULL; } ASFUNCTIONBODY(DisplayObject,localToGlobal)
View file
lightspark.tar.xz/src/scripting/flash/display/DisplayObject.h
Changed
@@ -58,6 +58,7 @@ number_t rotation; number_t sx,sy; float alpha; + tiny_string blendMode; public: UI16_SWF Ratio; UI16_SWF ClipDepth; @@ -206,6 +207,7 @@ ASFUNCTION(_getParent); ASFUNCTION(_getRoot); ASFUNCTION(_getBlendMode); + ASFUNCTION(_setBlendMode); ASFUNCTION(_getScale9Grid); ASFUNCTION(_setRotation); ASFUNCTION(_getMouseX); @@ -217,5 +219,5 @@ ASFUNCTION(hitTestObject); ASFUNCTION(hitTestPoint); }; -}; +} #endif /* SCRIPTING_FLASH_DISPLAY_DISPLAYOBJECT_H */
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),loadStatus(STARTED),actionScriptVersion(3),childAllowsParent(true) + loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),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),loadStatus(STARTED),actionScriptVersion(3),childAllowsParent(true) + loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),childAllowsParent(true) { } @@ -74,6 +74,7 @@ c->setDeclaredMethodByQName("url","",Class<IFunction>::getFunction(_getURL),GETTER_METHOD,true); c->setDeclaredMethodByQName("bytesLoaded","",Class<IFunction>::getFunction(_getBytesLoaded),GETTER_METHOD,true); c->setDeclaredMethodByQName("bytesTotal","",Class<IFunction>::getFunction(_getBytesTotal),GETTER_METHOD,true); + c->setDeclaredMethodByQName("bytes","",Class<IFunction>::getFunction(_getBytes),GETTER_METHOD,true); c->setDeclaredMethodByQName("applicationDomain","",Class<IFunction>::getFunction(_getApplicationDomain),GETTER_METHOD,true); c->setDeclaredMethodByQName("sharedEvents","",Class<IFunction>::getFunction(_getSharedEvents),GETTER_METHOD,true); c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(_getWidth),GETTER_METHOD,true); @@ -101,6 +102,7 @@ applicationDomain.reset(); securityDomain.reset(); waitedObject.reset(); + bytesData.reset(); } void LoaderInfo::resetState() @@ -108,6 +110,8 @@ SpinlockLocker l(spinlock); bytesLoaded=0; bytesTotal=0; + if(!bytesData.isNull()) + bytesData->setLength(0); loadStatus=STARTED; } @@ -160,6 +164,9 @@ 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(); } @@ -243,6 +250,12 @@ return abstract_i(th->bytesTotal); } +ASFUNCTIONBODY(LoaderInfo,_getBytes) +{ + LoaderInfo* th=static_cast<LoaderInfo*>(obj); + return th->bytesData.getPtr(); +} + ASFUNCTIONBODY(LoaderInfo,_getApplicationDomain) { LoaderInfo* th=static_cast<LoaderInfo*>(obj); @@ -2068,6 +2081,7 @@ REGISTER_GETTER_SETTER(c,fullScreenSourceRect); REGISTER_GETTER_SETTER(c,showDefaultContextMenu); REGISTER_GETTER_SETTER(c,quality); + REGISTER_GETTER_SETTER(c,stageFocusRect); } ASFUNCTIONBODY_GETTER_SETTER_CB(Stage,align,onAlign); @@ -2076,6 +2090,7 @@ ASFUNCTIONBODY_GETTER_SETTER(Stage,showDefaultContextMenu); // stub ASFUNCTIONBODY_GETTER_SETTER_CB(Stage,fullScreenSourceRect,onFullScreenSourceRect); ASFUNCTIONBODY_GETTER_SETTER(Stage,quality); +ASFUNCTIONBODY_GETTER_SETTER(Stage,stageFocusRect); // stub void Stage::onDisplayState(const tiny_string&) { @@ -2793,7 +2808,7 @@ c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),DECLARED_TRAIT); c->setVariableByQName("OVERLAY","",Class<ASString>::getInstanceS("overlay"),DECLARED_TRAIT); c->setVariableByQName("SCREEN","",Class<ASString>::getInstanceS("screen"),DECLARED_TRAIT); - c->setVariableByQName("SUBSTRACT","",Class<ASString>::getInstanceS("substract"),DECLARED_TRAIT); + c->setVariableByQName("SUBTRACT","",Class<ASString>::getInstanceS("subtract"),DECLARED_TRAIT); } void SpreadMethod::sinit(Class_base* c)
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.h
Changed
@@ -228,6 +228,7 @@ tiny_string loaderURL; _NR<EventDispatcher> sharedEvents; _NR<Loader> loader; + _NR<ByteArray> bytesData; /* * waitedObject is the object we are supposed to wait, * it's necessary when multiple loads are invoked on @@ -257,6 +258,7 @@ ASFUNCTION(_getURL); ASFUNCTION(_getBytesLoaded); ASFUNCTION(_getBytesTotal); + ASFUNCTION(_getBytes); ASFUNCTION(_getApplicationDomain); ASFUNCTION(_getLoader); ASFUNCTION(_getContent); @@ -548,6 +550,7 @@ ASPROPERTY_GETTER_SETTER(_NR<Rectangle>,fullScreenSourceRect); ASPROPERTY_GETTER_SETTER(bool,showDefaultContextMenu); ASPROPERTY_GETTER_SETTER(tiny_string,quality); + ASPROPERTY_GETTER_SETTER(bool,stageFocusRect); }; class StageScaleMode: public ASObject
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.cpp
Changed
@@ -550,11 +550,6 @@ Locker l(th->handlersMutex); //Search if any listener is already registered for the event list<listener>& listeners=th->handlers[eventName]; - if(find(listeners.begin(),listeners.end(),make_pair(f,useCapture))!=listeners.end()) - { - LOG(LOG_CALLS,_("Weird event reregistration")); - return NULL; - } f->incRef(); const listener newListener(_MR(f), priority, useCapture); //Ordered insertion @@ -1008,6 +1003,24 @@ return NULL; } + +UncaughtErrorEvent::UncaughtErrorEvent(Class_base* c):ErrorEvent(c, "uncaughtError") +{ +} + +void UncaughtErrorEvent::sinit(Class_base* c) +{ + CLASS_SETUP(c, ErrorEvent, _constructor, CLASS_SEALED); + c->setVariableByQName("UNCAUGHT_ERROR","",Class<ASString>::getInstanceS("uncaughtError"),DECLARED_TRAIT); +} + +ASFUNCTIONBODY(UncaughtErrorEvent,_constructor) +{ + uint32_t baseClassArgs=imin(argslen,4); + ErrorEvent::_constructor(obj,args,baseClassArgs); + return NULL; +} + ABCContextInitEvent::ABCContextInitEvent(ABCContext* c, bool l):Event(NULL, "ABCContextInitEvent"),context(c),lazy(l) { }
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.h
Changed
@@ -222,6 +222,18 @@ ASFUNCTION(_constructor); }; +class UncaughtErrorEvent: public ErrorEvent +{ +public: + UncaughtErrorEvent(Class_base* c); + static void sinit(Class_base*); + static void buildTraits(ASObject* o) + { + } + ASFUNCTION(_constructor); +}; + + class ProgressEvent: public Event { private:
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.cpp
Changed
@@ -288,7 +288,7 @@ ASFUNCTIONBODY(URLRequest,_getDigest) { URLRequest* th=obj->as<URLRequest>(); - if (th->digest.numChars() == 0) + if (th->digest.empty()) return getSys()->getNullRef(); else return Class<ASString>::getInstanceS(th->digest);
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.cpp
Changed
@@ -108,8 +108,56 @@ ASFUNCTIONBODY(Capabilities,_getServerString) { - LOG(LOG_NOT_IMPLEMENTED, "Capabilities.serverString is not implemented"); - return Class<ASString>::getInstanceS(""); + LOG(LOG_NOT_IMPLEMENTED,"Capabilities: not all capabilities are reported in ServerString"); + tiny_string res = "A=t&SA=t&SV=t&MP3=t&OS=Linux&PT=PlugIn&L=en&TLS=t"; + res +="&V="; + res += EMULATED_VERSION; + res +="&M="; + res += MANUFACTURER; + + GdkScreen* screen = gdk_screen_get_default(); + gint width = gdk_screen_get_width (screen); + gint height = gdk_screen_get_height (screen); + char buf[40]; + snprintf(buf,40,"&R=%ix%i",width,height); + res += buf; + + /* + avHardwareDisable AVD + hasAccessibility ACC + hasAudio A + hasAudioEncoder AE + hasEmbeddedVideo EV + hasIME IME + hasMP3 MP3 + hasPrinting PR + hasScreenBroadcast SB + hasScreenPlayback SP + hasStreamingAudio SA + hasStreamingVideo SV + hasTLS TLS + hasVideoEncoder VE + isDebugger DEB + language L + localFileReadDisable LFD + manufacturer M + maxLevelIDC ML + os OS + pixelAspectRatio AR + playerType PT + screenColor COL + screenDPI DP + screenResolutionX R + screenResolutionY R + version V + supports Dolby Digital audio DD + supports Dolby Digital Plus audio DDP + supports DTS audio DTS + supports DTS Express audio DTE + supports DTS-HD High Resolution Audio DTH + supports DTS-HD Master Audio DTM + */ + return Class<ASString>::getInstanceS(res); } ASFUNCTIONBODY(Capabilities,_getScreenResolutionX) { @@ -520,5 +568,5 @@ ASFUNCTIONBODY(System,totalMemory) { LOG(LOG_NOT_IMPLEMENTED, "System.totalMemory not implemented"); - return abstract_d(0); + return abstract_d(1024); }
View file
lightspark.tar.xz/src/scripting/flash/text/flashtextengine.cpp
Changed
@@ -62,14 +62,47 @@ c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),CONSTANT_TRAIT); } + +void TextJustifier::sinit(Class_base* c) +{ + CLASS_SETUP(c, ASObject, _constructor, 0); +} +ASFUNCTIONBODY(TextJustifier, _constructor) +{ + throwError<ArgumentError>(kCantInstantiateError, "TextJustifier cannot be instantiated"); + return NULL; +} +void SpaceJustifier::sinit(Class_base* c) +{ + CLASS_SETUP(c, TextJustifier, _constructor, CLASS_FINAL); +} +ASFUNCTIONBODY(SpaceJustifier, _constructor) +{ + SpaceJustifier* th=static_cast<SpaceJustifier*>(obj); + LOG(LOG_NOT_IMPLEMENTED, "SpaceJustifier is a stub"); + return NULL; +} +void EastAsianJustifier::sinit(Class_base* c) +{ + CLASS_SETUP(c, TextJustifier, _constructor, CLASS_FINAL); +} +ASFUNCTIONBODY(EastAsianJustifier, _constructor) +{ + EastAsianJustifier* th=static_cast<EastAsianJustifier*>(obj); + LOG(LOG_NOT_IMPLEMENTED, "EastAsianJustifier is a stub"); + return NULL; +} + void TextBlock::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); c->setDeclaredMethodByQName("createTextLine","",Class<IFunction>::getFunction(createTextLine),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c, content); + REGISTER_GETTER_SETTER(c, textJustifier); } -ASFUNCTIONBODY_GETTER_SETTER(TextBlock, content); +ASFUNCTIONBODY_GETTER_SETTER(TextBlock, content) +ASFUNCTIONBODY_GETTER_SETTER(TextBlock, textJustifier) ASFUNCTIONBODY(TextBlock, _constructor) {
View file
lightspark.tar.xz/src/scripting/flash/text/flashtextengine.h
Changed
@@ -59,6 +59,30 @@ static void sinit(Class_base* c); }; +class TextJustifier: public ASObject +{ +public: + TextJustifier(Class_base* c): ASObject(c) {}; + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; + +class SpaceJustifier: public TextJustifier +{ +public: + SpaceJustifier(Class_base* c): TextJustifier(c) {}; + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; + +class EastAsianJustifier: public TextJustifier +{ +public: + EastAsianJustifier(Class_base* c): TextJustifier(c) {}; + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; + class TextBlock: public ASObject { public: @@ -67,6 +91,7 @@ ASFUNCTION(_constructor); ASFUNCTION(createTextLine); ASPROPERTY_GETTER_SETTER(_NR<ContentElement>, content); + ASPROPERTY_GETTER_SETTER(_NR<TextJustifier>, textJustifier); }; class TextElement: public ContentElement @@ -95,6 +120,7 @@ ASFUNCTION(_constructor); ASPROPERTY_GETTER(_NR<TextBlock>, textBlock); }; -}; + +} #endif
View file
lightspark.tar.xz/src/scripting/flash/utils/ByteArray.h
Changed
@@ -32,6 +32,7 @@ friend class LoaderThread; friend class URLLoader; friend class ApplicationDomain; +friend class LoaderInfo; protected: bool littleEndian; uint8_t objectEncoding;
View file
lightspark.tar.xz/src/scripting/flash/utils/Dictionary.cpp
Changed
@@ -83,6 +83,30 @@ assert_and_throw(implEnable); if(name.name_type==multiname::NAME_OBJECT) { + multiname tmpname(NULL); + tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + switch (name.name_o->getObjectType()) + { + case T_BOOLEAN: + case T_UINTEGER: + case T_INTEGER: + tmpname.name_type=multiname::NAME_INT; + tmpname.name_i = name.name_o->toInt(); + ASObject::setVariableByMultiname(tmpname, o, allowConst); + return; + case T_NUMBER: + tmpname.name_type=multiname::NAME_NUMBER; + tmpname.name_d = name.name_o->toNumber(); + ASObject::setVariableByMultiname(tmpname, o, allowConst); + return; + case T_STRING: + tmpname.name_type=multiname::NAME_STRING; + tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + ASObject::setVariableByMultiname(tmpname, o, allowConst); + return; + default: + break; + } name.name_o->incRef(); _R<ASObject> name_o(name.name_o); @@ -109,6 +133,27 @@ if(name.name_type==multiname::NAME_OBJECT) { + multiname tmpname(NULL); + tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + switch (name.name_o->getObjectType()) + { + case T_BOOLEAN: + case T_UINTEGER: + case T_INTEGER: + tmpname.name_type=multiname::NAME_INT; + tmpname.name_i = name.name_o->toInt(); + return ASObject::deleteVariableByMultiname(tmpname); + case T_NUMBER: + tmpname.name_type=multiname::NAME_NUMBER; + tmpname.name_d = name.name_o->toNumber(); + return ASObject::deleteVariableByMultiname(tmpname); + case T_STRING: + tmpname.name_type=multiname::NAME_STRING; + tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + return ASObject::deleteVariableByMultiname(tmpname); + default: + break; + } name.name_o->incRef(); _R<ASObject> name_o(name.name_o); @@ -137,6 +182,27 @@ { if(name.name_type==multiname::NAME_OBJECT) { + multiname tmpname(NULL); + tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + switch (name.name_o->getObjectType()) + { + case T_BOOLEAN: + case T_UINTEGER: + case T_INTEGER: + tmpname.name_type=multiname::NAME_INT; + tmpname.name_i = name.name_o->toInt(); + return ASObject::getVariableByMultiname(tmpname, opt); + case T_NUMBER: + tmpname.name_type=multiname::NAME_NUMBER; + tmpname.name_d = name.name_o->toNumber(); + return ASObject::getVariableByMultiname(tmpname, opt); + case T_STRING: + tmpname.name_type=multiname::NAME_STRING; + tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + return ASObject::getVariableByMultiname(tmpname, opt); + default: + break; + } name.name_o->incRef(); _R<ASObject> name_o(name.name_o); @@ -167,6 +233,28 @@ if(name.name_type==multiname::NAME_OBJECT) { + multiname tmpname(NULL); + tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + switch (name.name_o->getObjectType()) + { + case T_BOOLEAN: + case T_UINTEGER: + case T_INTEGER: + tmpname.name_type=multiname::NAME_INT; + tmpname.name_i = name.name_o->toInt(); + return ASObject::hasPropertyByMultiname(tmpname, considerDynamic, considerPrototype); + case T_NUMBER: + tmpname.name_type=multiname::NAME_NUMBER; + tmpname.name_d = name.name_o->toNumber(); + return ASObject::hasPropertyByMultiname(tmpname, considerDynamic, considerPrototype); + case T_STRING: + tmpname.name_type=multiname::NAME_STRING; + tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + return ASObject::hasPropertyByMultiname(tmpname, considerDynamic, considerPrototype); + default: + break; + } + name.name_o->incRef(); _R<ASObject> name_o(name.name_o);
View file
lightspark.tar.xz/src/scripting/toplevel/Array.h
Changed
@@ -60,7 +60,6 @@ void outofbounds() const; ~Array(); private: - enum SORTTYPE { CASEINSENSITIVE=1, DESCENDING=2, UNIQUESORT=4, RETURNINDEXEDARRAY=8, NUMERIC=16 }; class sortComparatorDefault { private: @@ -92,6 +91,7 @@ int capIndex(int i) const; static bool isIntegerWithoutLeadingZeros(const tiny_string& value); public: + enum SORTTYPE { CASEINSENSITIVE=1, DESCENDING=2, UNIQUESORT=4, RETURNINDEXEDARRAY=8, NUMERIC=16 }; Array(Class_base* c); void finalize(); //These utility methods are also used by ByteArray
View file
lightspark.tar.xz/src/scripting/toplevel/Integer.cpp
Changed
@@ -198,6 +198,11 @@ 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->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); + c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(_toPrecision,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(_valueOf),NORMAL_METHOD,true); c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(Integer::_toExponential, 1),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(Integer::_toFixed, 1),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(Integer::_toPrecision, 1),DYNAMIC_TRAIT);
View file
lightspark.tar.xz/src/scripting/toplevel/Number.cpp
Changed
@@ -272,6 +272,10 @@ c->setVariableByQName("MIN_VALUE","",pmin,CONSTANT_TRAIT); c->setVariableByQName("NaN","",pnan,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); + c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(toPrecision,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(_valueOf),NORMAL_METHOD,true); c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(Number::_toString),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(Number::_toString),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(Number::toFixed, 1),DYNAMIC_TRAIT);
View file
lightspark.tar.xz/src/scripting/toplevel/UInteger.cpp
Changed
@@ -119,6 +119,11 @@ CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); c->setVariableByQName("MAX_VALUE","",abstract_ui(0xFFFFFFFF),CONSTANT_TRAIT); c->setVariableByQName("MIN_VALUE","",abstract_ui(0),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); + c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(_toPrecision,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(_valueOf),NORMAL_METHOD,true); c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(_toExponential, 1),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(_toFixed, 1),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(_toPrecision, 1),DYNAMIC_TRAIT);
View file
lightspark.tar.xz/src/scripting/toplevel/Vector.cpp
Changed
@@ -732,6 +732,45 @@ } return abstract_i(ret); } +bool Vector::sortComparatorDefault::operator()(ASObject* d1, ASObject* d2) +{ + if(isNumeric) + { + number_t a=d1->toNumber(); + + number_t b=d2->toNumber(); + + if(std::isnan(a) || std::isnan(b)) + throw RunTimeException("Cannot sort non number with Array.NUMERIC option"); + if(isDescending) + return b>a; + else + return a<b; + } + else + { + //Comparison is always in lexicographic order + tiny_string s1 = d1->toString(); + tiny_string s2 = d2->toString(); + + if(isDescending) + { + //TODO: unicode support + if(isCaseInsensitive) + return s1.strcasecmp(s2)>0; + else + return s1>s2; + } + else + { + //TODO: unicode support + if(isCaseInsensitive) + return s1.strcasecmp(s2)<0; + else + return s1<s2; + } + } +} bool Vector::sortComparatorWrapper::operator()(ASObject* d1, ASObject* d2) { ASObject* objs[2]; @@ -762,10 +801,44 @@ throwError<ArgumentError>(kWrongArgumentCountError, "Vector.sort", "1", Integer::toString(argslen)); Vector* th=static_cast<Vector*>(obj); - IFunction* comp=static_cast<IFunction*>(args[0]); + IFunction* comp=NULL; + bool isNumeric=false; + bool isCaseInsensitive=false; + bool isDescending=false; + if(args[0]->getObjectType()==T_FUNCTION) //Comparison func + { + assert_and_throw(comp==NULL); + comp=static_cast<IFunction*>(args[0]); + } + else + { + uint32_t options=args[0]->toInt(); + if(options&Array::NUMERIC) + isNumeric=true; + if(options&Array::CASEINSENSITIVE) + isCaseInsensitive=true; + if(options&Array::DESCENDING) + isDescending=true; + if(options&(~(Array::NUMERIC|Array::CASEINSENSITIVE|Array::DESCENDING))) + throw UnsupportedException("Vector::sort not completely implemented"); + } + std::vector<ASObject*> tmp = vector<ASObject*>(th->vec.size()); + int i = 0; + for(auto it=th->vec.begin();it != th->vec.end();++it) + { + tmp[i++]= *it; + } + if(comp) + sort(tmp.begin(),tmp.end(),sortComparatorWrapper(comp,th->vec_type)); + else + sort(tmp.begin(),tmp.end(),sortComparatorDefault(isNumeric,isCaseInsensitive,isDescending)); - sort(th->vec.begin(),th->vec.end(),sortComparatorWrapper(comp,th->vec_type)); + th->vec.clear(); + for(auto ittmp=tmp.begin();ittmp != tmp.end();++ittmp) + { + th->vec.push_back(*ittmp); + } obj->incRef(); return obj; }
View file
lightspark.tar.xz/src/scripting/toplevel/Vector.h
Changed
@@ -32,6 +32,16 @@ bool fixed; std::vector<ASObject*, reporter_allocator<ASObject*>> vec; int capIndex(int i) const; + class sortComparatorDefault + { + private: + bool isNumeric; + bool isCaseInsensitive; + bool isDescending; + public: + sortComparatorDefault(bool n, bool ci, bool d):isNumeric(n),isCaseInsensitive(ci),isDescending(d){} + bool operator()(ASObject* d1, ASObject* d2); + }; class sortComparatorWrapper { private:
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -1350,7 +1350,7 @@ assert_and_throw(collon != tmp.raw_buf() && *(collon-1) == ':'); uint32_t collon_offset = collon-tmp.raw_buf(); ns = tmp.substr_bytes(0,collon_offset-1); - name = tmp.substr_bytes(collon_offset+1,tmp.numChars()-collon_offset-1); + name = tmp.substr_bytes(collon_offset+1,tmp.numBytes()-collon_offset-1); return; } // No namespace, look for a package name @@ -1359,7 +1359,7 @@ { uint32_t dot_offset = dot-tmp.raw_buf(); ns = tmp.substr_bytes(0,dot_offset); - name = tmp.substr_bytes(dot_offset+1,tmp.numChars()-dot_offset-1); + name = tmp.substr_bytes(dot_offset+1,tmp.numBytes()-dot_offset-1); return; } //No namespace or package in the string
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
.