You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/09/14 21:31:19 UTC
[29/30] git commit: [flex-asjs] [refs/heads/spark] - more changes to
try to get helloworld to work
more changes to try to get helloworld to work
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4d892a9a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4d892a9a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4d892a9a
Branch: refs/heads/spark
Commit: 4d892a9a717f0478f0ce476411ae7590d454ecae
Parents: b15d2c0
Author: Alex Harui <ah...@apache.org>
Authored: Wed Sep 14 14:29:48 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Sep 14 14:29:48 2016 -0700
----------------------------------------------------------------------
.../MX/src/main/flex/flex/display/Sprite.as | 12 ++++-
.../main/flex/flex/events/IEventDispatcher.as | 2 -
.../flex/mx/binding/FunctionReturnWatcher.as | 6 +--
.../flex/mx/binding/StaticPropertyWatcher.as | 2 +-
.../MX/src/main/flex/mx/core/Application.as | 5 ++
.../src/main/flex/mx/managers/SystemManager.as | 10 +++-
.../src/main/flex/mx/styles/StyleManagerImpl.as | 56 ++++++++++++++++++--
7 files changed, 79 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d892a9a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as b/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as
index a83a292..7ba75dc 100644
--- a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as
+++ b/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as
@@ -23,8 +23,16 @@ package flex.display
import org.apache.flex.geom.Point;
import org.apache.flex.utils.PointUtils;
import mx.managers.SystemManagerGlobals;
-
- public class Sprite extends CompoundGraphic implements DisplayObjectContainer
+ COMPILE::SWF
+ {
+ import flash.events.IEventDispatcher;
+ }
+ COMPILE::JS
+ {
+ import flex.events.IEventDispatcher;
+ }
+
+ public class Sprite extends CompoundGraphic implements DisplayObjectContainer, IEventDispatcher
{
COMPILE::JS
private var _name:String;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d892a9a/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as b/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as
index c65a9aa..5bc1612 100644
--- a/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as
+++ b/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as
@@ -4,7 +4,5 @@ package flex.events
public interface IEventDispatcher extends org.apache.flex.events.IEventDispatcher
{
- function get bindingEventDispatcher():org.apache.flex.events.IEventDispatcher;
- function get effectEventDispatcher():org.apache.flex.events.IEventDispatcher;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d892a9a/frameworks/projects/MX/src/main/flex/mx/binding/FunctionReturnWatcher.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/binding/FunctionReturnWatcher.as b/frameworks/projects/MX/src/main/flex/mx/binding/FunctionReturnWatcher.as
index 2d44259..c534b44 100644
--- a/frameworks/projects/MX/src/main/flex/mx/binding/FunctionReturnWatcher.as
+++ b/frameworks/projects/MX/src/main/flex/mx/binding/FunctionReturnWatcher.as
@@ -250,7 +250,7 @@ public class FunctionReturnWatcher extends Watcher
{
if (eventName != "__NoChangeEvent__")
{
- eventDispatcher.bindingEventDispatcher.addEventListener(eventName, eventHandler,
+ eventDispatcher.addEventListener(eventName, eventHandler,
false);
}
}
@@ -262,8 +262,8 @@ public class FunctionReturnWatcher extends Watcher
// {getStyle("color")}, the eventName will be
// "colorChanged".
eventName = parameterFunction.apply(document) + "Changed";
- eventDispatcher.bindingEventDispatcher.addEventListener(eventName, eventHandler, false);
- eventDispatcher.bindingEventDispatcher.addEventListener("allStylesChanged", eventHandler, false);
+ eventDispatcher.addEventListener(eventName, eventHandler, false);
+ eventDispatcher.addEventListener("allStylesChanged", eventHandler, false);
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d892a9a/frameworks/projects/MX/src/main/flex/mx/binding/StaticPropertyWatcher.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/binding/StaticPropertyWatcher.as b/frameworks/projects/MX/src/main/flex/mx/binding/StaticPropertyWatcher.as
index 9903489..ab1b15a 100644
--- a/frameworks/projects/MX/src/main/flex/mx/binding/StaticPropertyWatcher.as
+++ b/frameworks/projects/MX/src/main/flex/mx/binding/StaticPropertyWatcher.as
@@ -162,7 +162,7 @@ public class StaticPropertyWatcher extends Watcher
{
var eventDispatcher:IEventDispatcher = parentObj["staticEventDispatcher"];
- eventDispatcher.bindingEventDispatcher.addEventListener(eventType, eventHandler, false);
+ eventDispatcher.addEventListener(eventType, eventHandler, false);
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d892a9a/frameworks/projects/MX/src/main/flex/mx/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/Application.as b/frameworks/projects/MX/src/main/flex/mx/core/Application.as
index 04f1055..fc33350 100644
--- a/frameworks/projects/MX/src/main/flex/mx/core/Application.as
+++ b/frameworks/projects/MX/src/main/flex/mx/core/Application.as
@@ -56,12 +56,15 @@ import mx.managers.ISystemManager;
import mx.managers.LayoutManager; // LayoutManager; force-link syntax not supported by FalconJX
// force-link this here. In flex-sdk, it gets injected somehow.
import mx.core.TextFieldFactory; // TextFieldFactory; force-link syntax not supported by FalconJX
+// force-link this here. In flex-sdk, it gets injected in generated code.
+import mx.styles.StyleManagerImpl; // StyleManagerImpl; force-link syntax not supported by FalconJX
import mx.styles.CSSStyleDeclaration;
import mx.styles.IStyleClient;
import mx.utils.LoaderUtil;
import mx.utils.Platform;
import org.apache.flex.core.SimpleCSSValuesImpl;
import org.apache.flex.core.ValuesManager;
+import org.apache.flex.utils.MixinManager;
use namespace mx_internal;
@@ -368,6 +371,7 @@ public class Application extends LayoutContainer
{
var forceLinkLayoutManager:Class = LayoutManager;
var forceLinkTextFieldFactory:Class = TextFieldFactory;
+ var forceLinkStyleManager:Class = StyleManagerImpl;
ValuesManager.valuesImpl = new SimpleCSSValuesImpl();
ValuesManager.valuesImpl.init(this);
@@ -377,6 +381,7 @@ public class Application extends LayoutContainer
SystemManager.setInfo(this["info"]());
var sm:SystemManager = new SystemManager();
sm.document = this;
+ sm.info()["cssData"] = this["cssData"];
systemManager = sm;
new ChildManager(sm);
sm.kickOff();
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d892a9a/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as b/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as
index 73052fb..e6fc5b2 100644
--- a/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as
+++ b/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as
@@ -3136,8 +3136,14 @@ public class SystemManager extends MovieClip
var token:int = perfUtil.markStart();
}
- // trace("initializing mixin " + mixinList[i]);
- var c:Class = getDefinitionByName(mixinList[i]) as Class;
+ COMPILE::LATER
+ {
+ // trace("initializing mixin " + mixinList[i]);
+ var c:Class = getDefinitionByName(mixinList[i]) as Class;
+ }
+ // in FlexJS, mixins are classes, not class names. Class names
+ // are better for two-frame SWFs so this may change later
+ var c:Class = mixinList[i] as Class;
c["init"](this);
CONFIG::performanceInstrumentation
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d892a9a/frameworks/projects/MX/src/main/flex/mx/styles/StyleManagerImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/styles/StyleManagerImpl.as b/frameworks/projects/MX/src/main/flex/mx/styles/StyleManagerImpl.as
index fdb7c41..d3c2148 100644
--- a/frameworks/projects/MX/src/main/flex/mx/styles/StyleManagerImpl.as
+++ b/frameworks/projects/MX/src/main/flex/mx/styles/StyleManagerImpl.as
@@ -36,14 +36,14 @@ COMPILE::LATER
import flash.events.TimerEvent;
import flash.utils.Timer;
}
-import org.apache.flex.events.Event;
-import org.apache.flex.events.EventDispatcher;
-import org.apache.flex.events.IEventDispatcher;
-
import mx.core.FlexVersion;
import mx.core.IFlexModuleFactory;
import mx.core.mx_internal;
import mx.events.FlexChangeEvent;
+
+import org.apache.flex.events.Event;
+import org.apache.flex.events.EventDispatcher;
+import org.apache.flex.events.IEventDispatcher;
COMPILE::LATER
{
import mx.events.ModuleEvent;
@@ -118,6 +118,54 @@ public class StyleManagerImpl extends EventDispatcher implements IStyleManager2
generateCSSStyleDeclarations(sm, styleDataClass["factoryFunctions"], styleDataClass["data"]);
sm.initProtoChainRoots();
}
+ COMPILE::JS
+ {
+ if (!sm)
+ sm = new StyleManagerImpl(fbs);
+
+ var cssData:Array = fbs.info()["cssData"];
+ if (cssData) {
+ var n:int = cssData.length;
+ var i:int = 0;
+ while (i < n)
+ {
+ var numMQ:int = cssData[i++];
+ if (numMQ > 0)
+ {
+ // skip MediaQuery tests for now
+ i += numMQ;
+ }
+ var numSel:int = cssData[i++];
+ var props:Object = {};
+ var decls:Array = [];
+ for (var j:int = 0; j < numSel; j++)
+ {
+ var selName:String = cssData[i++];
+ decls.push(new CSSStyleDeclaration(selName));
+ }
+ var numProps:int = cssData[i++];
+ for (j = 0; j < numProps; j++)
+ {
+ var propName:String = cssData[i++];
+ var propValue:Object = cssData[i++];
+ props[propName] = propValue;
+ }
+ for each (var decl:CSSStyleDeclaration in decls)
+ {
+ var factoryFunction:String = "(function factoryFunction() {";
+ for (var p:String in props)
+ {
+ factoryFunction += "this." + p + " = " + props[p] + ";";
+ }
+ factoryFunction += "})";
+ var f:Function = eval(factoryFunction);
+ decl.defaultFactory = f;
+ }
+ }
+ }
+
+ sm.initProtoChainRoots();
+ }
}
public static function generateCSSStyleDeclarations(styleManager:StyleManagerImpl, factoryFunctions:Object, data:Array, newSelectors:Array = null, overrideMap:Object = null):void