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 2017/05/08 18:59:13 UTC

[01/21] git commit: [flex-asjs] [refs/heads/tlf] - initial dummy ContextMenu

Repository: flex-asjs
Updated Branches:
  refs/heads/tlf 244cd2f8e -> 56a507d5e


initial dummy ContextMenu


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

Branch: refs/heads/tlf
Commit: 81eceb272bc6287756974542e1cc11474f26d503
Parents: 48710ae
Author: Alex Harui <ah...@apache.org>
Authored: Fri May 5 09:41:09 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:00 2017 -0700

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/textLayout/dummy/ContextMenu.as  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/81eceb27/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/ContextMenu.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/ContextMenu.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/ContextMenu.as
index f79776c..2c8108f 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/ContextMenu.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/ContextMenu.as
@@ -18,10 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.textLayout.dummy {
 	public class ContextMenu {
-		public var builtInItems:ContextMenuBuiltInItems;
-		public var clipboardItems:ContextMenuClipboardItems;
+		public var builtInItems:ContextMenuBuiltInItems = new ContextMenuBuiltInItems();
+		public var clipboardItems:ContextMenuClipboardItems = new ContextMenuClipboardItems();
 		public var clipboardMenu:Boolean;
-		public var customItems:Array;
+		public var customItems:Array = [];
 		public var isSupported:Boolean;
 		public var items:Array;
 	}


[15/21] git commit: [flex-asjs] [refs/heads/tlf] - skipAsCoercions is on, so have to use 'is' when you need it

Posted by ah...@apache.org.
skipAsCoercions is on, so have to use 'is' when you need it


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

Branch: refs/heads/tlf
Commit: 91ef059d2e8a65602f0b82857bd9b272c334c76b
Parents: 824e578
Author: Alex Harui <ah...@apache.org>
Authored: Mon May 8 11:06:47 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:03 2017 -0700

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/91ef059d/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
index 14c52e2..cf207b6 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
@@ -1855,7 +1855,9 @@ package org.apache.flex.textLayout.compose
 			}
 			else
 			{
-				var testILG:IInlineGraphicElement = startElem as IInlineGraphicElement;
+				var testILG:IInlineGraphicElement = null;
+				if (startElem is IInlineGraphicElement) // need this since skipAsCoercions is on
+					startElem as IInlineGraphicElement;
 				if (!testILG || testILG.effectiveFloat == Float.NONE || begIdx == endIdx)
 				{
 					blockRect = makeBlock(textLine, begIdx, begAtomIndex, endAtomIndex, startMetrics, blockProgression, direction, heightAndAdj);


[03/21] git commit: [flex-asjs] [refs/heads/tlf] - add conditional compile flags to TLFJS build

Posted by ah...@apache.org.
add conditional compile flags to TLFJS build


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

Branch: refs/heads/tlf
Commit: 1459d80bb56a08df22c54d3336d4fb728e9915ce
Parents: 9f21c89
Author: Alex Harui <ah...@apache.org>
Authored: Fri May 5 08:16:25 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:00 2017 -0700

----------------------------------------------------------------------
 frameworks/js/FlexJS/projects/TLFJS/build.xml | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1459d80b/frameworks/js/FlexJS/projects/TLFJS/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/projects/TLFJS/build.xml b/frameworks/js/FlexJS/projects/TLFJS/build.xml
index d0603cf..ba0400d 100644
--- a/frameworks/js/FlexJS/projects/TLFJS/build.xml
+++ b/frameworks/js/FlexJS/projects/TLFJS/build.xml
@@ -72,6 +72,8 @@
             <arg value="-load-config+=${basedir}/src/main/config/compile-js-config.xml" />
             <arg value="-define=CONFIG::debug,${dbg}" />
             <arg value="-define=CONFIG::release,${rel}" />
+            <arg value="-define=COMPILE::SWF,false" />
+            <arg value="-define=COMPILE::JS,true" />
         </java>
     </target>
     
@@ -88,6 +90,8 @@
             <arg value="-compiler.strict-xml=true" />
             <define name="CONFIG::debug" value="${dbg}"/>
             <define name="CONFIG::release" value="${rel}"/>
+            <arg value="-define=COMPILE::SWF,false" />
+            <arg value="-define=COMPILE::JS,true" />
             <load-config filename="${FLEX_HOME}/frameworks/js-config.xml" />
             <load-config filename="src/main/config/compile-js-config.xml" />
         </compc>


[06/21] git commit: [flex-asjs] [refs/heads/tlf] - BoundsUtil didn't seem to be implemented. Seems like we can just implement getBounds instead

Posted by ah...@apache.org.
BoundsUtil didn't seem to be implemented.  Seems like we can just implement getBounds instead


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

Branch: refs/heads/tlf
Commit: 7ac185e1d403fea0ab9c0d4f1a46b44aa955995d
Parents: 0367510
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 21:35:09 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:01 2017 -0700

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/textLayout/edit/SelectionManager.as  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7ac185e1/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
index c13373f..de9a73c 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
@@ -1414,7 +1414,7 @@ package org.apache.flex.textLayout.edit
 				if (lastLineIndexInColumn == -1)
 					lastLineIndexInColumn = testIndex;
 
-				var bounds:Rectangle = BoundsUtil.getBounds(rtTextLine, controller.container);// rtTextLine.getBounds(DisplayObject(controller.container));
+				var bounds:Rectangle = rtTextLine.getBounds(controller.container);// rtTextLine.getBounds(DisplayObject(controller.container));
 				// trace(testIndex.toString(),":",bounds.toString());
 
 				var linePerpCoor:Number = isTTB ? bounds.left : bounds.bottom;


[19/21] git commit: [flex-asjs] [refs/heads/tlf] - need currentContainer in order to measure text

Posted by ah...@apache.org.
need currentContainer in order to measure text


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

Branch: refs/heads/tlf
Commit: c341287ab8773dd3ea516f6485390c608843109a
Parents: 91ef059
Author: Alex Harui <ah...@apache.org>
Authored: Mon May 8 11:07:53 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:03 2017 -0700

----------------------------------------------------------------------
 .../container/TextContainerManager.as           |  3 +-
 .../flex/textLayout/factory/ITLFFactory.as      | 10 ++++-
 .../textLayout/factory/StandardTLFFactory.as    | 11 ++++++
 .../org/apache/flex/text/engine/ITextFactory.as | 10 +++++
 .../apache/flex/text/html/HTMLTextFactory.as    | 14 ++++++-
 .../flex/org/apache/flex/text/html/TextBlock.as |  7 ++++
 .../flex/org/apache/flex/text/html/TextLine.as  | 40 ++++++++++++++++----
 7 files changed, 84 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c341287a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
index 72ba0c1..4488faf 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
@@ -1632,7 +1632,8 @@ package org.apache.flex.textLayout.container
 		private function convertToTextFlow():void
 		{
 			CONFIG::debug { assert(_sourceState != SOURCE_TEXTFLOW,"bad call to convertToTextFlow"); }
-									
+	
+			TLFFactory.defaultTLFFactory.currentContainer = container;								
 			_textFlow = new TextFlow(TLFFactory.defaultTLFFactory, _config);
 			_textFlow.hostFormat = _hostFormat;
 			if(_swfContext)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c341287a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/ITLFFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/ITLFFactory.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/ITLFFactory.as
index 4b204b5..c8da7ad 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/ITLFFactory.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/ITLFFactory.as
@@ -25,6 +25,14 @@ package org.apache.flex.textLayout.factory {
 		function get textFactory():ITextFactory;
 		function getRect():IRect;
 		function getCompoundGraphic():ICompoundGraphic;
-		function getContainer():IParentIUIBase;		
+		function getContainer():IParentIUIBase;
+		
+		// in JS, in order to measure text, TextLines need to be put
+		// in the DOM early, so you need to pick one DOM widget to use as
+		// at least a temporary parent.
+		// in SWF, this isn't really needed since FTE is given all
+		// of the font information it needs
+		function get currentContainer():IParentIUIBase;
+		function set currentContainer(value:IParentIUIBase):void
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c341287a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/StandardTLFFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/StandardTLFFactory.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/StandardTLFFactory.as
index 460621b..7ed3439 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/StandardTLFFactory.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/StandardTLFFactory.as
@@ -45,7 +45,18 @@ package org.apache.flex.textLayout.factory {
 		public function get textFactory() : ITextFactory {
 			if(!factory)
 				factory = new HTMLTextFactory();
+			factory.currentContainer = currentContainer;
 			return factory;
 		}
+		
+		private var _currentContainer:IParentIUIBase;
+		public function get currentContainer():IParentIUIBase
+		{
+			return _currentContainer;
+		}
+		public function set currentContainer(value:IParentIUIBase):void
+		{
+			_currentContainer = value;
+		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c341287a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextFactory.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextFactory.as
index 5ef254c..6987c22 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextFactory.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextFactory.as
@@ -19,11 +19,21 @@
 package org.apache.flex.text.engine
 {
 	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IParentIUIBase;
 
 	public interface ITextFactory
 	{
         function getTextBlock():ITextBlock;
         function getTextContainer():IUIBase;
         function getFontLoader():IFontLoader;
+		
+		// in JS, in order to measure text, TextLines need to be put
+		// in the DOM early, so you need to pick one DOM widget to use as
+		// at least a temporary parent.
+		// in SWF, this isn't really needed since FTE is given all
+		// of the font information it needs
+		function get currentContainer():IParentIUIBase;
+		function set currentContainer(value:IParentIUIBase):void
+
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c341287a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/HTMLTextFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/HTMLTextFactory.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/HTMLTextFactory.as
index e7021b7..48bd8bf 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/HTMLTextFactory.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/HTMLTextFactory.as
@@ -21,6 +21,7 @@ package org.apache.flex.text.html
     import org.apache.flex.text.engine.ITextFactory;
     import org.apache.flex.text.engine.ITextBlock;
     import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IParentIUIBase;
     import org.apache.flex.html.Div;
     import org.apache.flex.text.engine.IFontLoader;
 
@@ -40,7 +41,18 @@ package org.apache.flex.text.html
         {
             // no fontLoader for this factory at this point. It uses standard broswer fonts.
             return _fontLoader;
-        }        
+        }
+		
+		private var _currentContainer:IParentIUIBase;
+		public function get currentContainer():IParentIUIBase
+		{
+			return _currentContainer;
+		}
+		public function set currentContainer(value:IParentIUIBase):void
+		{
+			_currentContainer = value;
+		}
+        
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c341287a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
index 088588a..934b8e5 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
@@ -30,6 +30,8 @@ package org.apache.flex.text.html
 	import org.apache.flex.text.html.TextLine;
 	import org.apache.flex.html.Span;
 	
+	import org.apache.flex.core.IParent;
+	
 	public class TextBlock implements ITextBlock
 	{
 		public function TextBlock(factory:ITextFactory)
@@ -182,6 +184,9 @@ package org.apache.flex.text.html
 		
 		private var lines:Array = [];
 		
+		/**
+		 * @flexjsignorecoercion org.apache.flex.core.IParent
+		 */
 		public function createTextLine(previousLine:ITextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):ITextLine
 		{
 			if (previousLine == null)
@@ -209,8 +214,10 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
+				textFactory.currentContainer.addElement(tl); // add to DOM early so textWidth is valid
 				var span:Span = new Span();
 				span.text = textElem.text;
+				//span.element.style.display = "block";
 				tl.addElement(span);
 			}
 			if (previousLine == null)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c341287a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
index fbb17a3..b865f33 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
@@ -71,10 +71,14 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
-				return 0;
+				// needs improvement.  For now assume 2 pixel descent.
+				return _textBlock.content.elementFormat.fontSize - 2;
 			}
 		}
 		
+		/**
+		 * @flexjsignorecoercion HTMLElement
+		 */
 		public function get atomCount():int
 		{
 			COMPILE::SWF
@@ -83,7 +87,7 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
-				return 0;
+				return (element.firstChild as HTMLElement).firstChild["length"];
 			}
 		}
 		
@@ -103,7 +107,11 @@ package org.apache.flex.text.html
 			{
 				return textField.getLineMetrics(0).descent;
 			}
-			return 0;
+			COMPILE::JS
+			{
+				// needs improvement.  For now assume 2 pixel descent.
+				return 2;
+			}
 		}
 		
 		private var _doubleClickEnabled:Boolean;
@@ -150,7 +158,7 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
-				return 0;
+				return atomCount;
 			}
 		}
 		
@@ -172,6 +180,9 @@ package org.apache.flex.text.html
 			return _beginIndex;
 		}
 		
+		/**
+		 * @flexjsignorecoercion HTMLElement
+		 */
 		public function get textHeight():Number
 		{
 			COMPILE::SWF
@@ -180,10 +191,13 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
-				return 0;
+				return (element.firstChild as HTMLElement).getClientRects()[0].height;
 			}
 		}
 		
+		/**
+		 * @flexjsignorecoercion HTMLElement
+		 */
 		public function get textWidth():Number
 		{
 			COMPILE::SWF
@@ -192,7 +206,15 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
-				return 0;
+				if (element.firstChild.textContent == "\u2029")
+				{ 
+				  // if para terminator, use nbsp instead
+				  (element.firstChild as HTMLElement).innerHTML = "\u00A0";
+				  var w:Number = (element.firstChild as HTMLElement).getClientRects()[0].width;
+				  (element.firstChild as HTMLElement).innerHTML = "\u2029";
+				  return w;
+				}
+				return (element.firstChild as HTMLElement).getClientRects()[0].width;
 			}
 		}
 		
@@ -277,7 +299,7 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
-				return null;
+				return new Rectangle(element.offsetLeft, element.offsetTop, element.offsetWidth, element.offsetHeight);
 			}
 		}
 		
@@ -295,7 +317,8 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
-				return null;
+				// fake an answer
+				return new Rectangle(0, 1.2 - _textBlock.content.elementFormat.fontSize, 3, 1.2);
 			}
 		}
 
@@ -325,6 +348,7 @@ package org.apache.flex.text.html
 			}
 			COMPILE::JS
 			{
+				trace("getAtomIndexAtPoint not implemented");
 				//TODO atom locations. This one will be fun...
 				return 0;
 			}


[10/21] git commit: [flex-asjs] [refs/heads/tlf] - mouseevent also needs defaultPrevented

Posted by ah...@apache.org.
mouseevent also needs defaultPrevented


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

Branch: refs/heads/tlf
Commit: 15a223cf6cfb60af8c72cbf7f5135abdc8b4dbaf
Parents: abc3c03
Author: Alex Harui <ah...@apache.org>
Authored: Sun May 7 19:02:54 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:02 2017 -0700

----------------------------------------------------------------------
 .../src/main/flex/org/apache/flex/events/MouseEvent.as | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/15a223cf/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
index 3e5a617..1cea36d 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
@@ -185,6 +185,19 @@ package org.apache.flex.events
             return false;
         }
 
+        /**
+         * defaultPrevented is true if <code>preventDefault()</code> was called.
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.0
+         */
+        public function get defaultPrevented():Boolean
+        {
+        	return isDefaultPrevented();
+        }
+
 	}
 
 	COMPILE::JS


[11/21] git commit: [flex-asjs] [refs/heads/tlf] - handle keyboard and other events

Posted by ah...@apache.org.
handle keyboard and other events


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

Branch: refs/heads/tlf
Commit: 70e2c0d6b1ab7161567144eb6e6a0f7490e2844a
Parents: af36a26
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 21:37:26 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:02 2017 -0700

----------------------------------------------------------------------
 .../projects/TLF/src/main/flex/TLFClasses.as    |   1 +
 .../beads/DispatchTLFKeyboardEventBead.as       | 191 +++++++++++++++++++
 2 files changed, 192 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/70e2c0d6/frameworks/projects/TLF/src/main/flex/TLFClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/TLFClasses.as b/frameworks/projects/TLF/src/main/flex/TLFClasses.as
index dd6d6ed..e398e7c 100644
--- a/frameworks/projects/TLF/src/main/flex/TLFClasses.as
+++ b/frameworks/projects/TLF/src/main/flex/TLFClasses.as
@@ -24,6 +24,7 @@ package
 		
 		// import org.apache.flex.textLayout.accessibility.TextAccImpl; TextAccImpl;
 		
+		import org.apache.flex.textLayout.beads.DispatchTLFKeyboardEventBead; DispatchTLFKeyboardEventBead;
 		import org.apache.flex.textLayout.container.TextContainerManager; TextContainerManager;
 		import org.apache.flex.textLayout.TextLayoutVersion; TextLayoutVersion;
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/70e2c0d6/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
new file mode 100644
index 0000000..286698d
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
@@ -0,0 +1,191 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.textLayout.beads
+{
+	
+	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.events.KeyboardEvent;
+	import org.apache.flex.events.utils.KeyboardEventConverter;
+	import org.apache.flex.textLayout.events.FocusEvent;
+
+	COMPILE::JS
+	{
+		import org.apache.flex.core.IRenderedObject;
+		import goog.events;
+	}
+	
+	COMPILE::SWF
+	{
+		import flash.events.Event;
+		import flash.events.KeyboardEvent;
+	}
+	
+	/**
+	 *  The DispatchKeyboardEventBead class dispatched INPUT_FINISHED on strand
+	 *  when enter is pressed, or when foucus is out.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class DispatchTLFKeyboardEventBead implements IBead
+	{
+		/**
+		 *  constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function DispatchTLFKeyboardEventBead()
+		{
+		}			
+		
+		private var _strand:IStrand;
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			COMPILE::SWF
+			{
+				if (!attachEventListeners())
+				{
+					(_strand as IEventDispatcher).addEventListener("viewChanged", viewChangedHandler);
+				}
+			}
+			COMPILE::JS
+			{
+				(_strand as Object).element.addEventListener('keydown', keyEventHandler);
+				(_strand as Object).element.addEventListener('keyup', keyEventHandler);
+			}
+		}
+		
+		
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		private function viewChangedHandler(e:org.apache.flex.events.Event):void
+		{
+			attachEventListeners();
+		}
+		
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		private function attachEventListeners():Boolean
+		{
+			var host:UIBase = _strand as UIBase;
+			host.$displayObject.addEventListener(flash.events.KeyboardEvent.KEY_DOWN, keyEventHandler);
+			host.$displayObject.addEventListener(flash.events.KeyboardEvent.KEY_UP, keyEventHandler);
+			host.$displayObject.addEventListener(flash.events.Event.ACTIVATE, eventHandler);
+			host.$displayObject.addEventListener(flash.events.Event.DEACTIVATE, eventHandler);
+			host.$displayObject.addEventListener(flash.events.FocusEvent.FOCUS_IN, focusEventHandler);
+			host.$displayObject.addEventListener(flash.events.FocusEvent.FOCUS_OUT, focusEventHandler);
+			return true;
+		}
+		
+		
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		protected function keyEventHandler(event:flash.events.KeyboardEvent):void
+		{
+			// this will otherwise bubble an event of flash.events.Event
+			event.stopImmediatePropagation();
+			var newEvent:org.apache.flex.events.KeyboardEvent = KeyboardEventConverter.convert(event);
+			(_strand as IEventDispatcher).dispatchEvent(newEvent);
+			if(newEvent.defaultPrevented)
+			{
+				event.preventDefault();
+			}
+			
+			
+		}
+		
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		protected function eventHandler(event:flash.events.Event):void
+		{
+			if (event is org.apache.flex.events.Event) return;
+			
+			// this will otherwise dispatch an event of flash.events.Event
+			event.stopImmediatePropagation();
+			var newEvent:org.apache.flex.events.Event = new org.apache.flex.events.Event(event.type);
+			(_strand as IEventDispatcher).dispatchEvent(newEvent);
+			if(newEvent.defaultPrevented)
+			{
+				event.preventDefault();
+			}
+		}
+
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		protected function focusEventHandler(event:flash.events.FocusEvent):void
+		{
+			if (event is org.apache.flex.events.Event) return;
+			
+			// this will otherwise dispatch an event of flash.events.FocusEvent
+			event.stopImmediatePropagation();
+			var newEvent:org.apache.flex.textLayout.events.FocusEvent = new org.apache.flex.textLayout.events.FocusEvent(event.type);
+			(_strand as IEventDispatcher).dispatchEvent(newEvent);
+			if(newEvent.defaultPrevented)
+			{
+				event.preventDefault();
+			}
+		}
+		
+		/**
+		 * @private
+		 */
+		COMPILE::JS
+		protected function keyEventHandler(event:KeyboardEvent):void
+		{
+			event.stopImmediatePropagation();
+			var newEvent:org.apache.flex.events.KeyboardEvent = KeyboardEventConverter.convert(event);
+			(_strand as IEventDispatcher).dispatchEvent(newEvent);
+			if(newEvent.defaultPrevented)
+			{
+				event.preventDefault();
+			}
+		}
+		
+	}
+}


[07/21] git commit: [flex-asjs] [refs/heads/tlf] - need FontMetrics

Posted by ah...@apache.org.
need FontMetrics


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

Branch: refs/heads/tlf
Commit: af36a261d408329e5405d65a4a014944ec092be5
Parents: e290e6a
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 21:36:18 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:01 2017 -0700

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/text/engine/ElementFormat.as    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af36a261/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
index 3edbee5..faf9a40 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
@@ -18,6 +18,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.text.engine
 {
+	import org.apache.flex.geom.Rectangle;
+	
 	public class ElementFormat
 	{
 		public function ElementFormat()
@@ -80,7 +82,10 @@ package org.apache.flex.text.engine
  	 	
 		public function getFontMetrics():FontMetrics
 		{
-			return null;
+			var fm:FontMetrics = new FontMetrics();
+			// just a guess for now
+			fm.emBox = new Rectangle(0, 1.2 - fontSize, fontSize, 1.2);
+			return fm;
 		}
 	}
 }
\ No newline at end of file


[14/21] git commit: [flex-asjs] [refs/heads/tlf] - add conditional flags and remove-circulars to js builds

Posted by ah...@apache.org.
add conditional flags and remove-circulars to js builds


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

Branch: refs/heads/tlf
Commit: abc3c037642a64ae663d67cc36a63d62091521f9
Parents: 6548262
Author: Alex Harui <ah...@apache.org>
Authored: Sun May 7 19:01:26 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:02 2017 -0700

----------------------------------------------------------------------
 build.xml | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/abc3c037/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 350da9b..3052861 100644
--- a/build.xml
+++ b/build.xml
@@ -1885,8 +1885,12 @@
             <arg value="-debug" />
             <arg value="+playerglobal.version=${playerglobal.version}" />
             <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+            <arg value="-external-library-path=${FLEXJS_HOME}/js/libs/js.swc" />
             <arg value="-js-output-type=FLEXJS" />
             <arg value="-closure-lib=${GOOG_HOME}" />
+            <arg value="-remove-circulars" />
+            <arg value="-define=COMPILE::SWF,false" />
+            <arg value="-define=COMPILE::JS,true" />
             <arg value="${file}" />
         </java>
     </target>
@@ -1900,8 +1904,12 @@
             <arg value="+flexlib=${FLEXJS_HOME}/frameworks" />
             <arg value="+playerglobal.version=${playerglobal.version}" />
             <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+            <arg value="-external-library-path=${FLEXJS_HOME}/js/libs/js.swc" />
             <arg value="-js-output-type=FLEXJS" />
             <arg value="-closure-lib=${GOOG_HOME}" />
+            <arg value="-remove-circulars" />
+            <arg value="-define=COMPILE::SWF,false" />
+            <arg value="-define=COMPILE::JS,true" />
             <arg value="${file}" />
         </java>
     </target>


[08/21] git commit: [flex-asjs] [refs/heads/tlf] - set size of selection object. For some reason it is born with explicitWidth/Height of 0 and does not expand when to drawRect into it. Later, when selObj is added to display list, it redraws itself bas

Posted by ah...@apache.org.
set size of selection object.  For some reason it is born with explicitWidth/Height of 0 and does not expand when to drawRect into it.   Later, when selObj is added to display list, it redraws itself based on its explicitWidth/Height


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

Branch: refs/heads/tlf
Commit: 036751064398c60ecfdcd8ac4bbfe0261bb4eaa9
Parents: 4c7cee2
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 21:34:23 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:01 2017 -0700

----------------------------------------------------------------------
 .../org/apache/flex/textLayout/container/ContainerController.as    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03675106/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
index 80e1332..bb223b7 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
@@ -2846,6 +2846,8 @@ package org.apache.flex.textLayout.container
 //			selObj.graphics.beginFill(selFormat.pointColor);
 			// pixel snap - works for unscaled text - scaled text will have to accept fuzzy cursors
 			selObj.drawRect(int(x),int(y),w,h);
+			selObj.width = w;
+			selObj.height = h;
 //			selObj.graphics.drawRect(int(x),int(y),w,h);
 //			selObj.graphics.endFill();
 			


[18/21] git commit: [flex-asjs] [refs/heads/tlf] - move some static to instance so there aren't static initializer dependency issues. Also switch to using defaultPrevented

Posted by ah...@apache.org.
move some static to instance so there aren't static initializer dependency issues.  Also switch to using defaultPrevented


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

Branch: refs/heads/tlf
Commit: 58bfcf8cafb1fc5475d8bc6027f459a02aa24ae9
Parents: 15a223c
Author: Alex Harui <ah...@apache.org>
Authored: Sun May 7 19:05:11 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:03 2017 -0700

----------------------------------------------------------------------
 .../apache/flex/textLayout/container/TextContainerManager.as | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/58bfcf8c/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
index 0cb267a..72ba0c1 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
@@ -242,7 +242,7 @@ package org.apache.flex.textLayout.container
 	public class TextContainerManager extends EventDispatcher implements ISWFContext, IInteractionEventHandler, ISandboxSupport, ITextContainerManager
 	{		
 		// all events that are listened for need to be in this list.
-		static private const eventList:Array = [ 
+		private const eventList:Array = [ 
 			FlowOperationEvent.FLOW_OPERATION_BEGIN,
 			FlowOperationEvent.FLOW_OPERATION_END,
 			FlowOperationEvent.FLOW_OPERATION_COMPLETE,
@@ -327,7 +327,7 @@ package org.apache.flex.textLayout.container
 		}
 		
 		/** Shared definition of the scrollPolicy property. @private */
-		static public const editingModePropertyDefinition:Property = PropertyFactory.enumString("editingMode", EditingMode.READ_WRITE, false, null, 
+		public const editingModePropertyDefinition:Property = PropertyFactory.enumString("editingMode", EditingMode.READ_WRITE, false, null, 
 			EditingMode.READ_WRITE, EditingMode.READ_ONLY, EditingMode.READ_SELECT);	
 		
 		private var _container:IParentIUIBase;
@@ -2187,7 +2187,7 @@ package org.apache.flex.textLayout.container
 		*/				
 		public function mouseWheelHandler(event:MouseEvent):void
 		{
-			if (event.isDefaultPrevented())
+			if (event.defaultPrevented)
 				return;
 
 			if (_composeState == COMPOSE_FACTORY)
@@ -2566,7 +2566,7 @@ class RemappedMouseEvent extends org.apache.flex.events.MouseEvent
 	{ _event.updateAfterEvent(); }
 	
 	public override function isDefaultPrevented():Boolean
-	{ return _event.isDefaultPrevented(); }
+	{ return _event.defaultPrevented; }
 	
 	public override function preventDefault():void
 	{ _event.preventDefault(); }


[21/21] git commit: [flex-asjs] [refs/heads/tlf] - wire up textInput event on JS side

Posted by ah...@apache.org.
wire up textInput event on JS side


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

Branch: refs/heads/tlf
Commit: 56a507d5e0239e3ac2f955ad2a646d736a9f2b90
Parents: 80a55bb
Author: Alex Harui <ah...@apache.org>
Authored: Mon May 8 11:58:51 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:04 2017 -0700

----------------------------------------------------------------------
 .../textLayout/beads/DispatchTLFKeyboardEventBead.as   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/56a507d5/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
index 28daf46..4a9855a 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
@@ -88,6 +88,7 @@ package org.apache.flex.textLayout.beads
 			COMPILE::JS
 			{
 				(_strand as Object).element.addEventListener('keydown', keyEventHandler);
+				(_strand as Object).element.addEventListener('keypress', keyEventHandler);
 				(_strand as Object).element.addEventListener('keyup', keyEventHandler);
 				(_strand as Object).element.addEventListener('focus', focusEventHandler);
 				(_strand as Object).element.addEventListener('blur', focusEventHandler);
@@ -208,6 +209,18 @@ package org.apache.flex.textLayout.beads
 			{
 				event.preventDefault();
 			}
+			if (event.type == "keypress")
+			{
+				var textEvent:org.apache.flex.text.events.TextEvent = new org.apache.flex.text.events.TextEvent(TextEvent.TEXT_INPUT);
+				if (event.key != null)
+					textEvent.text = String.fromCharCode(event.key);
+				else if (event['which'] != null)
+					textEvent.text = String.fromCharCode(event['which']);				  
+				else
+					textEvent.text = String.fromCharCode(event['keyCode']);
+				(_strand as IEventDispatcher).dispatchEvent(textEvent);
+			}
+
 		}
 
 		/**


[02/21] git commit: [flex-asjs] [refs/heads/tlf] - add TextContainerManager to TLF.swc

Posted by ah...@apache.org.
add TextContainerManager to TLF.swc


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

Branch: refs/heads/tlf
Commit: 48710aee9d36ec744c0ed47013d72ceeecb29e4e
Parents: 1459d80
Author: Alex Harui <ah...@apache.org>
Authored: Fri May 5 08:17:24 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:00 2017 -0700

----------------------------------------------------------------------
 frameworks/projects/TLF/src/main/flex/TLFClasses.as             | 1 +
 .../apache/flex/textLayout/container/TextContainerManager.as    | 5 +++++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/48710aee/frameworks/projects/TLF/src/main/flex/TLFClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/TLFClasses.as b/frameworks/projects/TLF/src/main/flex/TLFClasses.as
index 38fd177..dd6d6ed 100644
--- a/frameworks/projects/TLF/src/main/flex/TLFClasses.as
+++ b/frameworks/projects/TLF/src/main/flex/TLFClasses.as
@@ -24,6 +24,7 @@ package
 		
 		// import org.apache.flex.textLayout.accessibility.TextAccImpl; TextAccImpl;
 		
+		import org.apache.flex.textLayout.container.TextContainerManager; TextContainerManager;
 		import org.apache.flex.textLayout.TextLayoutVersion; TextLayoutVersion;
 
 		import org.apache.flex.textLayout.compose.BaseCompose; BaseCompose;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/48710aee/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
index 79d95d2..0cb267a 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
@@ -2537,15 +2537,19 @@ class RemappedMouseEvent extends org.apache.flex.events.MouseEvent
 	// public override function get currentTarget():Object
 	// { return _event.currentTarget; }
 	
+	COMPILE::SWF
 	public override function get eventPhase():uint
 	{ return _event.eventPhase; }
 	
+	COMPILE::SWF
 	public override function get isRelatedObjectInaccessible():Boolean
 	{ return _event.isRelatedObjectInaccessible; }
 	
+	COMPILE::SWF
 	public override function get stageX():Number
 	{ return _event.stageX; }
 	
+	COMPILE::SWF
 	public override function get stageY():Number
 	{ return _event.stageY; }
 	
@@ -2557,6 +2561,7 @@ class RemappedMouseEvent extends org.apache.flex.events.MouseEvent
 		return rslt;
 	}
 	
+	COMPILE::SWF
 	public override function updateAfterEvent():void
 	{ _event.updateAfterEvent(); }
 	


[04/21] git commit: [flex-asjs] [refs/heads/tlf] - add conditional compile flags to compile targets

Posted by ah...@apache.org.
add conditional compile flags to compile targets


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

Branch: refs/heads/tlf
Commit: 9f21c8956253a35f31b14adc571898cb14262b4c
Parents: 244cd2f
Author: Alex Harui <ah...@apache.org>
Authored: Fri May 5 08:15:27 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:00 2017 -0700

----------------------------------------------------------------------
 build.xml | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9f21c895/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index befe655..350da9b 100644
--- a/build.xml
+++ b/build.xml
@@ -1870,6 +1870,8 @@
         <mxmlc fork="true" debug="true"
             file="${file}">
             <jvmarg line="${mxmlc.jvm.args}"/>
+            <arg value="-define=COMPILE::SWF,true" />
+            <arg value="-define=COMPILE::JS,false" />
         </mxmlc>
     </target>
     


[09/21] git commit: [flex-asjs] [refs/heads/tlf] - fix infinite loops and adjust selection rect for differences in TextLine coordinate system

Posted by ah...@apache.org.
fix infinite loops and adjust selection rect for differences in TextLine coordinate system


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

Branch: refs/heads/tlf
Commit: 4c7cee22d5308ed23122c8ec9aa054d4597eeeb2
Parents: 81eceb2
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 21:32:39 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:01 2017 -0700

----------------------------------------------------------------------
 .../flex/org/apache/flex/textLayout/compose/TextFlowLine.as  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4c7cee22/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
index 54e7721..14c52e2 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as
@@ -2046,7 +2046,7 @@ package org.apache.flex.textLayout.compose
 
 			// this is much simpler and actually more accurate - localToGlobal/globalToLocal does some rounding
 			rect.x += textLine.x;
-			rect.y += textLine.y;
+			rect.y += textLine.ascent; // += textLine.y; // baseline is 0 in flash.text.engine.TextLine;
 
 			if (constrainShape)
 			{
@@ -2161,21 +2161,21 @@ package org.apache.flex.textLayout.compose
 			if(_localZeroPoint == null)
 				_localZeroPoint = new Point(0, 0);
 			
-			return localZeroPoint;
+			return _localZeroPoint;
 		}
 		static private var _localOnePoint:Point;
 		static private function get localOnePoint():Point{
 			if(_localOnePoint == null)
 				_localOnePoint = new Point(1, 0);
 			
-			return localOnePoint;
+			return _localOnePoint;
 		}
 		static private var _rlLocalOnePoint:Point;
 		static private function get rlLocalOnePoint():Point{
 			if(_rlLocalOnePoint == null)
 				_rlLocalOnePoint = new Point(0, 1);
 			
-			return rlLocalOnePoint;
+			return _rlLocalOnePoint;
 		}
 
 		// TODO generalize this so we're not relying on UIBase


[13/21] git commit: [flex-asjs] [refs/heads/tlf] - don't let the child text widgets steal focus

Posted by ah...@apache.org.
don't let the child text widgets steal focus


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

Branch: refs/heads/tlf
Commit: 6548262307aab79b673b5d5eee3ac10184574e78
Parents: 6853279
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 23:22:35 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:02 2017 -0700

----------------------------------------------------------------------
 .../beads/DispatchTLFKeyboardEventBead.as       | 23 +++++++++++++++++++-
 .../flex/org/apache/flex/text/html/TextLine.as  |  1 +
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65482623/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
index 286698d..7abd04f 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
@@ -26,6 +26,7 @@ package org.apache.flex.textLayout.beads
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.events.KeyboardEvent;
 	import org.apache.flex.events.utils.KeyboardEventConverter;
+	import org.apache.flex.text.events.TextEvent;
 	import org.apache.flex.textLayout.events.FocusEvent;
 
 	COMPILE::JS
@@ -109,6 +110,7 @@ package org.apache.flex.textLayout.beads
 		{
 			var host:UIBase = _strand as UIBase;
 			host.$displayObject.addEventListener(flash.events.KeyboardEvent.KEY_DOWN, keyEventHandler);
+			host.$displayObject.addEventListener(flash.events.TextEvent.TEXT_INPUT, textEventHandler);
 			host.$displayObject.addEventListener(flash.events.KeyboardEvent.KEY_UP, keyEventHandler);
 			host.$displayObject.addEventListener(flash.events.Event.ACTIVATE, eventHandler);
 			host.$displayObject.addEventListener(flash.events.Event.DEACTIVATE, eventHandler);
@@ -117,7 +119,25 @@ package org.apache.flex.textLayout.beads
 			return true;
 		}
 		
-		
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		protected function textEventHandler(event:flash.events.TextEvent):void
+		{
+			// this will otherwise bubble an event of flash.events.Event
+			event.stopImmediatePropagation();
+			var newEvent:org.apache.flex.text.events.TextEvent = new org.apache.flex.text.events.TextEvent(event.type);
+			newEvent.text = event.text;
+			(_strand as IEventDispatcher).dispatchEvent(newEvent);
+			if(newEvent.defaultPrevented)
+			{
+				event.preventDefault();
+			}
+			
+			
+		}
+				
 		/**
 		 * @private
 		 */
@@ -162,6 +182,7 @@ package org.apache.flex.textLayout.beads
 		{
 			if (event is org.apache.flex.events.Event) return;
 			
+			trace(event.type, event.target, event.relatedObject);
 			// this will otherwise dispatch an event of flash.events.FocusEvent
 			event.stopImmediatePropagation();
 			var newEvent:org.apache.flex.textLayout.events.FocusEvent = new org.apache.flex.textLayout.events.FocusEvent(event.type);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65482623/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
index 3087cd7..fbb17a3 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
@@ -44,6 +44,7 @@ package org.apache.flex.text.html
 			COMPILE::SWF
 			{
 				textField = new TextField();
+				textField.mouseEnabled = false;
 				$displayObjectContainer.addChild(textField);
 				textField.autoSize = TextFieldAutoSize.LEFT;
 				


[16/21] git commit: [flex-asjs] [refs/heads/tlf] - switch to using defaultPrevented

Posted by ah...@apache.org.
switch to using defaultPrevented


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

Branch: refs/heads/tlf
Commit: fd2304dbcfc6fbd56ac6f08418eb9f60acaa9119
Parents: 58bfcf8
Author: Alex Harui <ah...@apache.org>
Authored: Sun May 7 19:05:27 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:03 2017 -0700

----------------------------------------------------------------------
 .../textLayout/container/ContainerController.as | 22 ++++++++++----------
 .../apache/flex/textLayout/edit/EditManager.as  | 18 ++++++++--------
 .../flex/textLayout/edit/SelectionManager.as    |  6 +++---
 .../events/FlowElementMouseEventManager.as      |  4 ++--
 4 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd2304db/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
index bb223b7..74593c6 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
@@ -2103,7 +2103,7 @@ package org.apache.flex.textLayout.container
 		
 		public function mouseOverHandler(event:MouseEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 				interactionManager.mouseOverHandler(event);
 		}
 		
@@ -2126,7 +2126,7 @@ package org.apache.flex.textLayout.container
 		 */				
 		public function mouseOutHandler(event:MouseEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 				interactionManager.mouseOutHandler(event);
 		}
 		
@@ -2142,7 +2142,7 @@ package org.apache.flex.textLayout.container
 		 */
 		public function mouseWheelHandler(event:MouseEvent):void
 		{
-			if (event.isDefaultPrevented())
+			if (event.defaultPrevented)
 				return;
 			
 			// Do the scroll and call preventDefault only if the there is enough text to scroll. Otherwise
@@ -2177,7 +2177,7 @@ package org.apache.flex.textLayout.container
 		
 		public function mouseDownHandler(event:MouseEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 			{
 				interactionManager.mouseDownHandler(event);
 				// grab the focus - alternative is to listen to keyevents on the Application
@@ -2222,7 +2222,7 @@ package org.apache.flex.textLayout.container
 		 */
 		public function mouseUpHandler(event:MouseEvent):void
 		{
-			if (interactionManager && event && !event.isDefaultPrevented())
+			if (interactionManager && event && !event.defaultPrevented)
 			{
 				interactionManager.mouseUpHandler(event);
 			}
@@ -2340,7 +2340,7 @@ package org.apache.flex.textLayout.container
 		
 		public function mouseMoveHandler(event:MouseEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 			{
 //TODO fix this
 				// only autoscroll if we haven't hit something on the stage related to this particular TextFlow
@@ -2369,7 +2369,7 @@ package org.apache.flex.textLayout.container
 		 */
 		public function mouseDoubleClickHandler(event:MouseEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 			{
 				interactionManager.mouseDoubleClickHandler(event);
 				// grab the focus - alternative is to listen to keyevents on the Application
@@ -2571,7 +2571,7 @@ package org.apache.flex.textLayout.container
 		 */
 		public function keyDownHandler(event:KeyboardEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 				interactionManager.keyDownHandler(event);
 		}
 		
@@ -2589,7 +2589,7 @@ package org.apache.flex.textLayout.container
 		
 		public function keyUpHandler(event:KeyboardEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 				interactionManager.keyUpHandler(event);
 		}
 		
@@ -2622,7 +2622,7 @@ package org.apache.flex.textLayout.container
 		
 		public function textInputHandler(event:TextEvent):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 				interactionManager.textInputHandler(event);
 		}
 		
@@ -2710,7 +2710,7 @@ package org.apache.flex.textLayout.container
 		
 		public function editHandler(event:Event):void
 		{
-			if (interactionManager && !event.isDefaultPrevented())
+			if (interactionManager && !event.defaultPrevented)
 				interactionManager.editHandler(event);
 //TODO deal with context menus			
 			// re-enable context menu so following keyboard shortcuts will work

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd2304db/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/EditManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/EditManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/EditManager.as
index 2831b32..0ba8e55 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/EditManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/EditManager.as
@@ -237,7 +237,7 @@ package org.apache.flex.textLayout.edit
 		/** @private */
 		override public function editHandler(event:Event):void
 		{
-			if (event.isDefaultPrevented())
+			if (event.defaultPrevented)
 				return;
 
 			super.editHandler(event);
@@ -274,7 +274,7 @@ package org.apache.flex.textLayout.edit
 			var listItem:IListItemElement;
 			var operationState:SelectionState;
 			
-			if (!hasSelection() || event.isDefaultPrevented())
+			if (!hasSelection() || event.defaultPrevented)
 				return;
 			
 			if (redrawListener)		// pending redraw; handle this before anything else so TextLines on screen will be up to date
@@ -490,7 +490,7 @@ package org.apache.flex.textLayout.edit
 		/** @private */
 		public override function keyUpHandler(event:KeyboardEvent):void
 		{
-			if (!hasSelection() || event.isDefaultPrevented())
+			if (!hasSelection() || event.defaultPrevented)
 				return;
 				
 			super.keyUpHandler(event);
@@ -737,7 +737,7 @@ package org.apache.flex.textLayout.edit
 			{
 				opEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_BEGIN,false,true,op,captureLevel-1,null);
 				textFlow.dispatchEvent(opEvent);
-				if (opEvent.isDefaultPrevented())
+				if (opEvent.defaultPrevented)
 					return null;
 				// user may replace the operation - TODO: WHAT IF SWITCH TO UNDO/REDO????
 				op = opEvent.operation;
@@ -786,7 +786,7 @@ package org.apache.flex.textLayout.edit
 			{
 				opEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_END,false,true,op,captureLevel-1,opError);
 				textFlow.dispatchEvent(opEvent);
-				opError = opEvent.isDefaultPrevented() ? null : opEvent.error;
+				opError = opEvent.defaultPrevented ? null : opEvent.error;
 			}
 
 			if (opError)
@@ -949,7 +949,7 @@ package org.apache.flex.textLayout.edit
 				var undoPsuedoOp:UndoOperation = new UndoOperation(operation);
 				var opEvent:FlowOperationEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_BEGIN,false,true,undoPsuedoOp,0,null);
 				textFlow.dispatchEvent(opEvent);
-				if (opEvent.isDefaultPrevented())
+				if (opEvent.defaultPrevented)
 				{
 					//operation cancelled by user. Push the operation back onto the undo stack
 					undoManager.pushUndo(operation);
@@ -991,7 +991,7 @@ package org.apache.flex.textLayout.edit
 			{
 				opEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_END,false,true,undoPsuedoOp,0,opError);
 				textFlow.dispatchEvent(opEvent);
-				opError = opEvent.isDefaultPrevented() ? null : opEvent.error;
+				opError = opEvent.defaultPrevented ? null : opEvent.error;
 			}
 
 			if (opError)
@@ -1043,7 +1043,7 @@ package org.apache.flex.textLayout.edit
 				var redoPsuedoOp:RedoOperation = new RedoOperation(op);
 				opEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_BEGIN,false,true,redoPsuedoOp,0,null);
 				textFlow.dispatchEvent(opEvent);
-				if (opEvent.isDefaultPrevented() && _undoManager)
+				if (opEvent.defaultPrevented && _undoManager)
 				{
 					//user cancelled the event. Push the operation back onto the redo stack
 					_undoManager.pushRedo(op);
@@ -1085,7 +1085,7 @@ package org.apache.flex.textLayout.edit
 			{
 				opEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_END,false,true,redoPsuedoOp,0,opError);
 				textFlow.dispatchEvent(opEvent);
-				opError = opEvent.isDefaultPrevented() ? null : opEvent.error;
+				opError = opEvent.defaultPrevented ? null : opEvent.error;
 			}
 			if (opError)
 				throw (opError);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd2304db/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
index de9a73c..919f12c 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
@@ -2359,7 +2359,7 @@ package org.apache.flex.textLayout.edit
 		{
 			var opEvent:FlowOperationEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_BEGIN, false, true, op, 0, null);
 			textFlow.dispatchEvent(opEvent);
-			if (!opEvent.isDefaultPrevented())
+			if (!opEvent.defaultPrevented)
 			{
 				op = opEvent.operation;
 
@@ -2378,7 +2378,7 @@ package org.apache.flex.textLayout.edit
 				// operation completed - send event whether it succeeded or not.
 				opEvent = new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_END, false, true, op, 0, opError);
 				textFlow.dispatchEvent(opEvent);
-				opError = opEvent.isDefaultPrevented() ? null : opEvent.error;
+				opError = opEvent.defaultPrevented ? null : opEvent.error;
 				if (opError)
 					throw (opError);
 				textFlow.dispatchEvent(new FlowOperationEvent(FlowOperationEvent.FLOW_OPERATION_COMPLETE, false, false, op, 0, null));
@@ -2631,7 +2631,7 @@ package org.apache.flex.textLayout.edit
 		 */
 		public function keyDownHandler(event:KeyboardEvent):void
 		{
-			if (!hasSelection() || event.isDefaultPrevented())
+			if (!hasSelection() || event.defaultPrevented)
 				return;
 
 			// if (event.charCode == 0)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd2304db/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
index 0a993ee..ffa16e5 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
@@ -622,13 +622,13 @@ package org.apache.flex.textLayout.events
 			if (locallyListening)
 			{
 				_currentElement.getEventMirror().dispatchEvent(event);
-				if (event.isDefaultPrevented())
+				if (event.defaultPrevented)
 					return true;
 			}
 			if (textFlowListening)
 			{
 				textFlow.dispatchEvent(event);
-				if (event.isDefaultPrevented())
+				if (event.defaultPrevented)
 					return true;
 			}
 			return false;


[05/21] git commit: [flex-asjs] [refs/heads/tlf] - FocusEvent needs to subclass Event

Posted by ah...@apache.org.
FocusEvent needs to subclass Event


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

Branch: refs/heads/tlf
Commit: e290e6a6ced7a529bdc0a6fc95dae20bd3483967
Parents: 7ac185e
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 21:35:53 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:01 2017 -0700

----------------------------------------------------------------------
 .../flex/org/apache/flex/textLayout/events/FocusEvent.as  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e290e6a6/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FocusEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FocusEvent.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FocusEvent.as
index 45811c9..e269bd1 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FocusEvent.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FocusEvent.as
@@ -18,8 +18,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.textLayout.events {
 
-	public class FocusEvent {
+import org.apache.flex.events.Event;
 
+	public class FocusEvent extends Event
+	{
+
+		public function FocusEvent(type:String)
+		{
+			super(type);
+		}
+		
 		public static const FOCUS_IN:String = "focusIn";
 		public static const FOCUS_OUT:String = "focusOut";
 		public static const KEY_FOCUS_CHANGE:String = "keyFocusChange";


[20/21] git commit: [flex-asjs] [refs/heads/tlf] - timer doesn't always stop, so don't dispatch if interval is cleared

Posted by ah...@apache.org.
timer doesn't always stop, so don't dispatch if interval is cleared


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

Branch: refs/heads/tlf
Commit: 80a55bb8cc3d820b90c7859c54de886a056745de
Parents: c341287
Author: Alex Harui <ah...@apache.org>
Authored: Mon May 8 11:37:35 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:04 2017 -0700

----------------------------------------------------------------------
 .../projects/Core/src/main/flex/org/apache/flex/utils/Timer.as   | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80a55bb8/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as
index f16efb4..5372bdc 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as
@@ -158,6 +158,10 @@ public class Timer extends EventDispatcher
     
     private function timerHandler():void
     {
+		// sometimes an interval gets called after you clear it
+		if (timerInterval == -1)
+		    return;
+			
         _currentCount++;
         if (repeatCount > 0 && currentCount >= repeatCount) {
             stop();


[12/21] git commit: [flex-asjs] [refs/heads/tlf] - make TextLine actually do something on SWF side and report better sizes and errors for unimplemented things

Posted by ah...@apache.org.
make TextLine actually do something on SWF side and report better sizes and errors for unimplemented things


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

Branch: refs/heads/tlf
Commit: 6853279cd2a735c83ced4ae09c9b0a55df129b01
Parents: 70e2c0d
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 21:37:57 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:02 2017 -0700

----------------------------------------------------------------------
 .../org/apache/flex/text/engine/ITextLine.as    |   1 +
 .../flex/org/apache/flex/text/html/TextBlock.as |  48 +++++-
 .../flex/org/apache/flex/text/html/TextLine.as  | 146 ++++++++++++++++---
 3 files changed, 169 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6853279c/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as
index 17d93c8..c9f6b2a 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as
@@ -69,6 +69,7 @@ package org.apache.flex.text.engine
 		function getAtomTextRotation(atomIndex:int):String;
 		function getAtomWordBoundaryOnLeft(atomIndex:int):Boolean;
 		function getBaselinePosition(baseline:String):Number;
+		function getBounds(ref:Object):Rectangle;
 		
 
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6853279c/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
index 7c1faa6..088588a 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextBlock.as
@@ -60,7 +60,7 @@ package org.apache.flex.text.html
 		{
 			_baselineFontDescription = value;
 		}
-		private var _baselineFontSize:Number = 0;
+		private var _baselineFontSize:Number = 12;
 		public function get baselineFontSize():Number
 		{
 			return _baselineFontSize;
@@ -70,7 +70,7 @@ package org.apache.flex.text.html
 			_baselineFontSize = value;
 		}
 		
-		private var _baselineZero:String;
+		private var _baselineZero:String = "roman";
 		public function get baselineZero():String
 		{
 			return _baselineZero;
@@ -180,16 +180,42 @@ package org.apache.flex.text.html
 			_userData = value;
 		}
 		
+		private var lines:Array = [];
+		
 		public function createTextLine(previousLine:ITextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):ITextLine
 		{
+			if (previousLine == null)
+				lines.length = 0;
 			// Not a very good implementation at this point...
 			var textElem:TextElement = content as TextElement;
 			var format:ElementFormat = content.elementFormat;
-			var tl:TextLine = new TextLine();
-			var span:Span = new Span();
-			span.text = textElem.text;
-			tl.addElement(span);
-
+			var tl:TextLine = new TextLine(this, previousLine ? previousLine.textBlockBeginIndex + previousLine.rawTextLength : 0);
+			COMPILE::SWF
+			{
+				var s:String = content.text;
+				if (previousLine)
+				    s = s.substring(previousLine.textBlockBeginIndex + previousLine.rawTextLength);
+				if (s.length == 0)
+				  return null;
+				tl.textField.text = s;
+				tl.textField.width = width;
+				if (tl.textField.numLines > 1)
+				{
+					s = tl.textField.getLineText(0);
+					tl.textField.text = s;
+					tl.textField.multiline = false;
+				}
+				lines.push(tl);
+			}
+			COMPILE::JS
+			{
+				var span:Span = new Span();
+				span.text = textElem.text;
+				tl.addElement(span);
+			}
+			if (previousLine == null)
+				_firstLine = tl;
+			_lastLine = tl;
 			return tl;
 		}
 		public function dump():String{
@@ -197,26 +223,32 @@ package org.apache.flex.text.html
 		}
 		public function findNextAtomBoundary(afterCharIndex:int):int
 		{
+			trace("findNextAtomBoundary not implemented");
 			return 0;
 		}
 		public function findNextWordBoundary(afterCharIndex:int):int
 		{
+			trace("findNextWordBoundary not implemented");
 			return 0;
 		}
 		public function findPreviousAtomBoundary(beforeCharIndex:int):int
 		{
+			trace("findPreviousAtomBoundary not implemented");
 			return 0;
 		}
 		public function findPreviousWordBoundary(beforeCharIndex:int):int
 		{
+			trace("findPreviousWordBoundary not implemented");
 			return 0;
 		}
 		public function getTextLineAtCharIndex(charIndex:int):ITextLine
 		{
+			trace("getTextLineAtCharIndex not implemented");
 			return null;
 		}
 		public function recreateTextLine(textLine:ITextLine, previousLine:ITextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):ITextLine
 		{
+			trace("recreateTextLine not implemented");
 			return null;
 		}
 		public function releaseLineCreationData():void
@@ -225,7 +257,7 @@ package org.apache.flex.text.html
 		}
 		public function releaseLines(firstLine:ITextLine, lastLine:ITextLine):void
 		{
-			//TODO
+			lines.length = 0;
 		}
 
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6853279c/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
index a3eeaff..3087cd7 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
@@ -18,6 +18,15 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.text.html
 {
+	COMPILE::SWF
+	{
+		import flash.display.DisplayObject;
+		import flash.text.TextField;
+		import flash.text.TextFormat;
+		import flash.text.TextFieldAutoSize;
+	}
+	
+	import org.apache.flex.text.engine.ElementFormat;
 	import org.apache.flex.text.engine.ITextLine;
 	import org.apache.flex.text.engine.ITextBlock;
 	import org.apache.flex.core.IUIBase;
@@ -27,17 +36,54 @@ package org.apache.flex.text.html
 	
 	public class TextLine extends Div implements ITextLine
 	{
-		public function TextLine()
-		{
+		COMPILE::SWF
+		public var textField:TextField;
+		
+		public function TextLine(textBlock:ITextBlock, beginIndex:int)
+		{
+			COMPILE::SWF
+			{
+				textField = new TextField();
+				$displayObjectContainer.addChild(textField);
+				textField.autoSize = TextFieldAutoSize.LEFT;
+				
+				// use these to help calculate line breaks
+				textField.multiline = true;
+				textField.wordWrap = true;
+				
+				var textFormat:TextFormat = new TextFormat();
+				var ef:ElementFormat = textBlock.content.elementFormat;
+				textFormat.font = ef.fontDescription.fontName;
+				textFormat.size = ef.fontSize;
+				textFormat.color = ef.color;
+				textField.defaultTextFormat = textFormat;
+				
+			}
+			_textBlock = textBlock;
+			_beginIndex = beginIndex;
 		}
 		public function get ascent():Number
 		{
-			return 0;
+			COMPILE::SWF
+			{
+				return textField.getLineMetrics(0).ascent;
+			}
+			COMPILE::JS
+			{
+				return 0;
+			}
 		}
 		
 		public function get atomCount():int
 		{
-			return 0;
+			COMPILE::SWF
+			{
+				return textField.length;
+			}
+			COMPILE::JS
+			{
+				return 0;
+			}
 		}
 		
 		public function get blendMode():String
@@ -52,6 +98,10 @@ package org.apache.flex.text.html
 		
 		public function get descent():Number
 		{
+			COMPILE::SWF
+			{
+				return textField.getLineMetrics(0).descent;
+			}
 			return 0;
 		}
 		
@@ -93,7 +143,14 @@ package org.apache.flex.text.html
 		
 		public function get rawTextLength():int
 		{
-			return 0;
+			COMPILE::SWF
+			{
+				return textField.length;
+			}
+			COMPILE::JS
+			{
+				return 0;
+			}
 		}
 		
 		public function get specifiedWidth():Number
@@ -101,44 +158,61 @@ package org.apache.flex.text.html
 			return 0;
 		}
 		
+		private var _textBlock:ITextBlock;
+		
 		public function get textBlock():ITextBlock
 		{
-			return null;
+			return _textBlock;
 		}
 		
+		private var _beginIndex:int;
 		public function get textBlockBeginIndex():int
 		{
-			return 0;
+			return _beginIndex;
 		}
 		
 		public function get textHeight():Number
 		{
-			return 0;
+			COMPILE::SWF
+			{
+				return textField.textHeight;
+			}
+			COMPILE::JS
+			{
+				return 0;
+			}
 		}
 		
 		public function get textWidth():Number
 		{
-			return 0;
+			COMPILE::SWF
+			{
+				return textField.textWidth;
+			}
+			COMPILE::JS
+			{
+				return 0;
+			}
 		}
 		
 		public function get totalAscent():Number
 		{
-			return 0;
+			return ascent;
 		}
 		
 		public function get totalDescent():Number
 		{
-			return 0;
+			return descent;
 		}
 		
 		public function get totalHeight():Number
 		{
-			return 0;
+			return textHeight;
 		}
 		
 		public function get unjustifiedTextWidth():Number
 		{
-			return 0;
+			return textWidth;
 		}
 		
 		private var _userData:*;
@@ -151,7 +225,7 @@ package org.apache.flex.text.html
 			_userData = value;
 		}
 		
-		private var _validity:String;
+		private var _validity:String = "valid";
 		public function get validity():String
 		{
 			return _validity;
@@ -194,9 +268,34 @@ package org.apache.flex.text.html
 			return 0;
 		}
 
+		public function getBounds(ref:Object):Rectangle
+		{
+			COMPILE::SWF
+			{
+				return Rectangle.fromObject($displayObject.getBounds(ref as DisplayObject));
+			}
+			COMPILE::JS
+			{
+				return null;
+			}
+		}
+		
 		public function getAtomBounds(atomIndex:int):Rectangle
 		{
-			return null;
+			COMPILE::SWF
+			{
+				var r:Object = textField.getCharBoundaries(atomIndex);
+				if (r == null)
+				{
+					// not sure why we get null sometimes, but fake an answer
+					return new Rectangle(0, 1.2 - Number(textField.defaultTextFormat.size), 3, 1.2);
+				}
+				return Rectangle.fromObject(r);
+			}
+			COMPILE::JS
+			{
+				return null;
+			}
 		}
 
 		public function getAtomCenter(atomIndex:int):Number
@@ -214,35 +313,46 @@ package org.apache.flex.text.html
 		public function getAtomIndexAtCharIndex(charIndex:int):int
 		{
 			//TODO track indexes...
-			return 0;
+			return charIndex;
 		}
 
 		public function getAtomIndexAtPoint(stageX:Number, stageY:Number):int
 		{
-			//TODO atom locations. This one will be fun...
-			return 0;
+			COMPILE::SWF
+			{
+				return textField.getCharIndexAtPoint(stageX, stageY);
+			}
+			COMPILE::JS
+			{
+				//TODO atom locations. This one will be fun...
+				return 0;
+			}
 		}
 
 		public function getAtomTextBlockBeginIndex(atomIndex:int):int
 		{
+			trace("getAtomTextBlockBeginIndex not implemented");
 			//TODO track indexes...
 			return 0;
 		}
 
 		public function getAtomTextBlockEndIndex(atomIndex:int):int
 		{
+			trace("getAtomTextBlockEndIndex not implemented");
 			//TODO track indexes...
 			return 0;
 		}
 
 		public function getAtomTextRotation(atomIndex:int):String
 		{
+			trace("getAtomTextRotation not implemented");
 			//TODO returns TextRotation values.
 			return "rotate0";
 		}
 
 		public function getAtomWordBoundaryOnLeft(atomIndex:int):Boolean
 		{
+			trace("getAtomWordBoundaryOnLeft not implemented");
 			//TODO we need to track word boundaries
 			return false;
 		}


[17/21] git commit: [flex-asjs] [refs/heads/tlf] - hook up focus events

Posted by ah...@apache.org.
hook up focus events


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

Branch: refs/heads/tlf
Commit: 824e578eea60c974b5cf79aefb96bd101783b839
Parents: fd2304d
Author: Alex Harui <ah...@apache.org>
Authored: Mon May 8 11:05:59 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:03 2017 -0700

----------------------------------------------------------------------
 .../beads/DispatchTLFKeyboardEventBead.as          | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/824e578e/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
index 7abd04f..28daf46 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
@@ -89,6 +89,8 @@ package org.apache.flex.textLayout.beads
 			{
 				(_strand as Object).element.addEventListener('keydown', keyEventHandler);
 				(_strand as Object).element.addEventListener('keyup', keyEventHandler);
+				(_strand as Object).element.addEventListener('focus', focusEventHandler);
+				(_strand as Object).element.addEventListener('blur', focusEventHandler);
 			}
 		}
 		
@@ -207,6 +209,21 @@ package org.apache.flex.textLayout.beads
 				event.preventDefault();
 			}
 		}
+
+		/**
+		 * @private
+		 */
+		COMPILE::JS
+		protected function focusEventHandler(event:FocusEvent):void
+		{
+			event.stopImmediatePropagation();
+			var newEvent:org.apache.flex.textLayout.events.FocusEvent = new org.apache.flex.textLayout.events.FocusEvent(event.type == "focus" ? "focusIn" : "focusOut");
+			(_strand as IEventDispatcher).dispatchEvent(newEvent);
+			if(newEvent.defaultPrevented)
+			{
+				event.preventDefault();
+			}
+		}
 		
 	}
 }