 import flashx.textLayout.formats.LineBreak;
 
 import mx.core.DPIClassification;
-import mx.core.DesignLayer;
 import mx.core.FlexGlobals;
-import mx.core.IInvalidating;
-import mx.core.IVisualElement;
 import mx.core.LayoutDirection;
 import mx.core.UIComponent;
-import mx.core.UITextFormat;
 import mx.core.mx_internal;
+import mx.events.EffectEvent;
 import mx.events.FlexEvent;
-import mx.geom.TransformOffsets;
-import mx.managers.FocusManager;
-import mx.styles.CSSStyleDeclaration;
-import mx.styles.ISimpleStyleClient;
-import mx.styles.IStyleClient;
-
+import mx.events.MoveEvent;
+import mx.events.ResizeEvent;
+import mx.managers.SystemManager;
+
+import spark.components.Application;
 import spark.core.IEditableText;
 import spark.core.ISoftKeyboardHintClient;
 import spark.events.TextOperationEvent;
-import spark.primitives.Rect;
 
 use namespace mx_internal;
 

        const applicationDPI:Number = FlexGlobals.topLevelApplication.applicationDPI;
        const isAndroid:Boolean = Capabilities.version.indexOf("AND") == 0;
        
        var verticalPadPerPixel:Number = 0;
        var baseHorizontalPad:Number = 0;
        var baseVerticalPad:Number = 0;
        var minMetrics:TextLineMetrics = measureText("Wj");
        var minSize:Point = new Point(minMetrics.width, minMetrics.height);
        
        if (isAndroid)
        {
            switch (applicationDPI)
            {
                case DPIClassification.DPI_320:
                    verticalPadPerPixel = 0.75;
                    baseHorizontalPad = 11;
                    baseVerticalPad = 15;
                    break;
                case DPIClassification.DPI_240:
                    verticalPadPerPixel = 0.36;
                    baseHorizontalPad = 9;
                    baseVerticalPad = 12;
                    break;
                default:
                    verticalPadPerPixel = 0.125;
                    baseHorizontalPad = 7;
                    baseVerticalPad = 7;
                    break;
            }
        }

        return new Point(baseHorizontalPad, 
            baseVerticalPad + Math.ceil(minSize.y * verticalPadPerPixel));
    }
    
    /**

            event.bubbles, event.cancelable, this, event.triggerType));
    }
    
    private function stage_effectStartHandler(event:EffectEvent):void
    {
        // An effect is starting, but the effect will only affect the StageText
        // if its target is an ancestor of it.
        var ancestor:DisplayObjectContainer = parent;
        
        while (ancestor != null && ancestor != event.target)
            ancestor = ancestor.parent;
        
        if (ancestor != null)
        {
            // The first effect affecting the StageText that starts causes us
            // to replace the StageText with a bitmap.
            if (numEffectsRunning++ == 0)
                createProxyImage();
        }
    }
    
    private function stage_effectEndHandler(event:EffectEvent):void
    {
        var ancestor:DisplayObjectContainer = parent;
        
        while (ancestor != null && ancestor != event.target)
            ancestor = ancestor.parent;
        
        if (ancestor != null)
        {
            // The last effect affecting the StageText to end causes us to put
            // the live StageText back and remove the bitmap.
            if (--numEffectsRunning == 0)
                disposeProxyImage();
        }
    }
    
    private function stage_hierarchyChangedHandler(event:Event):void
    {
        // If an ancestor is added to or removed from the list of this
        // StageText's ancestors, update the list of components we watch for
        // visibility and geometry changes.
        var target:Object = event.target;
        var foundTarget:Boolean = false;
        var ancestor:DisplayObject = this;
        
        while (ancestor != null)
        {
            if (target == ancestor)
            {
                foundTarget = true;
                break;
            }
            
            ancestor = ancestor.parent;
        }
        
        if (foundTarget)
            updateWatchedAncestors();
    }
    
    private function addedToStageHandler(event:Event):void
    {
        if (stageText == null)
