enough changes that something showed up in JS

Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/24dc2663
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/24dc2663
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/24dc2663

Branch: refs/heads/spark
Commit: 24dc2663cba4aa60c1f559fcf3f770c84783cb1a
Parents: a936d77
Author: Alex Harui <aha...@apache.org>
Authored: Wed Sep 21 15:23:00 2016 -0700
Committer: Alex Harui <aha...@apache.org>
Committed: Wed Sep 21 15:23:00 2016 -0700

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/core/UIBase.as    |  7 +++-
 .../main/flex/org/apache/flex/utils/Language.as |  2 +
 .../MX/src/main/flex/flex/display/Sprite.as     | 14 +++++--
 .../MX/src/main/flex/flex/events/Event.as       |  1 +
 .../MX/src/main/flex/flex/text/TextField.as     |  4 +-
 .../MX/src/main/flex/mx/controls/Label.as       |  3 ++
 .../MX/src/main/flex/mx/core/Application.as     |  5 ++-
 .../MX/src/main/flex/mx/core/Container.as       |  2 +-
 .../MX/src/main/flex/mx/core/UIComponent.as     | 11 ++++++
 .../src/main/flex/mx/managers/SystemManager.as  | 41 ++++++++++++++++++--
 .../src/main/flex/mx/styles/StyleProtoChain.as  |  3 ++
 .../MX/src/test/flex/src/TestCompile.mxml       |  1 +
 12 files changed, 81 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as 
b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
index dcbac3a..8ff5bc2 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
@@ -1201,6 +1201,7 @@ package org.apache.flex.core
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
                 *  @flexjsignorecoercion org.apache.flex.core.IUIBase
+                *  @flexjsignorecoercion String
          */
         public function getElementIndex(c:IVisualElement):int
         {
@@ -1213,13 +1214,17 @@ package org.apache.flex.core
             }
             COMPILE::JS
             {
+                var index:int = -1;
                 var children:Array = internalChildren();
                 var n:int = children.length;
                                var ui:IUIBase = c as IUIBase;
                 for (var i:int = 0; i < n; i++)
                 {
+                    var nodeName:String = children[i]["nodeName"] as String;
+                    if (children[i]["nodeType"] == 1 && nodeName.toUpperCase() 
!= "SCRIPT")
+                        index++;
                     if (children[i] == ui.element)
-                        return i;
+                        return index;
                 }
                 return -1;                
             }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as 
b/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
index 9ddc0d7..63e0425 100644
--- 
a/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
+++ 
b/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
@@ -72,6 +72,8 @@ package org.apache.flex.utils
 
                        coercion = (coercion !== undefined) ? coercion : false;
 
+            if (coercion && leftOperand == null) return null;
+            
                        itIs = Language.is(leftOperand, rightOperand);
 
                        if (!itIs && coercion)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/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 64815a3..b68a871 100644
--- a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as
+++ b/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as
@@ -19,6 +19,7 @@
 
 package flex.display
 {      
+    import org.apache.flex.core.UIBase;
        import org.apache.flex.svg.CompoundGraphic;
        import org.apache.flex.geom.Point;
        import org.apache.flex.utils.PointUtils;
@@ -32,7 +33,7 @@ package flex.display
         import flex.events.IEventDispatcher;
     }
     
-       public class Sprite extends CompoundGraphic implements 
DisplayObjectContainer, IEventDispatcher
+       public class Sprite extends UIBase implements DisplayObjectContainer, 
IEventDispatcher
        {
                COMPILE::JS
                private var _name:String;
@@ -153,6 +154,9 @@ package flex.display
                COMPILE::JS
                private var _graphics:Graphics;
                
+        COMPILE::JS
+        private var _graphicsHost:CompoundGraphic;
+        
                COMPILE::JS
                /**
                 *  @flexjsignorecoercion flex.display.DisplayObject
@@ -160,8 +164,12 @@ package flex.display
                public function get graphics():Graphics
                {
                        if (!_graphics)
-                               _graphics = new Graphics(this);
-                       return _graphics
+            {
+                _graphicsHost = new CompoundGraphic();
+                super.addElement(_graphicsHost);
+                               _graphics = new Graphics(_graphicsHost);
+            }
+                       return _graphics;
                }
 
                COMPILE::JS

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/MX/src/main/flex/flex/events/Event.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/flex/events/Event.as 
b/frameworks/projects/MX/src/main/flex/flex/events/Event.as
index fa60732..72237a2 100644
--- a/frameworks/projects/MX/src/main/flex/flex/events/Event.as
+++ b/frameworks/projects/MX/src/main/flex/flex/events/Event.as
@@ -18,6 +18,7 @@ package flex.events
                public static const ENTER_FRAME:String = "enterFrame";
                public static const REMOVED:String = "removed";
                public static const REMOVED_FROM_STAGE:String = 
"removedFromStage";
+        public static const RENDER:String = "render";
                public static const RESIZE:String = "resize";
        }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/MX/src/main/flex/flex/text/TextField.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/flex/text/TextField.as 
b/frameworks/projects/MX/src/main/flex/flex/text/TextField.as
index 3e97256..2036aff 100644
--- a/frameworks/projects/MX/src/main/flex/flex/text/TextField.as
+++ b/frameworks/projects/MX/src/main/flex/flex/text/TextField.as
@@ -539,8 +539,8 @@ public class TextField extends Label
        
        public function getLineMetrics(index:int):TextLineMetrics
        {
-               trace("TextField.getLineMetrics not implemented");
-               return null;
+               
+               return new TextLineMetrics(0, element.offsetWidth, 
element.offsetHeight, 0, 0, 0);
        }
        
        public function getLineOffset(index:int):int

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/MX/src/main/flex/mx/controls/Label.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/controls/Label.as 
b/frameworks/projects/MX/src/main/flex/mx/controls/Label.as
index f8b46f6..3b3f3e4 100644
--- a/frameworks/projects/MX/src/main/flex/mx/controls/Label.as
+++ b/frameworks/projects/MX/src/main/flex/mx/controls/Label.as
@@ -1502,10 +1502,13 @@ public class Label extends UIComponent
                 truncated = textField.truncateToFit();
             }
 
+            COMPILE::LATER
+            {    
             // If no explicit tooltip has been set,
             // implicitly set or clear a "truncation tip".
             if (!toolTipSet)
                 super.toolTip = truncated ? text : null;
+            }
         }
         
     }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/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 04fd0a6..de72b11 100644
--- a/frameworks/projects/MX/src/main/flex/mx/core/Application.as
+++ b/frameworks/projects/MX/src/main/flex/mx/core/Application.as
@@ -354,7 +354,6 @@ public class Application extends LayoutContainer
      */
     public function Application()
     {
-        start();
     }
     
     /**
@@ -375,14 +374,16 @@ public class Application extends LayoutContainer
         
         COMPILE::JS
         {
-            UIComponentGlobals.layoutManager = LayoutManager.getInstance();
             // this is a hack until we get falconjx to put the info on the 
factory
             SystemManager.setInfo(this["info"]());
             var sm:SystemManager = new SystemManager();
             sm.document = this;
             sm.info()["cssData"] = this["cssData"];
             systemManager = sm;
+            UIComponentGlobals.layoutManager = LayoutManager.getInstance();
             new ChildManager(sm);
+            sm.width = width;
+            sm.height = height;
             sm.kickOff();
         }
                 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/MX/src/main/flex/mx/core/Container.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/Container.as 
b/frameworks/projects/MX/src/main/flex/mx/core/Container.as
index ed2c0b5..ec23148 100644
--- a/frameworks/projects/MX/src/main/flex/mx/core/Container.as
+++ b/frameworks/projects/MX/src/main/flex/mx/core/Container.as
@@ -3143,7 +3143,7 @@ public class Container extends UIComponent
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    override public function removeAllElements():void
+    public function removeAllElements():void
     {
         for (var i:int = numElements - 1; i >= 0; i--)
         {

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as 
b/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as
index ea50d16..e93a5b6 100644
--- a/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as
+++ b/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as
@@ -1784,6 +1784,13 @@ public class UIComponent extends Sprite
         _width = super.width;
         _height = super.height;
         
+        COMPILE::JS
+        {
+            // UIComponent is born invisible and won't be layed out by
+            // FlexJS layout so needs a default display style
+            setDisplayStyleForLayout("block");        
+        }
+        
     }
 
     
//--------------------------------------------------------------------------
@@ -13704,6 +13711,8 @@ public class UIComponent extends Sprite
         if (!hasFontContextBeenSaved)
             return false;
 
+        COMPILE::LATER
+        {
         // Check if the module factory has changed.
         var fontName:String =
             StringUtil.trimArrayElements(getStyle("fontFamily"), ",");
@@ -13716,6 +13725,8 @@ public class UIComponent extends Sprite
                 fontName, bold, italic, this, moduleFactory,
                 systemManager);
         return fontContext != oldEmbeddedFontContext;
+        }
+        return false;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/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 e682777..9f09d53 100644
--- a/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as
+++ b/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as
@@ -63,16 +63,17 @@ COMPILE::JS
        import org.apache.flex.events.MouseEvent;
        import org.apache.flex.geom.Point;
 }
-import org.apache.flex.utils.Timer;
-import flex.system.DefinitionManager;
-import org.apache.flex.reflection.getQualifiedClassName;
-
 import mx.core.IChildList;
 import mx.core.IFlexDisplayObject;
 import mx.core.IFlexModuleFactory;
 import mx.core.IInvalidating;
 import mx.core.IRawChildrenContainer;
 import mx.core.IUIComponent;
+
+import flex.system.DefinitionManager;
+
+import org.apache.flex.reflection.getQualifiedClassName;
+import org.apache.flex.utils.Timer;
 COMPILE::LATER
 {
 import mx.core.RSLData;
@@ -1806,6 +1807,38 @@ public class SystemManager extends MovieClip
                trace(e.type, e.target);
        }
        
+    COMPILE::JS
+    public var frameRate:Number = 166;
+    
+    COMPILE::JS
+    private var frameInterval:Number = -1;
+    
+    COMPILE::JS
+    override public function addEventListener(type:String, listener:Function,
+                                              useCapture:Boolean = false, 
opt_handlerScope:Object = null):void
+    {
+        if (type == FlexEvent.RENDER)
+            type = Event.RENDER;
+        else
+            type = Event.ENTER_FRAME;
+        
+        // TODO (aharui): figure out when to stop the interval
+        if (type == Event.RENDER || type == Event.ENTER_FRAME)
+        {
+            if (frameInterval == -1)
+                frameInterval = setInterval(frameCallback, frameRate);
+        }    
+        super.addEventListener(type, listener, useCapture);
+    }
+    
+    COMPILE::JS
+    private function frameCallback():void
+    {
+        dispatchEvent(new Event(Event.ENTER_FRAME));
+        dispatchEvent(new Event(Event.RENDER));
+    }
+            
+    
     /**
      *  @private
      */

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/MX/src/main/flex/mx/styles/StyleProtoChain.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/styles/StyleProtoChain.as 
b/frameworks/projects/MX/src/main/flex/mx/styles/StyleProtoChain.as
index ec4467b..d0479d9 100644
--- a/frameworks/projects/MX/src/main/flex/mx/styles/StyleProtoChain.as
+++ b/frameworks/projects/MX/src/main/flex/mx/styles/StyleProtoChain.as
@@ -779,6 +779,8 @@ public class StyleProtoChain
             object.invalidateSize();
         }
 
+        COMPILE::LATER
+        {
         // TODO (gosmith): Should initThemeColor() be in some interface?
         if (!styleProp || 
             styleProp == "styleName" ||
@@ -787,6 +789,7 @@ public class StyleProtoChain
                if (object is IUIComponent)
                 object["initThemeColor"]();
         }
+        }
         
         object.invalidateDisplayList();
         

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24dc2663/frameworks/projects/MX/src/test/flex/src/TestCompile.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/test/flex/src/TestCompile.mxml 
b/frameworks/projects/MX/src/test/flex/src/TestCompile.mxml
index 427952f..bd6cbb4 100644
--- a/frameworks/projects/MX/src/test/flex/src/TestCompile.mxml
+++ b/frameworks/projects/MX/src/test/flex/src/TestCompile.mxml
@@ -22,6 +22,7 @@ limitations under the License.
                                xmlns:mx="library://ns.apache.org/flexjs/mx"
                                xmlns:js="library://ns.apache.org/flexjs/basic" 
                    applicationComplete="runTests()"
+                   width="500" height="375"
                    usePreloader="false"
                    preloader="mx.preloaders.DownloadProgressBar"
                    >

Reply via email to