Transferred from the Adobe Open Source Subversion Repository

Revision: 7952
Author:   cframpto@adobe.com
Date:     2009-06-18T09:57:23.131767Z

Log Message:
-----------
PARB changes for RichEditableText, TextArea and TextInput

RichEditableText, TextArea
--------------------------
content:Object setter only for use by MXML compiler
textFlow:TextFlow getter/setter added
scrollToPosition -> scrollToRange()
getSelectionFormat() -> getFormatOfRange(requestedFormats:Vector.<String> = null, anchorPosition=-1,                  activePosition=-1):TextLayoutFormat
    If either position is -1, the current selection will be used.
setSelectionFormat() -> setFormatOfRange(format:TextLayoutFormat, anchorPosition=-1, activePosition=-1):void
    If either position is -1, the current selection will be used.
export() removed

RichEditableText, TextBase
--------------------------
autoSize removed
widthInChars defaults to NaN
heightInLines defaults to NaN
    If both are NaN, and not in scroller, it will autoSize.
    If both are NaN, and in scroller, widthInChars effectively 15, heightInLines effectively 10.
    If widthInChars is NaN and heightInLines is not, widthInChars effectively 1.
    If heightInLines is NaN and widthInChars is not, heightInLines effectively 1.
selectionVisibility:String -> selectionHighlighting:String
TextSelectionVisibiliy.as -> TextSelectionHightlighting.as
setSelection -> selectRange(anchor, active) and the args are no longer optional
selectAll() added

TextBase
--------
TextBase.as -> SkinnableTextBase.as
it will not support any non-inheriting styles
textView skin part -> textDisplay
widthInChars property removed and moved to TextInput and TextArea

Styles
-------
Renamed style selectionColor -> focusedTextSelectionColor
Renamed style unfocusedSelectionColor -> unfocusedTextSelectionColor
Renamed inactiveSelectionColor -> inactiveTextSelectionColor

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/TextInputSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/SelectionFormatTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/TextAreaSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/defaults.css</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/TextBase.as" copyfrom-rev="7834" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/SkinnableTextBase.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextSelectionVisibility.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextInput.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/NumericStepper.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/TextBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/NumericStepperTextInputSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextArea.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextSelectionVisibility.as" copyfrom-rev="7834" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextSelectionHighlighting.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/supportClasses/RichEditableTextContainerManager.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1280127 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/RichEditableText.as
+++ frameworks/projects/spark/src/spark/components/RichEditableText.as
@@ -14,7 +14,6 @@

 import flash.events.Event;
 import flash.events.FocusEvent;
-import flash.events.IOErrorEvent;
 import flash.events.KeyboardEvent;
 import flash.geom.Matrix;
 import flash.geom.Rectangle;
@@ -30,9 +29,9 @@
 import flash.ui.Keyboard;

 import flashx.textLayout.compose.ITextLineCreator;
-import flashx.textLayout.container.ContainerController;
 import flashx.textLayout.container.TextContainerManager;
 import flashx.textLayout.conversion.ConversionType;
+import flashx.textLayout.conversion.ITextExporter;
 import flashx.textLayout.conversion.ITextImporter;
 import flashx.textLayout.conversion.TextFilter;
 import flashx.textLayout.edit.EditManager;
@@ -43,10 +42,7 @@
 import flashx.textLayout.edit.SelectionState;
 import flashx.textLayout.edit.TextScrap;
 import flashx.textLayout.elements.Configuration;
-import flashx.textLayout.elements.FlowElement;
 import flashx.textLayout.elements.InlineGraphicElementStatus;
-import flashx.textLayout.elements.ParagraphElement;
-import flashx.textLayout.elements.SpanElement;
 import flashx.textLayout.elements.TextFlow;
 import flashx.textLayout.events.CompositionCompletionEvent;
 import flashx.textLayout.events.DamageEvent;
@@ -66,7 +62,6 @@
 import flashx.textLayout.tlf_internal;
 import flashx.undo.IUndoManager;

-import mx.core.EmbeddedFont;
 import mx.core.IEmbeddedFontRegistry;
 import mx.core.IFlexModuleFactory;
 import mx.core.IIMESupport;
@@ -77,9 +72,10 @@
 import mx.events.FlexEvent;
 import mx.managers.ISystemManager;
 import mx.resources.ResourceManager;
+import mx.utils.ObjectUtil;
 import mx.utils.StringUtil;

-import spark.components.TextSelectionVisibility;
+import spark.components.TextSelectionHighlighting;
 import spark.core.CSSTextLayoutFormat;
 import spark.core.IViewport;
 import spark.core.NavigationUnit;
@@ -88,6 +84,7 @@
 import spark.utils.TextUtil;

 use namespace mx_internal;
+//use namespace tlf_internal;

 //--------------------------------------
 //  Events
@@ -197,8 +194,8 @@
  *  Displays text.
  *
  *
RichEditableText has more functionality than SimpleText and RichText. In
- *  addition to the text rendering capabilities of RichText, TextView also
- * supports hyperlinks, scrolling, selecting, and editing.

+ *  addition to the text rendering capabilities of RichText, RichEditableText
+ *  also  supports hyperlinks, scrolling, selecting, and editing.

  *
  *
The RichEditableText class is similar to the spark.components.TextArea
  *  control, except that it does not have chrome.

@@ -232,9 +229,28 @@

     /**
      *  @private
+     *  This method initializes the static vars of this class.
+     *  Rather than calling it at static initialization time,
+     *  we call it in the constructor to do the class initialization
+     *  when the first instance is created.
+     *  (It does an immediate return if it has already run.)
+     *  By doing so, we avoid any static initialization issues
+     *  related to whether this class or the TLF classes
+     *  that it uses are initialized first.
      */
     private static function initClass():void
     {
+        if (classInitialized)
+            return;
+
+        staticTextLayoutFormat = new TextLayoutFormat();
+        staticTextLayoutFormat.lineBreak = FormatValue.INHERIT;
+        staticTextLayoutFormat.paddingLeft = FormatValue.INHERIT;
+        staticTextLayoutFormat.paddingRight = FormatValue.INHERIT;
+        staticTextLayoutFormat.paddingTop = FormatValue.INHERIT;
+        staticTextLayoutFormat.paddingBottom = FormatValue.INHERIT;
+        staticTextLayoutFormat.verticalAlign = FormatValue.INHERIT;
+
     	// Create a single Configuration used by all TextContainerManager
     	// instances.  It tells the TextContainerManager that we don't want it
     	// to handle the ENTER key, because we need the ENTER key to behave
@@ -243,14 +259,21 @@
     		Configuration(TextContainerManager.defaultConfiguration).clone();
     	staticTextContainerManagerConfiguration.manageEnterKey = false;

-    	staticTextLayoutFormat = new TextLayoutFormat;
+        staticPlainTextImporter =
+            TextFilter.getImporter(TextFilter.PLAIN_TEXT_FORMAT);
+
+        // Throw import errors rather than return a null textFlow.
+        // Alternatively, the error strings are in the Vector, importer.errors.
+        staticPlainTextImporter.throwOnError = true;
+
+        staticPlainTextExporter =
+            TextFilter.getExporter(TextFilter.PLAIN_TEXT_FORMAT);
+
+        // Used for embedded fonts.
+    	staticTextFormat = new TextFormat();

-    	staticImportConfiguration = new Configuration();
-
-    	staticTextFormat = new TextFormat();
-    }
-
-    initClass();
+    	classInitialized = true;
+    }

     //--------------------------------------------------------------------------
     //
@@ -260,24 +283,35 @@

     /**
      *  @private
+     */
+    private static var classInitialized:Boolean = false;
+
+    /**
+     *  @private
 	 *  Used for telling TextContainerManager not to process the Enter key.
      */
     private static var staticTextContainerManagerConfiguration:Configuration;

     /**
      *  @private
-     *  Used for determining whitespace processing
-     *  when the 'content' property is set.
+     *  Used for determining whitespace processing when setting 'content'.
      */
     private static var staticTextLayoutFormat:TextLayoutFormat;

     /**
      *  @private
-     *  Used for determining whitespace processing
-     *  when the 'content' property is set.
-     */
-    private static var staticImportConfiguration:Configuration;
-
+     *  This TLF object is used to import a 'text' String
+     *  containing linebreaks to create a multiparagraph TextFlow.
+     */
+    private static var staticPlainTextImporter:ITextImporter;
+
+    /**
+     *  @private
+     *  This TLF object is used to export a TextFlow as plain 'text',
+     *  by walking the leaf FlowElements in the TextFlow.
+     */
+    private static var staticPlainTextExporter:ITextExporter;
+
     /**
      *  @private
      *  Used in getEmbeddedFontContext().
@@ -363,6 +397,11 @@
     {
         super();

+        initClass();
+
+        // Use the setter.
+        text = "";
+
         // Create the TLF TextContainerManager, using this component
         // as the DisplayObjectContainer for its TextLines.
         // This TextContainerManager instance persists for the lifetime
@@ -414,32 +453,26 @@

     /**
      *  @private
-     *  This object reports the TLF formats that correspond
-     *  to this component's CSS styles.
+     *  This object determines the default text formatting used
+     *  by this component, based on its CSS styles.
+     *  It is set to null by stylesInitialized() and styleChanged(),
+     *  and recreated whenever necessary in commitProperties().
      */
     private var hostFormat:ITextLayoutFormat;

     /**
      *  @private
-     *  This variable is initialize to true so that hostFormat
-     *  gets initialized the first time through commitProperties().
-     */
-    private var hostFormatChanged:Boolean = true;
-
-    /**
-     *  @private
-     */
-    private var fontMetricsInvalid:Boolean = false;
-
-    /**
-     *  @private
-     */
-    private var ascent:Number;
-
-    /**
-     *  @private
-     */
-    private var descent:Number;
+     *  It is set to NaN by stylesInitialized() and styleChanged(),
+     *  and recreated whenever necessary in calculateFontMetrics().
+     */
+    private var ascent:Number = NaN;
+
+    /**
+     *  @private
+     *  It is set to NaN by stylesInitialized() and styleChanged(),
+     *  and recreated whenever necessary in calculateFontMetrics().
+     */
+    private var descent:Number = NaN;

     /**
      *  @private
@@ -457,7 +490,7 @@
     /**
      *  @private
      */
-    private var textDamaged:Boolean = false;
+    mx_internal var ignoreDamageEvent:Boolean = false;

     /**
      *  @private
@@ -530,9 +563,6 @@
      */
     override public function get baselinePosition():Number
     {
-        // Update ascent, if fontMetrics changed.
-        calculateFontMetrics();
-
         return getStyle("paddingTop") + ascent;
     }

@@ -751,42 +781,6 @@
     //
     //--------------------------------------------------------------------------

-    //----------------------------------
-    //  autoSize
-    //----------------------------------
-
-    /**
-     *  @private
-     *  The default is true.
-     */
-    private var _autoSize:Boolean = true;
-
-    /**
-     *  Documentation is not currently available.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    public function get autoSize():Boolean
-    {
-        return _autoSize;
-    }
-
-    /**
-     *  @private
-     */
-    public function set autoSize(value:Boolean):void
-    {
-        if (value == _autoSize)
-            return;
-
-        _autoSize = value;
-
-        invalidateSize();
-        invalidateDisplayList();
-    }

     //----------------------------------
     //  content
@@ -820,36 +814,35 @@
     [RichTextContent]

     /**
-     *  Documentation is not currently available.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    public function get content():Object
-    {
-        return _content;
-    }
-
-    /**
-     *  @private
+     *  This write-only property is for internal use by the MXML compiler.
+     *  Please use the textFlow property to set
+     *  rich text content.
      */
     public function set content(value:Object):void
     {
+        // Treat setting the 'content' to null
+        // as if 'text' were being set to the empty String
+        // (which is the default state).
+        if (value == null)
+        {
+            text = "";
+            return;
+        }
+
         if (value == _content)
             return;
-
-        // Setting 'content' temporarily causes 'text' to become null.
-        // Later, after the 'content' has been committed into the TextFlow,
-        // getting 'text' will extract the text from the TextFlow.
-        _text = null;
-        textDamaged = true;
-        textChanged = false;
-
+
         _content = value;
         contentChanged = true;
-
+
+        // Of 'text', 'textFlow', and 'content', the last one set wins.
+        textChanged = false;
+        textFlowChanged = false;
+
+        // The other two are now invalid and must be recalculated when needed.
+        _text = null;
+        _textFlow = null;
+
         invalidateProperties();
         invalidateSize();
         invalidateDisplayList();
@@ -979,7 +972,7 @@
     /**
      *  @private
      */
-    private var _heightInLines:Number = 10;
+    private var _heightInLines:Number = NaN;

     /**
      *  @private
@@ -989,11 +982,11 @@
     /**
      *  The height of the control, in lines.
      *
-     *
TextView's measure() method does not determine the measured size from
-     *  the text to be displayed, because a TextView often starts out with no
-     *  text. Instead it uses this property, and the widthInChars property
-     *  to determine its measuredWidth and measuredHeight. These are
-     *  similar to the cols and rows of an HTML TextArea.

+     *
RichEditableText's measure() method does not determine the measured
+     *   size from the text to be displayed, because a RichEditableText often
+     *  starts out with no text. Instead it uses this property, and the
+     *  widthInChars property to determine its measuredWidth and measuredHeight.
+     *  These are similar to the cols and rows of an HTML TextArea.

      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -1016,6 +1009,7 @@
         _heightInLines = value;
         heightInLinesChanged = true;

+        invalidateProperties();
         invalidateSize();
         invalidateDisplayList();
     }
@@ -1090,7 +1084,7 @@
     private var _maxChars:int = 0;

     /**
-     *  The maximum number of characters that the TextView can contain,
+     *  The maximum number of characters that the RichEditableText can contain,
      *  as entered by a user.
      *  A script can insert more text than maxChars allows;
      *  the maxChars property indicates only how much text a user can enter.
@@ -1130,7 +1124,8 @@
      *  Determines whether the user can enter multiline text.
      *  If true, the Enter key starts a new paragraph.
      *  If false, the Enter key doesn't affect the text
-     *  but causes the TextView to dispatch an "enter" event.
+     *  but causes the RichEditableText to dispatch an "enter"
+     *  event.
      *
      *  @default true
      *
@@ -1290,18 +1285,18 @@
     }

     //----------------------------------
-    //  selectionVisibility
-    //----------------------------------
-
-    /**
-     *  @private
-     */
-    private var _selectionVisibility:String =
-        TextSelectionVisibility.WHEN_FOCUSED;
-
-    /**
-     *  @private
-     *  To indicate either selection visibility or selection styles have
+    //  selectionHighlighting
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _selectionHighlighting:String =
+        TextSelectionHighlighting.WHEN_FOCUSED;
+
+    /**
+     *  @private
+     *  To indicate either selection highlighting or selection styles have
      *  changed.
      */
     private var selectionFormatsChanged:Boolean = false;
@@ -1311,29 +1306,29 @@
      *
      *  Possible values are ALWAYS, WHEN_FOCUSED, and WHEN_ACTIVE.
      *
-     *  @see mx.components.TextSelectionVisibility
+     *  @see mx.components.TextSelectionHighlighting
      *
-     *  @default TextSelectionVisibility.WHEN_FOCUSED
+     *  @default TextSelectionHighlighting.WHEN_FOCUSED
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function get selectionVisibility():String
-    {
-        return _selectionVisibility;
-    }
-
-    /**
-     *  @private
-     */
-    public function set selectionVisibility(value:String):void
-    {
-        if (value == _selectionVisibility)
+    public function get selectionHighlighting():String
+    {
+        return _selectionHighlighting;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectionHighlighting(value:String):void
+    {
+        if (value == _selectionHighlighting)
             return;

-        _selectionVisibility = value;
+        _selectionHighlighting = value;
         selectionFormatsChanged = true;

         invalidateProperties();
@@ -1357,7 +1352,7 @@
     [Bindable("change")]

     /**
-     *  The text String displayed by this TextView.
+     *  The text String displayed by this RichEditableText.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -1366,55 +1361,62 @@
      */
     public function get text():String
     {
-        if (textDamaged && !displayAsPassword)
-        {
-            _text = _textContainerManager.getText("\n");
-            textDamaged = false;
-        }
-
+        // Extracting the plaintext from a TextFlow is somewhat expensive,
+        // as it involves iterating over the leaf FlowElements in the TextFlow.
+        // Therefore we do this extraction only when necessary, namely when
+        // you first set the 'content' or the 'textFlow'
+        // (or mutate the TextFlow), and then get the 'text'.
+        if (_text == null)
+        {
+            // If 'content' was last set,
+            // we have to first turn that into a TextFlow.
+            if (_content != null)
+                _textFlow = createTextFlowFromContent(_content);
+
+            // Once we have a TextFlow, we can export its plain text.
+            _text = staticPlainTextExporter.export(
+                _textFlow, ConversionType.STRING_TYPE) as String;
+            // Remove the trailing paragraph terminator.
+            _text = _text.substring(0, _text.length - 1);
+        }
+
         return _text;
     }

     /**
      *  @private
+     *  This will create a TextFlow with a single paragraph with a single span
+     *  with exactly the text specified.  If there is whitespace and line
+     *  breaks in the text, they will remain, regardless of the settings of
+     *  the lineBreak and whiteSpaceCollapse styles.
      */
     public function set text(value:String):void
-    {
-        // Text is never null.  null is converted to 0-length string.
+    {
+        // Treat setting the 'text' to null
+        // as if it were set to the empty String
+        // (which is the default state).
         if (value == null)
             value = "";
-
-        if (value == _text)
-            return;
-
-        // If we have focus, then we need to immediately create a TextFlow so
-        // the interaction manager will be created and editing/selection can
-        // be done without having to mouse click or mouse hover over this field.
-        // Normally this is done in our focusIn handler by making sure there
-        // is a selection.
-
-        // If the text has line-ending sequences such as LF or CR+LF,
-        // a TextFlow with multiple paragraph is produced as the 'content'.
-        // Otherwise all of the multi-line text got stuffed into one span in
-        // one paragraph. But when you have a large paragraph
-        // (i.e., a large TextBlock), FTE is slow to break the first
-        // TextLine because it analyzes all of the text first.
-        if (getFocus() == this || textHasLineBreaks(value))
-        {
-           content = importToFlow(value);
-           return;
-        }
-
-        // Setting 'text' temporarily causes 'content' to become null.
-        // Later, after the 'text' has been committed into the TextFlow,
-        // getting 'content' will return the TextFlow.
+
+        // Don't return early if value is the same as _text,
+        // because _text might have been produced from setting
+        // 'textFlow' or 'content'.
+        // For example, if you set a TextFlow corresponding to
+        // "Hello World"
+        // and then get the 'text', it will be the String "Hello World"
+        // But if you then set the 'text' to "Hello World"
+        // this represents a change: the "World" should no longer be red.
+
+        _text = value;
+        textChanged = true;
+
+        // Of 'text', 'textFlow', and 'content', the last one set wins.
+        textFlowChanged = false;
+        contentChanged = false;
+
+        // The other two are now invalid and must be recalculated when needed.
+        _textFlow = null;
         _content = null;
-        contentChanged = false;
-
-        _text = value;
-        textDamaged = false;
-
-        textChanged = true;

         invalidateProperties();
         invalidateSize();
@@ -1426,15 +1428,72 @@
     //----------------------------------

     /**
-     *  Documentation is not currently available.
+     *  @private
+     *  Storage for the textFlow property.
+     */
+    private var _textFlow:TextFlow;
+
+    /**
+     *  @private
+     */
+    private var textFlowChanged:Boolean = false;
+
+    /**
+     *  The TextFlow displayed by this component.
+     *
+     *
A TextFlow is the most important class
+     *  in the Text Layout Framework.
+     *  It is the root of a tree of FlowElements
+     *  representing rich text content.

+     *
+     *  @default
      */
     public function get textFlow():TextFlow
     {
-    	if (debug)
-    		trace("getTextFlow()");
-    	return _textContainerManager.getTextFlow();
-    }
-
+        // We might not have a valid _textFlow for two reasons:
+        // either because the 'text' was set (which is the state
+        // after construction) or because the 'content' was set.
+        if (!_textFlow)
+        {
+            if (_content != null)
+                _textFlow = createTextFlowFromContent(_content);
+            else
+                _textFlow = staticPlainTextImporter.importToFlow(_text);
+        }
+
+        return _textFlow;
+    }
+
+    public function set textFlow(value:TextFlow):void
+    {
+        // Treat setting the 'textFlow' to null
+        // as if 'text' were being set to the empty String
+        // (which is the default state).
+        if (value == null)
+        {
+            text = "";
+            return;
+        }
+
+        if (value == _textFlow)
+            return;
+
+        _textFlow = value;
+        textFlowChanged = true;
+
+        // Of 'text', 'textFlow', and 'content', the last one set wins.
+        textChanged = false;
+        contentChanged = false;
+
+        // The other two are now invalid and must be recalculated when needed.
+        _text = null
+        _content = null;
+
+        invalidateProperties();
+        invalidateSize();
+        invalidateDisplayList();
+    }
+
     //----------------------------------
     //  widthInChars
     //----------------------------------
@@ -1443,7 +1502,7 @@
      *  @private
      *  These are measured in ems.
      */
-    private var _widthInChars:Number = 15;
+    private var _widthInChars:Number = NaN;

     /**
      *  @private
@@ -1494,8 +1553,8 @@
     override protected function commitProperties():void
     {
         super.commitProperties();
-
-        if (hostFormatChanged)
+
+        if (!hostFormat)
         {
 	        // If the CSS styles for this component specify an embedded font,
 	        // embeddedFontContext will be set to the module factory that
@@ -1513,8 +1572,6 @@
         		// the fontLookup format is set to either
         		// "device" or "embedded" depending on whether
         		// embeddedFontContext is null or non-null.
-
-            hostFormatChanged = false;
         }

         if (selectionFormatsChanged)
@@ -1526,6 +1583,12 @@
         	selectionFormatsChanged = false;
         }

+        // If fontMetrics changed, recalculate the ascent, and descent.
+        if (isNaN(ascent) || isNaN(descent))
+            calculateFontMetrics();
+
+        // EditingMode needs to be current before attempting to set a
+        // selection below.
         if (enabledChanged || selectableChanged || editableChanged)
         {
             updateEditingMode();
@@ -1534,55 +1597,86 @@
             editableChanged = false;
             selectableChanged = false;
         }
+
+        // Only one of textChanged, textFlowChanged, and contentChanged
+        // will be true; the other two will be false because each setter
+        // guarantees this.
+
+        if (textChanged)
+        {
+            // If the text has linebreaks (CR, LF, or CF+LF)
+            // create a multi-paragraph TextFlow from it
+            // and use the TextFlowTextLineFactory to render it.
+            // Otherwise the StringTextLineFactory will put
+            // all of the lines into a single paragraph
+            // and FTE performance will degrade on a large paragraph.
+
+            // If we have focus, then we need to immediately create a
+            // TextFlow sothe interaction manager will be created and
+            // editing/selection can be done without having to mouse click
+            // or mouse hover over this field.  Normally this is done in our
+            // focusIn handler by making sure there is a selection.  Test this
+            // by clicking an arrow in the NumericStepper and then entering
+            // a number without clicking on the input field first.

-        if (textChanged)
-        {
-        	if (debug)
-        		trace("setText()");
-
-            _textContainerManager.setText(_text);
-
+            if (_text.indexOf("\n") != -1 || _text.indexOf("\r") != -1 ||
+                getFocus() == this)
+            {
+                _textFlow = staticPlainTextImporter.importToFlow(_text);
+                _textContainerManager.setTextFlow(_textFlow);
+            }
+            else
+            {
+                _textContainerManager.setText(_text);
+            }
+        }
+        else if (textFlowChanged)
+        {
+            _textContainerManager.setTextFlow(_textFlow);
+        }
+        else if (contentChanged)
+        {
+            _textFlow = createTextFlowFromContent(_content);
+            _textContainerManager.setTextFlow(_textFlow);
+
+            // Content converted to textFlow.
+            _content = null;
+        }
+
+        if (textChanged || textFlowChanged || contentChanged)
+        {
             dispatchChangeEvent = true;
+
+            // If the text, textFlow or content changed, there is no selection.
+            // If we already have focus, set the selection, since we've
+            // already  executed our focusIn handler where this is normally
+            // done.
+            if (getFocus() == this)
+                setSelectionBasedOnScrolling();
+
+            // Handle the case where the initial text, textFlow or content
+            // is displayed as a password.
+            if (displayAsPassword)
+                displayAsPasswordChanged = true;

             textChanged = false;
-        }
-        else if (contentChanged)
-        {
-        	var textFlow:TextFlow = createTextFlowFromContent();
-
-        	if (debug)
-        		trace("setTextFlow()");
-        	_textContainerManager.setTextFlow(textFlow);
-
-            dispatchChangeEvent = true;
-
-            contentChanged = false;
-        }
-
-        // Text or content changed.
-        if (dispatchChangeEvent)
-        {
-            // Handle case where content is intially displayed as password.
-            if (displayAsPassword)
-               displayAsPasswordChanged = true;
-
-            // If the text or content changed, there is no selection.  If we
-            // already have focus, set the selection, since we've already
-            // executed our focusIn handler where this is normally done.
-            if (editingMode != EditingMode.READ_ONLY && getFocus() == this)
-                setSelectionBasedOnScrolling();
-        }
-
+            textFlowChanged = false;
+            contentChanged = false;
+        }
+
         // If displayAsPassword changed, it only applies to the display,
-        // not the underlying text.  Do not mark the textFlow as changed.
+        // not the underlying text.
         if (displayAsPasswordChanged)
         {
+            var oldAnchorPosition:int = _selectionAnchorPosition;
+            var oldActivePosition:int = _selectionActivePosition;
+
             // If there is any text, convert it to the passwordChar.
             if (displayAsPassword)
             {
                 // Make sure _text is set with the actual text before we
                 // change the displayed text.
-                _text = _textContainerManager.getText("\n");
+                _text = text;

                 // ToDo: if content, should the paragraph terminators be
                 // left in the string so the displayAsPassword string has the
@@ -1595,14 +1689,19 @@
             }
             else
             {
-                // Was displayAsPassword.  Now display as plain text.
+                // Text was displayed as password.  Now display as plain text.
                 _textContainerManager.setText(_text);
             }
-
-            textDamaged = false;
+
+            // Must preserve the selection, if there was one.
+            selectRange(oldAnchorPosition, oldActivePosition);
+
             displayAsPasswordChanged = false;
         }

+        if (heightInLinesChanged || widthInCharsChanged ||
+            clipAndEnableScrollingChanged)
+
         if (clipAndEnableScrollingChanged)
         {
             // Not sure if there is any real difference between on and auto.
@@ -1619,6 +1718,7 @@
             }
             clipAndEnableScrollingChanged = false;
         }
+

         if (horizontalScrollPositionChanged)
         {
@@ -1723,19 +1823,25 @@
             actuallyAutoSizing = false;
             return true;
         }
-
-        var oldActuallyAutoSizing:Boolean = actuallyAutoSizing;
-
-        // AutoSize if it is requested and this component isn't the viewport
-        // of a scroller.  autoSize and scrolling don't play well together.
-        actuallyAutoSizing = _autoSize && !_clipAndEnableScrolling;
-
-        // If we're autoSizing now, make sure we aren't scrolled from previously
-        // not being autoSized.
-        if (actuallyAutoSizing && !oldActuallyAutoSizing)
-        {
-            _textContainerManager.horizontalScrollPosition = 0;
-            _textContainerManager.verticalScrollPosition = 0;
+
+        // ToDo: consider moving to commitProperties()
+        if (isNaN(widthInChars) && isNaN(heightInLines))
+        {
+            // Can only autoSize if this component isn't the viewport
+            // of a scroller.  autoSize and scrolling don't play well together.
+            actuallyAutoSizing = !_clipAndEnableScrolling;
+
+            // If we're autoSizing, make sure we aren't scrolled from
+            // previously not being autoSized.
+            if (actuallyAutoSizing)
+            {
+                _textContainerManager.horizontalScrollPosition = 0;
+                _textContainerManager.verticalScrollPosition = 0;
+            }
+        }
+        else
+        {
+            actuallyAutoSizing = false;
         }

         return false;
@@ -1748,9 +1854,6 @@
     {
         super.measure();

-        // Recalculate the ascent, and descent, if fontMetrics changed.
-        calculateFontMetrics();
-
         if (actuallyAutoSizing)
         {
             measureForAutoSize();
@@ -1807,9 +1910,10 @@
     override public function stylesInitialized():void
     {
         super.stylesInitialized();
-
-        fontMetricsInvalid = true;
-        hostFormatChanged = true;
+
+        ascent = NaN;
+        descent = NaN;
+        hostFormat = null;
     }

     /**
@@ -1827,31 +1931,31 @@
         if (styleProp == null || styleProp == "styleName" ||
             styleProp == "fontFamily" || styleProp == "fontSize")
         {
-            fontMetricsInvalid = true;
-        }
-
-        // If null or "styleName" is passed, indicating that
-        // multiple styles may have changed, set a flag indicating
-        // that hostContainerFormat, hostParagraphFormat,
-        // and hostCharacterFormat need to be recalculated later.
-        // But if a single style has changed, update the corresponding
-        // property in either hostContainerFormat, hostParagraphFormat,
-        // or hostCharacterFormat immediately.
+            ascent = NaN;
+            descent = NaN;
+        }
+
+        // If null or "styleName" is passed it indicates that
+        // multiple styles may have changed.  Otherwise it is a single style
+        // so mark whether it is the selectionFormat that changed or the
+        // hostFormat that changed.
         if (styleProp == null || styleProp == "styleName")
         {
-            hostFormatChanged = true;
+            hostFormat = null;
             selectionFormatsChanged = true;
         }
-        else if (isSelectionFormat(styleProp))
+        else if (styleProp == "focusedTextSelectionColor" ||
+                 styleProp == "unfocusedTextSelectionColor" ||
+                 styleProp == "inactiveTextSelectionColor")
         {
             selectionFormatsChanged = true;
         }
         else
         {
-            hostFormatChanged = true;
-        }
-
-        // Need to regenerate text flow.
+            hostFormat = null;
+        }
+
+        // Need to create new format(s).
         invalidateProperties();
     }

@@ -2084,28 +2188,40 @@

     /**
      *  @private
+     *  When this is called the component has focus.
      */
     private function setSelectionBasedOnScrolling(always:Boolean=true):void
     {
+        // No selection if read-only.
+        if (editingMode == EditingMode.READ_ONLY)
+            return;
+
+        var selectionManager:ISelectionManager = getSelectionManager();
+
         // Only set the selection if there isn't already one.
-        if (!always)
-        {
-            var done:Boolean = false;
-            var sm:ISelectionManager = getSelectionManager();
-            if (sm.hasSelection())
-                done = true;
+        if (!always && selectionManager.hasSelection())
+        {
             releaseSelectionManager();
-
-            if (done)
-                return;
-        }
-
+            return;
+        }
+
         // If scrolling, the selection/insertion point is at the begining.
         // Othewise, it is at the end.
-        if (_clipAndEnableScrolling)
-            setSelection(0, 0);
-        else
-            setSelection(int.MAX_VALUE, int.MAX_VALUE);
+        var position:int = _clipAndEnableScrolling ? 0 : int.MAX_VALUE;
+
+        selectionManager.setSelection(position, position);
+
+        // This should not be necessary but it is if the text is changed after
+        // the component already has focus.  The initial selectionFormatState
+        // is SelectionFormatState.UNFOCUSED.
+        if (!selectionManager.focused)
+            selectionManager.setFocus();
+
+        // Refresh the selection.  This does not cause a damage event.
+        selectionManager.refreshSelection();
+
+        releaseSelectionManager();
+
     }

     /**
@@ -2189,9 +2305,6 @@
      */
     private function calculateFontMetrics():void
     {
-        if (!fontMetricsInvalid)
-            return;
-
         // If the CSS styles for this component specify an embedded font,
         // embeddedFontContext will be set to the module factory that
         // should create TextLines (since they must be created in the
@@ -2250,8 +2363,6 @@

         ascent = textLine.ascent;
         descent = textLine.descent;
-
-        fontMetricsInvalid = false;
     }

     /**
@@ -2260,11 +2371,20 @@
     private function calculateWidthInChars():Number
     {
     	var em:Number = getStyle("fontSize");
-
+
+        var effectiveWidthInChars:int;
+
+        // If both height and width are NaN but there is a scroller, can't
+        // autoSize so use 15 chars.  Otherwise if only width is NaN, use 1.
+    	if (isNaN(_widthInChars))
+    	   effectiveWidthInChars = isNaN(_heightInLines) ? 15 : 1;
+    	else
+    	   effectiveWidthInChars = _widthInChars;
+
     	// Without the explicit casts, if padding values are non-zero, the
     	// returned width is a very large number.
     	return getStyle("paddingLeft") +
-    		   widthInChars * em +
+    		   effectiveWidthInChars * em +
     		   getStyle("paddingRight");
     }

@@ -2276,10 +2396,19 @@
     private function calculateHeightInLines():Number
     {
         var height:Number = getStyle("paddingTop") + getStyle("paddingBottom");
-
-        if (heightInLines == 0)
+
+        if (_heightInLines == 0)
             return height;
-
+
+        var effectiveHeightInLines:int;
+
+        // If both height and width are NaN but there is a scroller, can't
+        // autoSize so use 10 lines.  Otherwise if only height is NaN, use 1.
+        if (isNaN(_heightInLines))
+            effectiveHeightInLines = isNaN(_widthInChars) ? 10 : 1;
+        else
+            effectiveHeightInLines = _heightInLines;
+
         // Position of the baseline of first line in the container.
         value = getStyle("firstBaselineOffset");
         if (value == lineHeight)
@@ -2291,7 +2420,7 @@

         // Distance from baseline to baseline.  Can be +/- number or
         // or +/- percent (in form "120%") or "undefined".
-        if (heightInLines > 1)
+        if (effectiveHeightInLines > 1)
         {
             var value:Object = getStyle("lineHeight");
             var lineHeight:Number =
@@ -2301,7 +2430,7 @@
             if (isNaN(lineHeight))
                 lineHeight = getStyle("fontSize") * 1.2;

-            height += (heightInLines - 1) * lineHeight;
+            height += (effectiveHeightInLines - 1) * lineHeight;
         }

         // Add in descent of last line.
@@ -2310,197 +2439,27 @@
         return height;
     }

-    /**
-     *  @private
-     */
-    private function createEmptyTextFlow():TextFlow
-    {
-        var textFlow:TextFlow = new TextFlow();
-        var p:ParagraphElement = new ParagraphElement();
-        var span:SpanElement = new SpanElement();
-        textFlow.replaceChildren(0, 0, p);
-        p.replaceChildren(0, 0, span);
-        return textFlow;
-    }
-
-    /**
-     *  @private
-     */
-    private function createTextFlowFromMarkup(markup:Object):TextFlow
-    {
-        // The whiteSpaceCollapse format determines how whitespace
-        // is processed when markup is imported.
-        staticTextLayoutFormat.lineBreak = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingLeft = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingRight = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingTop = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingBottom = FormatValue.INHERIT;
-        staticTextLayoutFormat.verticalAlign = FormatValue.INHERIT;
-        staticTextLayoutFormat.whiteSpaceCollapse =
-            getStyle("whiteSpaceCollapse");
-        staticImportConfiguration.textFlowInitialFormat =
-            staticTextLayoutFormat;
-
-        if (markup is XML || markup is String)
-        {
-            // We need to wrap the markup in a <TextFlow> tag
-            // unless it already has one.
-            // Note that we avoid trying to convert it to XML
-            // (in order to test whether the outer tag is <TextFlow>)
-            // unless it contains the substring "TextFlow".
-            // And if we have to do the conversion, then
-            // we use the markup in XML form rather than
-            // having TLF reconvert it to XML.
-            var wrap:Boolean = true;
-            if (markup is XML || markup.indexOf("TextFlow") != -1)
-            {
-                try
-                {
-                    var xmlMarkup:XML = XML(markup);
-                    if (xmlMarkup.localName() == "TextFlow")
-                    {
-                        wrap = false;
-                        markup = xmlMarkup;
-                    }
-                }
-                catch(e:Error)
-                {
-                }
-            }
-
-            if (wrap)
-            {
-                if (markup is String)
-                {
-                    markup =
-                        '<TextFlow xmlns="http://ns.adobe.com/textLayout/2008">' +
-                        markup +
-                        '</TextFlow>';
-                }
-                else
-                {
-                    // It is XML.  Create a root element and add the markup
-                    // as it's child.
-                    var ns:Namespace =
-                        new Namespace("http://ns.adobe.com/textLayout/2008");
-
-                    xmlMarkup = <TextFlow />;
-                    xmlMarkup.setNamespace(ns);
-                    xmlMarkup.setChildren(markup);
-
-                    // The namespace of the root node is not inherited by
-                    // the children so it needs to be explicitly set on
-                    // every element, at every level.  If this is not done
-                    // the import will fail with an "Unexpected namespace"
-                    // error.
-                    for each (var element:XML in xmlMarkup..*::*)
-                       element.setNamespace(ns);
-
-                    markup = xmlMarkup;
-                }
-            }
-        }
-
-        return importToFlow(markup, TextFilter.TEXT_LAYOUT_FORMAT,
-                            staticImportConfiguration);
-    }
-
-    /**
-     *  @private
-     */
-    private function createTextFlowFromChildren(children:Array):TextFlow
+
+    /**
+     *  @private
+     */
+    private function createTextFlowFromContent(content:Object):TextFlow
     {
         var textFlow:TextFlow = new TextFlow();

         // The whiteSpaceCollapse format determines how whitespace
         // is processed when the children are set.
-        staticTextLayoutFormat.lineBreak = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingLeft = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingRight = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingTop = FormatValue.INHERIT;
-        staticTextLayoutFormat.paddingBottom = FormatValue.INHERIT;
-        staticTextLayoutFormat.verticalAlign = FormatValue.INHERIT;
         staticTextLayoutFormat.whiteSpaceCollapse =
             getStyle("whiteSpaceCollapse");
         textFlow.hostFormat = staticTextLayoutFormat;

-        textFlow.mxmlChildren = children;
+        textFlow.mxmlChildren = content is Array ?
+                                content as Array :
+                                [ content ];

         return textFlow;
     }
-
-    /**
-     *  @private
-     */
-    private function createTextFlowFromContent():TextFlow
-    {
-    	var textFlow:TextFlow;
-
-        if (_content is TextFlow)
-        {
-            textFlow = TextFlow(_content);
-        }
-        else if (_content is Array)
-        {
-            textFlow = createTextFlowFromChildren(_content as Array);
-        }
-        else if (_content is FlowElement)
-        {
-            textFlow = createTextFlowFromChildren([ _content ]);
-        }
-        else if (_content is String || _content is XML)
-        {
-            textFlow = createTextFlowFromMarkup(_content);
-        }
-        else if (_content == null)
-        {
-            textFlow = createEmptyTextFlow();
-        }
-        else
-        {
-            textFlow = createTextFlowFromMarkup(_content.toString());
-        }
-
-        return textFlow;
-    }
-
-    /**
-     *  @private
-     *  This will throw on import error.
-     */
-    private function importToFlow(source:Object,
-                                  format:String = TextFilter.PLAIN_TEXT_FORMAT,
-                                  config:Configuration = null):TextFlow
-    {
-        var importer:ITextImporter = TextFilter.getImporter(format, config);
-
-        // Throw import errors rather than return a null textFlow.
-        // Alternatively, the error strings are in the Vector, importer.errors.
-        importer.throwOnError = true;
-
-        return importer.importToFlow(source);
-    }
-
-    /**
-     *  @private
-     */
-    private function textHasLineBreaks(s:String):Boolean
-    {
-        return s.indexOf("\n") != -1 || s.indexOf("\r") != -1;
-    }
-
-    /**
-     *  @private
-     *  Is this a style associated with the SelectionFormat?
-     */
-    private function isSelectionFormat(styleProp:String):Boolean
-    {
-        return styleProp &&
-               (styleProp == "selectionColor" ||
-                styleProp == "unfocusedSelectionColor" ||
-                styleProp == "inactiveSelectionColor");
-    }
-
+
     /**
      *  @private
      */
@@ -2520,17 +2479,33 @@
     }

     /**
-     *  Sets the selection range.  By default, the entire range is selected.
-     *  If you pass negative numbers for the position, it will deselect.
+     *  Selects the entire text range.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function setSelection(anchorPosition:int = 0,
-                                 activePosition:int = int.MAX_VALUE):void
-    {
+    public function selectAll():void
+    {
+        selectRange(0, int.MAX_VALUE);
+    }
+
+    /**
+     *  Sets the selection range.  If either position is negative, it will
+     *  deselect the text range.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function selectRange(anchorPosition:int,
+                                activePosition:int):void
+    {
+        // Make sure all properties are committed before doing the operation.
+        validateNow();
+
 		var selectionManager:ISelectionManager = getSelectionManager();

         selectionManager.setSelection(anchorPosition, activePosition);
@@ -2549,11 +2524,14 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function scrollToPosition(anchorPosition:int = 0,
-                                     activePosition:int = int.MAX_VALUE):void
-    {
-       // Scrolls so that the text position is visible in the container.
-       textContainerManager.scrollToPosition(anchorPosition, activePosition);
+    public function scrollToRange(anchorPosition:int = 0,
+                                  activePosition:int = int.MAX_VALUE):void
+    {
+        // Make sure all properties are committed before doing the operation.
+        validateNow();
+
+        // Scrolls so that the text position is visible in the container.
+        textContainerManager.scrollToPosition(anchorPosition, activePosition);
     }

     /**
@@ -2591,9 +2569,9 @@
     }

     /**
-     *  Appends the specified text to the end of the TextView,
+     *  Appends the specified text to the end of the RichEditableText,
      *  as if you had clicked at the end and typed it.
-     *  When TextView supports vertical scrolling,
+     *  When RichEditableText supports vertical scrolling,
      *  it will scroll to ensure that the last line
      *  of the inserted text is visible.
      *
@@ -2624,46 +2602,33 @@
     }

     /**
-     *  Returns a String containing markup describing
-     *  this TextView's TextFlow.
-     *  This markup String has the appropriate format
-     *  for setting the content property.
+     *  Returns a TextLayoutFormat object with the requestedFormats set
+     *  for the specified range.
+     *  If an attribute is not consistently set across the entire range,
+     *  its value will be undefined.
+     *  You can specify an Array containing names of the formats attributes
+     *  that you want returned; if you don't, all formats attributes will be
+     *   returned.  If you don't specify a range, the selected range is used.
+     *  For example, calling
+     *  getFormatOfRange()
+     *  might return ({ fontSize: 12, color: null })
+     *  if the selection is uniformly 12-point but has multiple colors.
+     *  The supported formats are those in TextLayoutFormat.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function export():XML
-    {
-        return XML(TextFilter.export(textFlow, TextFilter.TEXT_LAYOUT_FORMAT,
-                                     ConversionType.XML_TYPE));
-    }
-
-    /**
-     *  Returns an Object containing name/value pairs of text attributes
-     *  for the specified range.
-     *  If an attribute is not consistently set across the entire range,
-     *  its value will be null.
-     *  You can specify an Array containing names of the attributes
-     *  that you want returned; if you don't, all attributes will be returned.
-     *  If you don't specify a range, the selected range is used.
-     *  For example, calling
-     *  getSelectionFormat()
-     *  might return ({ fontSize: 12, color: null })
-     *  if the selection is uniformly 12-point but has multiple colors.
-     *  The supported attributes are those in the
-     *  ICharacterAttributes and IParagraphAttributes interfaces.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    public function getSelectionFormat(names:Array = null):Object
-    {
-        var format:Object = {};
-
+    public function getFormatOfRange(requestedFormats:Vector.<String>=null,
+                                     anchorPosition:int=-1,
+                                     activePosition:int=-1):TextLayoutFormat
+    {
+        var format:TextLayoutFormat = new TextLayoutFormat();
+
+         // Make sure all properties are committed before doing the operation.
+        validateNow();
+
         var selectionManager:ISelectionManager = getSelectionManager();

         // This internal TLF object maps the names of format properties
@@ -2682,11 +2647,11 @@
         var needParagraphFormat:Boolean = false;
         var needCharacterFormat:Boolean = false;

-        if (!names)
-        {
-            names = [];
+        if (!requestedFormats)
+        {
+            requestedFormats = new Vector.<String>;
             for (p in description)
-                names.push(p);
+                requestedFormats.push(p);

             needContainerFormat = true;
             needParagraphFormat = true;
@@ -2694,7 +2659,7 @@
         }
         else
         {
-            for each (p in names)
+            for each (p in requestedFormats)
             {
                 if (!(p in description))
                     continue;
@@ -2716,6 +2681,20 @@
         var paragraphFormat:ITextLayoutFormat;
         var characterFormat:ITextLayoutFormat;

+        // Unfortunatley getCommonContainerFormat() works only on the curent
+        // selection, so if another selection is requested, we have to
+        // temporarily change the current selection and then restore it when
+        // we are done.
+        var oldAnchorPosition:int;
+        var oldActivePosition:int;
+        if (anchorPosition != -1 && activePosition != -1)
+        {
+            oldAnchorPosition = _selectionAnchorPosition;
+            oldActivePosition = _selectionActivePosition;
+
+            selectionManager.setSelection(anchorPosition, activePosition);
+        }
+
         if (needContainerFormat)
             containerFormat = selectionManager.getCommonContainerFormat();

@@ -2725,8 +2704,13 @@
         if (needCharacterFormat)
             characterFormat = selectionManager.getCommonCharacterFormat();

+        if (anchorPosition != -1 && activePosition != -1)
+        {
+            selectionManager.setSelection(oldAnchorPosition, oldActivePosition);
+        }
+
         // Extract the requested formats to return.
-        for each (p in names)
+        for each (p in requestedFormats)
         {
             if (!(p in description))
                 continue;
@@ -2743,28 +2727,34 @@

         // All done with the selection manager.
         releaseSelectionManager();
-
+
         return format;
     }

     /**
-     *  Applies a set of name/value pairs of text attributes
-     *  to the specified range.
-     *  A value of null does not get applied.
+     *  Applies the text format to the specified range.
+     *  A value of undefined does not get applied.
      *  If you don't specify a range, the selected range is used.
      *  For example, calling
-     *  setSelectionFormat({ fontSize: 12, color: 0xFF0000 })
+     *  var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
+     *  textLayoutFormat.fontSize = 12;
+     *  textLayoutFormat.color;
+     *  setFormatOfRange(textLayoutFormat);
      *  will set the fontSize and color of the selection.
-     *  The supported attributes are those in the
-     *  ICharacterFormat and IParagraphFormat interfaces.
+     *  The supported format attributes are those in TextFormatLayout.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function setSelectionFormat(attributes:Object):void
-    {
+    public function setFormatOfRange(format:TextLayoutFormat,
+                                     anchorPosition:int=-1,
+                                     activePosition:int=-1):void
+    {
+         // Make sure all properties are committed before doing the operation.
+        validateNow();
+
         var editManager:IEditManager = getEditManager();

         // Assign each specified attribute to one of three format objects,
@@ -2780,36 +2770,43 @@
         // whether it is container-, paragraph-, or character-level.
         var description:Object = TextLayoutFormat.tlf_internal::description;

-        for (var p:String in attributes)
-        {
-            if (!(p in description))
+        for (var p:String in description)
+        {
+            if (format[p] === undefined)
                 continue;
-
+
             var category:String = description[p].category;

             if (category == Category.CONTAINER)
             {
                 if (!containerFormat)
                    containerFormat =  new TextLayoutFormat();
-                containerFormat[p] = attributes[p];
+                containerFormat[p] = format[p];
             }
             else if (category == Category.PARAGRAPH)
             {
                 if (!paragraphFormat)
                    paragraphFormat =  new TextLayoutFormat();
-                paragraphFormat[p] = attributes[p];
+                paragraphFormat[p] = format[p];
             }
             else if (category == Category.CHARACTER)
             {
                 if (!characterFormat)
                    characterFormat =  new TextLayoutFormat();
-                characterFormat[p] = attributes[p];
+                characterFormat[p] = format[p];
             }
         }
-
-        // Apply the three format objects to the current selection.
+
+        var selectionState:SelectionState =
+            anchorPosition == -1 || activePosition == -1 ? null :
+            new SelectionState(editManager.textFlow,
+                               anchorPosition,
+                               activePosition);
+
+        // Apply the three format objects to the current selection if
+        // selectionState is null, else the specified selection.
         editManager.applyFormat(
-        	characterFormat, paragraphFormat, containerFormat);
+        	characterFormat, paragraphFormat, containerFormat, selectionState);

         // All done with the edit manager.
         releaseEditManager();
@@ -2837,16 +2834,17 @@
         // DeleteTextOperation or the InsertTextOperation which are also part
         // of the paste.
         dispatchChangingEvent = false;
-
+
         var selectionState:SelectionState = new SelectionState(
-        	textFlow, op.absoluteStart, op.absoluteStart + pastedText.length);
+        	op.textFlow, op.absoluteStart,
+        	op.absoluteStart + pastedText.length);
         editManager.deleteText(selectionState);

         // Insert the same text, the same place where the paste was done.
         // This will go thru the InsertPasteOperation and do the right
         // things with restrict, maxChars and displayAsPassword.
         selectionState = new SelectionState(
-        	textFlow, op.absoluteStart, op.absoluteStart);
+        	op.textFlow, op.absoluteStart, op.absoluteStart);
         editManager.insertText(pastedText, selectionState);

         // All done with the edit manager.
@@ -2865,12 +2863,16 @@
      *  @private
      *  RichEditableTextContainerManager overrides focusInHandler and calls
      *  this before executing it's own focusInHandler.
+     *
+     *  NOTE: In some cases TCM calls the focusInHandler twice during one
+     *  focusIn event.  Ensure that this code works correctly if it is
+     *  called twice.
      */
     mx_internal function focusInHandler(event:FocusEvent):void
     {
         //trace("focusIn handler");

-        if (_editable)
+        if (editingMode == EditingMode.READ_WRITE)
         {
             // If no selection, give it one so that the underlying selection
             // manager is put in place if it isn't already there and editing
@@ -2917,14 +2919,15 @@
      */
     mx_internal function focusOutHandler(event:FocusEvent):void
     {
-        // By default, we clear the undo history when a TextView loses focus.
+        // By default, we clear the undo history when a RichEditableText loses
+        // focus.
         if (clearUndoOnFocusOut && undoManager)
             undoManager.clearAll();

         if (focusManager)
             focusManager.defaultButtonEnabled = true;

-        if (_imeMode != null && _editable)
+        if (_imeMode != null && editingMode == EditingMode.READ_WRITE)
         {
             // When IME.conversionMode is unknown it cannot be
             // set to anything other than unknown(English)
@@ -2955,7 +2958,7 @@
         		getEditManager().splitParagraph();
         		releaseEditManager();
                 event.preventDefault();
-                event.stopImmediatePropagation();
+                //event.stopImmediatePropagation();
             }
             else
             {
@@ -3065,11 +3068,38 @@
      */
     private function textContainerManager_damageHandler(event:DamageEvent):void
     {
-        //trace("damageHandler", event.damageAbsoluteStart, event.damageLength);
-
-        textDamaged = true;
-
-        invalidateDisplayList();
+        //trace("damageHandler", id, event.damageAbsoluteStart, event.damageLength);
+
+        // setText triggers a damage event which we want to ignore.  We
+        // override TCM.setText() in RETCM and set this flag before calling the
+        // superclass.
+        if (ignoreDamageEvent || event.damageLength == 0)
+            return;
+
+        // If there are pending changes, don't wipe them out.  We have
+        // not gotten to commitProperties() yet.
+        if (textChanged || textFlowChanged || contentChanged)
+            return;
+
+        // In this case we always maintain _text with the underlying text and
+        // display the appropriate number of passwordChars.  If there are any
+        // interactive editing operations _text is updated during the operation.
+        // ToDo: what about the case where the textContainerManager textFlow
+        // is modified programatically and the text is different?  This could
+        // only be done with an mx_internal interface.
+        if (displayAsPassword)
+            return;
+
+        // Invalidate _text and _content.
+        _text = null;
+        _content = null;
+        _textFlow = _textContainerManager.getTextFlow();
+
+        // We don't need to call invalidateProperties()
+        // because the hostFormat and the _textFlow are still valid.
+
+        invalidateSize();
+        invalidateDisplayList();
     }

     /**
@@ -3237,7 +3267,7 @@
             }
         }

-        // Dispatch a 'changing' event from the TextView
+        // Dispatch a 'changing' event from the RichEditableText
         // as notification that an editing operation is about to occur.
         if (dispatchChangingEvent)
         {
@@ -3246,7 +3276,7 @@
             newEvent.operation = op;
             dispatchEvent(newEvent);

-            // If the event dispatched from this TextView is canceled,
+            // If the event dispatched from this RichEditableText is canceled,
             // cancel the one from the EditManager, which will prevent
             // the editing operation from being processed.
             if (newEvent.isDefaultPrevented())
@@ -3269,7 +3299,7 @@
         if (event.operation is PasteOperation)
             handlePasteOperation(PasteOperation(event.operation));

-        // Dispatch a 'change' event from the TextView
+        // Dispatch a 'change' event from the RichEditableText
         // as notification that an editing operation has occurred.
         var newEvent:TextOperationEvent =
             new TextOperationEvent(TextOperationEvent.CHANGE);


Transferred from the Adobe Open Source Subversion Repository

Revision: 11653
Author:   cframpto@adobe.com
Date:     2009-11-11T14:45:15.386616Z

Log Message:
-----------
Correct when widthConstraint and heightContraint are reset.  They were being reset every time thru updateDisplayList() which was causing lots of extra remeasures and unnecessary height/width changes which is visible as flicker and the focus ring size changing with each height/width change.

QE notes:
Doc notes:
Bugs: SDK-21837, SDK-23148
Reviewer: Gordon
Tests run: checkintests
Is noteworthy for integration: no

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1280190 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/RichEditableText.as
+++ frameworks/projects/spark/src/spark/components/RichEditableText.as
@@ -823,6 +823,8 @@
     {
         super.explicitWidth = value;

+        widthConstraint = NaN;
+
         // Because of autoSizing, the size and display might be impacted.
         invalidateSize();
         invalidateDisplayList();
@@ -856,6 +858,8 @@
     override public function set percentWidth(value:Number):void
     {
         super.percentWidth = value;
+
+        widthConstraint = NaN;

         // If we were autoSizing and now we are not we need to remeasure.
         invalidateSize();
@@ -2185,6 +2189,8 @@
         _widthInChars = value;
         widthInCharsChanged = true;

+        widthConstraint = NaN;
+
         invalidateProperties();
         invalidateSize();
         invalidateDisplayList();
@@ -2615,9 +2621,6 @@
                                                 _selectionActivePosition);
             scrollAfterUpdate = false;
         }
-
-        widthConstraint = NaN;
-        heightConstraint = NaN;
     }

     /**
@@ -3419,6 +3422,9 @@
         // Either constraints are preventing auto-sizing or we need to
         // remeasure which will reset autoSize.
         autoSize = false;
+
+        widthConstraint = NaN;
+        heightConstraint = NaN;

         if (width != measuredWidth)
         {


Change 20081029-ptw-E by ptw@dueling-banjos.home on 2008-10-29 15:44:33 EDT
    in /Users/ptw/OpenLaszlo/trunk-2
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Make sure queued play actions apply to constrained resources

Bugs Fixed:
LPP-5338  LzView play attribute doesn't work as advertised. (swf8)

Technical Reviewer: max (Message-ID: <4908D678.9010001@laszlosystems.com>)
QA Reviewer: mdemmon (pending)

Details:
    If play/stop on an empty clip, queue.  If queued actions on
    setResource, drain the queue.

Tests:
    Test case from bug now works correctly in swf8.

git-svn-id: d62bde4b5aa582fdf07c8d403e53e0399a7ed285@11641 fa20e4f9-1d0a-0410-b5f3-dc9c16b8b17c

--- WEB-INF/lps/lfc/kernel/swf/LzSprite.as
+++ WEB-INF/lps/lfc/kernel/swf/LzSprite.as
@@ -276,6 +276,9 @@
         var mc = this.owner.immediateparent.sprite.attachResourceToChildView( resourceName, this );
         this.setMovieClip( mc, resourceName );
     }
+
+    // We may have queued an action due to setter ordering
+    if (this.queuedplayaction) { this.doQueuedPlayAction(null); }

     this.updateResourceSize(true);
 }
@@ -1364,8 +1367,11 @@
   * Otherwise f is relative to the beginning of the resource.
   */
 LzSprite.prototype.play = function (f, rel){
+    // NOTE: [2008-10-29 ptw] We want to know if we have
+    // already have a clip assigned or not and queue this action if
+    // not, hence we check __LZhaser
     var m = this.getMCRef();
-    if ( m == null ) {
+    if ( this.__LZhaser ) {
         this.queuePlayAction( "play" , f , rel );
         return;
     }
@@ -1389,8 +1395,11 @@
   * Otherwise it is relative to the start position of the resource.
   */
 LzSprite.prototype.stop = function (f, rel){
+    // NOTE: [2008-10-29 ptw] We want to know if we have
+    // already have a clip assigned or not and queue this action if
+    // not, hence we check __LZhaser
     var m = this.getMCRef();
-    if ( m == null ) {
+    if ( this.__LZhaser ) {
         // always stop on the first frame
         this.queuePlayAction( "stop" , 0);
         return;


update comment for asdoc

update comment for asdoc

--- src/com/google/analytics/campaign/CampaignTracker.as
+++ src/com/google/analytics/campaign/CampaignTracker.as
@@ -22,34 +22,33 @@
 {
     import com.google.analytics.utils.Variables;

-    /**
-     * Campaign tracker object.
-     * Contains all the data associated with a campaign.
-     *
-     * AdWords:
-     * The following variables
-     * name, source, medium, term, content
-     * are automatically generated for AdWords hits when autotagging
-     * is turned on through the AdWords interface.
-     *
-     *
-     * note:
-     * we can not use a CampaignInfo because here the serialization
-     * to URL have to be injected into __utmz and is then a special case.
-     *
-     * links:
-     *
-     * Understanding campaign variables: The five dimensions of campaign tracking
-     * http://www.google.com/support/googleanalytics/bin/answer.py?answer=55579&hl=en
-     *
-     * How does campaign tracking work?
-     * http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55540
-     *
-     * What is A/B Testing and how can it help me?
-     * http://www.google.com/support/googleanalytics/bin/answer.py?answer=55589
-     *
-     * What information do the filter fields represent?
-     * http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55588
+    /* Campaign tracker object.
+       Contains all the data associated with a campaign.
+
+       AdWords:
+       The following variables
+       name, source, medium, term, content
+       are automatically generated for AdWords hits when autotagging
+       is turned on through the AdWords interface.
+
+
+       note:
+       we can not use a CampaignInfo because here the serialization
+       to URL have to be injected into __utmz and is then a special case.
+
+       links:
+
+       Understanding campaign variables: The five dimensions of campaign tracking
+       http://www.google.com/support/googleanalytics/bin/answer.py?answer=55579&hl=en
+
+       How does campaign tracking work?
+       http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55540
+
+       What is A/B Testing and how can it help me?
+       http://www.google.com/support/googleanalytics/bin/answer.py?answer=55589
+
+       What information do the filter fields represent?
+       http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55588
      */
     public class CampaignTracker
     {


editing comments

editing comments

--- WeaveCore/src/weave/core/Synchronizer.as
+++ WeaveCore/src/weave/core/Synchronizer.as
@@ -155,7 +155,8 @@
 						// if we haven't reached the target time yet or callbacks are delayed, call later
 						if (currentTime < callLaterTime)
 						{
-							uiComponent.callLater(synchronize, [firstParam, true]); // callingLater = true
+							// firstParam is ignored when callingLater=true
+							uiComponent.callLater(synchronize, [firstParam, true]);
 							return;
 						}
 					}
@@ -174,6 +175,7 @@
 			// if the linkable variable's callbacks are delayed, delay synchronization
 			if (sm.getCallbackCollection(linkableVariable).callbacksAreDelayed)
 			{
+				// firstParam is ignored when callingLater=true
 				WeaveAPI.StageUtils.callLater(linkableVariable, synchronize, [firstParam, true], WeaveAPI.TASK_PRIORITY_0_IMMEDIATE);
 				return;
 			}


simplified code

simplified code

--- WeaveUI/src/weave/ui/JavaScriptCanvas.as
+++ WeaveUI/src/weave/ui/JavaScriptCanvas.as
@@ -14,7 +14,7 @@

 	public class JavaScriptCanvas extends Canvas implements ILinkableObject
 	{
-		private var buffers:Vector.<Image> = new Vector.<Image>(2, true);
+		private var buffers:Vector.<Image> = Vector.<Image>([new Image(), new Image()]);
 		private var back_buffer:Image;
 		private var last_update:int = 0;
 		private var rendering:Boolean = false;
@@ -35,17 +35,8 @@

 			WeaveAPI.StageUtils.addEventCallback(Event.ENTER_FRAME, this, handleEnterFrame);

-			for (var i:int = 0; i < buffers.length; i++)
-			{
-				buffers[i] = new Image();
-				buffers[i].addEventListener(Event.COMPLETE, handleImageComplete);
-				addChild(buffers[i]);
-			}
-
-			addChild(buffers[1]);
-
-			back_buffer = buffers[0];
-			last_update = getTimer();
+			for each (back_buffer in buffers)
+				addChild(back_buffer).addEventListener(Event.COMPLETE, handleImageComplete);
 		}

 		public function handleEnterFrame():void


fixed bug where WeaveTreeDescriptorNode was being created instead of ColumnTreeNode

--- WeaveData/src/weave/data/hierarchy/ColumnTreeNode.as
+++ WeaveData/src/weave/data/hierarchy/ColumnTreeNode.as
@@ -45,9 +45,9 @@
 		 */
 		public function ColumnTreeNode(params:Object)
 		{
-			childItemClass = ColumnTreeNode;
+			super(params);

-			super(params);
+			childItemClass = ColumnTreeNode;

 			if (!dataSource)
 				throw new Error('ColumnTreeNode constructor: "dataSource" parameter is required');


CSS/transitions
	- bugfix: Added guard against transitioning between identical values

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@711 bc4816be-ef27-423a-9c4d-fc420be121a2

--- src/reprise/css/transitions/CSSTransitionsManager.as
+++ src/reprise/css/transitions/CSSTransitionsManager.as
@@ -165,8 +165,10 @@
 						}
 					}

-					//ignore properties that don't have previous values or target values
-					if (!oldValue || !targetValue || targetValue.isAuto())
+					//ignore properties that don't have previous values or target values or where
+					//the values are identical
+					if (!oldValue || !targetValue || targetValue.isAuto() ||
+						oldValue == targetValue)
 					{
 						return;
 					}


Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1262424 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/states/State.as
+++ frameworks/projects/framework/src/mx/states/State.as
@@ -0,0 +1,223 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2005-2006 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.states
+{
+
+import flash.events.EventDispatcher;
+import mx.core.mx_internal;
+import mx.events.FlexEvent;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the view state has been entered.
+ *  This event is dispatched after the changes
+ *  to the base view state have been applied.
+ *
+ *  @eventType mx.events.FlexEvent.ENTER_STATE
+ */
+[Event(name="enterState", type="mx.events.FlexEvent")]
+
+/**
+ *  Dispatched before a view state is exited.
+ *  This event is dispatched before the changes
+ *  to the base view state have been removed.
+ *
+ *  @eventType mx.events.FlexEvent.EXIT_STATE
+ */
+[Event(name="exitState", type="mx.events.FlexEvent")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+[DefaultProperty("overrides")]
+
+/**
+ *  The State class defines a view state, a particular view of a component.
+ *  For example, a product thumbnail could have two view states;
+ *  a base view state with minimal information, and a rich view state with
+ *  additional information.
+ *  The overrides property specifies a set of child classes
+ *  to add or remove from the base view state, and properties, styles, and event
+ *  handlers to set when the view state is in effect.
+ *
+ *
You use the State class in the states property
+ *  of Flex components.
+ *  You can only specify a states property at the root of an
+ *  application or a custom control, not on child controls.

+ *
+ *
You enable a view state by setting a component's
+ *  currentState property.

+ *
+ *  @mxml
+ *
The <mx:State> tag has the following attributes:

+ *
+ *

+ *  <mx:State
+ *  Properties
+ *  basedOn="null"
+ *  name="null"
+ *  overrides="null"
+ *  />
+ *

+ *
+ *  @see mx.states.AddChild
+ *  @see mx.states.RemoveChild
+ *  @see mx.states.SetEventHandler
+ *  @see mx.states.SetProperty
+ *  @see mx.states.SetStyle
+ *  @see mx.states.Transition
+ *
+ *  @includeExample examples/StatesExample.mxml
+ */
+public class State extends EventDispatcher
+{
+	include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor.
+	 */
+	public function State()
+	{
+		super();
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 *  Initialized flag
+	 */
+	private var initialized:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+	//  basedOn
+    //----------------------------------
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  The name of the view state upon which this view state is based, or
+	 *  null if this view state is not based on a named view state.
+	 *  If this value is null, the view state is based on a root
+	 *  state that consists of the properties, styles, event handlers, and
+	 *  children that you define for a component without using a State class.
+	 *
+	 *  @default null
+	 */
+	public var basedOn:String;
+
+    //----------------------------------
+	//  name
+    //----------------------------------
+
+	[Inspectable(category="General")]
+
+    /**
+     *  The name of the view state.
+	 *  State names must be unique for a given component.
+	 *  This property must be set.
+     */
+	public var name:String;
+
+    //----------------------------------
+	//  overrides
+    //----------------------------------
+
+	[ArrayElementType("mx.states.IOverride")]
+	[Inspectable(category="General")]
+
+	/**
+	 *  The overrides for this view state, as an Array of objects that implement
+	 *  the IOverride interface. These overrides are applied in order when the
+	 *  state is entered, and removed in reverse order when the state is exited.
+	 *
+	 *
The following Flex classes implement the IOverride interface and let you
+	 *  define the view state characteristics:

+	 *

+	 *
AddChild

+	 *
RemoveChild

+	 *
SetEventHandler

+	 *
SetProperty

+	 *
SetStyle

+	 *

+	 *
+	 *
The overrides property is the default property of the
+	 *  State class. You can omit the <mx:overrides> tag
+	 *  and its child <mx:Array>tag if you use MXML tag
+	 *  syntax to define the overrides.

+	 */
+	public var overrides:Array /* of IOverride */ = [];
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Initialize this state and all of its overrides.
+     */
+    mx_internal function initialize():void
+    {
+    	if (!initialized)
+    	{
+    		initialized = true;
+    		for (var i:int = 0; i < overrides.length; i++)
+    		{
+    			IOverride(overrides[i]).initialize();
+    		}
+    	}
+    }
+
+    /**
+     *  @private
+     *  Dispatches the "enterState" event.
+     */
+	mx_internal function dispatchEnterState():void
+	{
+		dispatchEvent(new FlexEvent(FlexEvent.ENTER_STATE));
+	}
+
+    /**
+     *  @private
+     *  Dispatches the "exitState" event.
+     */
+	mx_internal function dispatchExitState():void
+	{
+		dispatchEvent(new FlexEvent(FlexEvent.EXIT_STATE));
+	}
+}
+
+}


Last commit I accidentally pushed out with a duplicate log message- so this is for last commit: Added folder for player created content. Properties of this folder- Created and maintained entirely client-side. Currently, its folder Id is 99 (will change in future). Any player created content is initially put into this folder, but can be moved out if desired. Folder cannot be deleted. Folder will always stay on top of side palette. I think thats it...

--- flexEditor/src/org/arisgames/editor/components/PaletteTree.as
+++ flexEditor/src/org/arisgames/editor/components/PaletteTree.as
@@ -65,6 +65,7 @@
 			trace("ClosePlayerGenContent Folder");
 			this.playerContentFolderOpen = false;
 		}
+		//
 		AppServices.getInstance().saveFolder(GameModel.getInstance().game.gameId, thisFolder, new Responder(handleSavePaletteObject, handleFault));
 	}


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1259473 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/core/ISpriteInterface.as
+++ frameworks/projects/framework/src/mx/core/ISpriteInterface.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2007 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  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
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      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.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1260866 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/formatters/IFormatter.as
+++ frameworks/projects/framework/src/mx/formatters/IFormatter.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

 package mx.formatters
 {


require that all members of a FocusManagerGroup are in the same document.  This should alleviate the requirement that groupName is unique throughout the UI which will allow radiobutton templates in MXML and hopefully not break anybody's app

--- frameworks/projects/framework/src/mx/managers/FocusManager.as
+++ frameworks/projects/framework/src/mx/managers/FocusManager.as
@@ -1397,7 +1397,8 @@
                         if (obj is IFocusManagerGroup)
                         {
                             tg2 = IFocusManagerGroup(obj);
-                            if (tg2.groupName == tg1.groupName && isEnabledAndVisible(obj))
+                            if (tg2.groupName == tg1.groupName && isEnabledAndVisible(obj) &&
+                                tg2["document"] == tg1["document"])
                             {
                                 if (tg2.selected)
                                 {
@@ -1412,6 +1413,7 @@

                     if (tg1 != groupElementToFocus)
                     {
+                        var foundAnotherGroup:Boolean = false;
                         // cycle the entire focusable candidates array forward or backward,
                         // wrapping around boundaries, searching for our focus candidate
                         j = i;
@@ -1434,10 +1436,26 @@
                             obj = focusableCandidates[j];
                             if (isEnabledAndVisible(obj))
                             {
-                                if (obj is IFocusManagerGroup)
+                                if (foundAnotherGroup)
+                                {
+                                    // we're now just trying to find a selected member of this group
+                                    if (obj is IFocusManagerGroup)
+                                    {
+                                        tg2 = IFocusManagerGroup(obj);
+                                        if (tg2.groupName == tg1.groupName && tg2["document"] == tg1["document"])
+                                        {
+                                            if (tg2.selected)
+                                            {
+                                                i = j;
+                                                break;
+                                            }
+                                        }
+                                    }
+                                }
+                                else if (obj is IFocusManagerGroup)
                                 {
                                     tg2 = IFocusManagerGroup(obj);
-                                    if (tg2.groupName == tg1.groupName)
+                                    if (tg2.groupName == tg1.groupName && tg2["document"] == tg1["document"])
                                     {
                                         if (tg2 == groupElementToFocus)
                                         {
@@ -1451,9 +1469,14 @@
                                     }
                                     else
                                     {
-                                        // element is part of another group, stop (no recursive search)
+                                        // switch to new group and hunt for selected item
+                                        tg1 = tg2;
                                         i = j;
-                                        break;
+                                        // element is part of another group, stop if selected
+                                        if (tg2.selected)
+                                            break;
+                                        else
+                                            foundAnotherGroup = true;
                                     }
                                 }
                                 else


Transferred from the Adobe Open Source Subversion Repository

Revision: 5468
Author:   mhorn@adobe.com
Date:     2009-03-20T20:03:56.963789Z

Log Message:
-----------
asdoc bug fixes

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/PopUpManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RadioButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/ObjectUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Container.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1261719 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/managers/PopUpManager.as
+++ frameworks/projects/framework/src/mx/managers/PopUpManager.as
@@ -144,7 +144,7 @@
      *
      *
Example

      *
-     *
var tw = new TitleWindow();
+     *
var tw:TitleWindow = new TitleWindow();
      *    tw.title = "My Title";
      *    mx.managers.PopUpManager.addPopUp(tw, pnl, false);

      *


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1269978 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/styles/metadata/AnchorStyles.as
+++ frameworks/projects/mx/src/mx/styles/metadata/AnchorStyles.as
@@ -1,32 +1,4 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2006-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

-/**
- *  The vertical distance in pixels from the top edge of the content area to
- *  the control's baseline position.
- *  If this style is set, the baseline of the component is
- *  anchored to the top edge of its content area; when its container
- *  is resized, the two edges maintain their separation.
- *
- *
This style only has an effect when used on a component in a Canvas container,
- *  or when used on a component in a Panel or Application container that has the
- *  layout property set to absolute.

- *
- *
The default value is undefined, which means it is not set.

- *
- *  @langversion 3.0
- *  @playerversion Flash 9
- *  @playerversion AIR 1.1
- *  @productversion Flex 3
- */
 [Style(name="baseline", type="String", inherit="no")]

 /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 12056
Author:   jszeto@adobe.com
Date:     2009-11-20T18:59:23.772957Z

Log Message:
-----------
PopUpAnchor bug fixes

http://bugs.adobe.com/jira/browse/SDK-24026 - PopupAnchor throws RTE if removed from stage and has no children

Added null check

http://bugs.adobe.com/jira/browse/SDK-23541 - DropDownList does not position dropDown correctly if popUpWidthMatchesAnchorWidth is set to "false"

The problem is that when the popUpPosition is set to "left" and the popUp doesn't have an explicit width, its measured size is not updated in time for the popUp to be positioned. The solution is to force a measure pass by calling validateNow on the popUp.

QE notes: None
Doc notes: None
Bugs: SDK-24026, SDK-23541
Reviewer: Alex, Glenn
Tests run: PopUpAnchor, DropDownList, ComboBox
Is noteworthy for integration: No

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/PopUpAnchor.as

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1279876 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/PopUpAnchor.as
+++ frameworks/projects/spark/src/spark/components/PopUpAnchor.as
@@ -476,8 +476,9 @@
             {
                 popUpWidth = UIComponent(popUp).explicitWidth;
                 popUpHeight = UIComponent(popUp).explicitHeight;
+                UIComponent(popUp).validateNow();
             }
-
+
             applyPopUpTransform(width, height);
         }
         else if (DisplayObject(popUp).parent != null && displayPopUp == false)
@@ -655,7 +656,7 @@
      */
     private function removedFromStageHandler(event:Event):void
     {
-        if (DisplayObject(popUp).parent != null)
+        if (popUp != null && DisplayObject(popUp).parent != null)
             removeAndResetPopUp();

         addedToStage = false;


Transferred from the Adobe Open Source Subversion Repository

Revision: 7756
Author:   rfrishbe@adobe.com
Date:     2009-06-11T21:28:48.623739Z

Log Message:
-----------
Some PARB changes for SkinnableComponent and DataGroup:

SkinnableComponent.invalidateSkinState() changed from protected to public

DataGroup:
initializeDataProvider(): protected -> private
addItemRendererToDisplayList(): protected -> private
dataProvider_collectionChangeHandler(): protected -> mx_internal
adjustAfterAdd(): protected -> private
adjustAfterRemove(): protected -> private
adjustAfterMove(): protected -> private
adjustAfterReplace(): protected -> private

QE Notes: -
Doc Notes: -
Bugs: -
Reviewer: F10
tests: checkintest (seem to fail due to local changes to ScrollBar, which I'm not checking in here)

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/RadioButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/SkinnableComponent.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1279924 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/RadioButton.as
+++ frameworks/projects/spark/src/spark/components/RadioButton.as
@@ -421,17 +421,6 @@
     //  Methods
     //
     //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     *  The radio button was added or removed from a radio button group or the
-     *  radio button group was enabled/disabled.  All of these events can impact
-     *  the skin state.
-     */
-    mx_internal function invalidateSkinState():void
-    {
-        invalidateSkinState();
-    }

     /**
      *  @private


Transferred from the Adobe Open Source Subversion Repository

Revision: 19797
Author:   klin@adobe.com
Date:     2011-01-19T00:06:54.932970Z

Log Message:
-----------
Initial checkin of override default density mapping feature. Application and other classes delegate calculating runtimeDPI to a RuntimeDPIProvider class. Developers that wish to override how the runtimeDPI is calculated should subclass RuntimeDPIProvider and set it to the runtimeDPIProvider property on Application. Application actually calls DensityUtil.getRuntimeDPI() which creates the instance of the runtimeDPIProvider class and caches the runtimeDPI. I've also modified the compiler so that runtimeDPIProvider is recognized as a special attribute on Application. This checkin includes the PARB updates for changing DPI related properties and variables from ints to Numbers.

QE notes: Update tests
Doc notes: N/A
Bugs: SDK-28731
Reviewer: Evtim
Tests run: checkintests
Is noteworthy for integration: Yes

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/modules/compiler/src/java/flex2/compiler/mxml/builder/DocumentBuilder.java</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/modules/compiler/src/java/flex2/tools/PreLink.java</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/utils/DensityUtil.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/MobileSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/modules/compiler/src/java/flex2/compiler_en.properties</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/DPIClassification.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/BusyIndicator.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/utils/MultiDPIBitmapSource.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/LabelItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/HSliderDataTip.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/primitives/BitmapImage.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/tools/dependencychecker/frameworkSwcExceptionsList.txt</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Application.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1285630 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/primitives/BitmapImage.as
+++ frameworks/projects/spark/src/spark/primitives/BitmapImage.as
@@ -1411,11 +1411,11 @@
     mx_internal function getActualValue(values:MultiDPIBitmapSource):Object
     {
         var app:Object = FlexGlobals.topLevelApplication;
-        var dpi:int;
+        var dpi:Number;
         if ("runtimeDPI" in app)
             dpi = app["runtimeDPI"];
         else
-            dpi = DensityUtil.classifyDPI(Capabilities.screenDPI);
+            dpi = DensityUtil.getRuntimeDPI();
         return values.getSource(dpi);
     }