Repository: flex-tlf
Updated Branches:
  refs/heads/develop 913056000 -> 3ce6a7b71


FLEX-35078
Changes while reading the code: minor asdoc edits, code formatting changes, and 
Array instantiation simplification.


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

Branch: refs/heads/develop
Commit: 3ce6a7b717f615424c23491433c8e00dcc20e688
Parents: 9130560
Author: Mihai Chira <[email protected]>
Authored: Wed Apr 13 12:42:34 2016 +0200
Committer: Mihai Chira <[email protected]>
Committed: Wed Apr 13 12:42:34 2016 +0200

----------------------------------------------------------------------
 .../flashx/textLayout/compose/TextFlowLine.as   | 24 ++++++++------------
 .../flashx/textLayout/edit/SelectionManager.as  | 22 +++++++++---------
 2 files changed, 21 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/3ce6a7b7/textLayout/src/flashx/textLayout/compose/TextFlowLine.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/compose/TextFlowLine.as 
b/textLayout/src/flashx/textLayout/compose/TextFlowLine.as
index bd6e015..c3c73f0 100644
--- a/textLayout/src/flashx/textLayout/compose/TextFlowLine.as
+++ b/textLayout/src/flashx/textLayout/compose/TextFlowLine.as
@@ -1455,11 +1455,11 @@ package flashx.textLayout.compose
                        var curIdx:int = begIdx;
                        //the current FlowLeafElement as determined by curIdx
                        var curElem:FlowLeafElement = null;
-                       //the hightest glyph.  Needed to normalize the 
rectangles we'll be building
+                       //the highest glyph. Needed to normalize the rectangles 
we'll be building
                        var largestRise:Number = 0;
                        
                        //blockRectArray holds each leaf's blocks which could 
be 1 or more
-                       var blockRectArray:Array = new Array();
+                       var blockRectArray:Array = [];
                        //floatRectArray holds the selection rects for any 
floats in the range.
                        var floatRectArray:Array = null;
                        //tcyDrawRects:Array
@@ -1478,10 +1478,9 @@ package flashx.textLayout.compose
                                else if(curElem is InlineGraphicElement && 
(curElem as InlineGraphicElement).computedFloat != Float.NONE)
                                {
                                        if(floatRectArray == null)
-                                               floatRectArray = new Array();
+                                               floatRectArray = [];
                                        
-                               //      var blockRect:Rectangle = (curElem as 
InlineGraphicElement).graphic.getBounds(textLine);
-                                       var ilg:InlineGraphicElement = (curElem 
as InlineGraphicElement);
+                                       var ilg:InlineGraphicElement = curElem 
as InlineGraphicElement;
                                        var floatInfo:FloatCompositionData = 
controller.getFloatAtPosition(paraAbsStart + curIdx);
                                        if (floatInfo)
                                        {
@@ -1491,7 +1490,7 @@ package flashx.textLayout.compose
                                        ++curIdx;
                                        continue;
                                }
-                               //the number of potential glyphs to hilite.  
Could larger than needs be if we are only selecting part of it.
+                               //the number of potential glyphs to highlight. 
Could be larger than needed if we are only selecting part of it.
                                var numCharsSelecting:int = curElem.textLength 
+ curElem.getElementRelativeStart(_para) - curIdx;
                                // special handling for TableLeafElements (do 
nothing)
                                if(curElem is TableLeafElement)
@@ -1505,7 +1504,7 @@ package flashx.textLayout.compose
                                        ++curIdx;
                                        continue;
                                }
-                               //the index of the last glyph to hilite.  If a 
partial selection, use endIdx
+                               //the index of the last glyph to highlight. If 
a partial selection, use endIdx
                                var endPos:int = (numCharsSelecting + curIdx) > 
endIdx ? endIdx : (numCharsSelecting + curIdx);
                                
                                //if this is not a TCY in vertical, the blocks 
should all be running in the same direction
@@ -1792,7 +1791,7 @@ package flashx.textLayout.compose
                {
                        CONFIG::debug{ assert(begIdx <= endIdx, "Selection 
indexes are reversed!  How can this happen?!"); }
                        
-                       var blockArray:Array = new Array();
+                       var blockArray:Array = [];
                        var blockRect:Rectangle = new Rectangle();
                        var startElem:FlowLeafElement = _para.findLeaf(begIdx);
                        var startMetrics:Rectangle = 
startElem.getComputedFontMetrics().emBox;
@@ -1839,9 +1838,6 @@ package flashx.textLayout.compose
                        var begIsBidi:Boolean = begAtomIndex != -1 ? 
isAtomBidi(textLine, begAtomIndex, direction) : false;
                        var endIsBidi:Boolean = endAtomIndex != -1 ? 
isAtomBidi(textLine, endAtomIndex, direction) : false;
                        
-                       //trace("begAtomIndex is bidi = " + 
begIsBidi.toString());
-                       //trace("endAtomIndex is bidi = " + 
endIsBidi.toString());      
-                       
                        if(begIsBidi || endIsBidi)
                        {       
                                //this code needs to iterate over the glyphs 
starting at the begAtomIndex and going forward.
@@ -1862,7 +1858,7 @@ package flashx.textLayout.compose
                                //a line getting selected when the text was 
bidi.   Instead, we're going to use the begIdx and endIdx and 
                                //recalculate the element indexes each time.  
This is expensive, but I don't see an alternative. - gak 09.05.08
                                var curIdx:int = begIdx;
-                               var incrementor:int = (begIdx != endIdx ? 1 : 
0);
+                               var incrementor:int = begIdx != endIdx ? 1 : 0;
                                
                                //the indexes used to draw the seleciton.  
activeStart/End represent the
                                //beginning of the selection shape atoms, while 
cur is the one we are testing.
@@ -2497,8 +2493,8 @@ package flashx.textLayout.compose
                                                
                        if(endIdx != begIdx)
                        {
-                               if(((direction == Direction.LTR && 
textLine.getAtomBidiLevel(begAtomIndex)%2 != 0)
-                                       || (direction == Direction.RTL && 
textLine.getAtomBidiLevel(begAtomIndex)%2 == 0))
+                               if(((direction == Direction.LTR && 
textLine.getAtomBidiLevel(begAtomIndex) % 2 != 0)
+                                       || (direction == Direction.RTL && 
textLine.getAtomBidiLevel(begAtomIndex) % 2 == 0))
                                        && 
textLine.getAtomTextRotation(begAtomIndex) != TextRotation.ROTATE_0)
                                        endAtomIndex = 
textLine.getAtomIndexAtCharIndex(endIdx);
                                else

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/3ce6a7b7/textLayout/src/flashx/textLayout/edit/SelectionManager.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/edit/SelectionManager.as 
b/textLayout/src/flashx/textLayout/edit/SelectionManager.as
index 6415776..b904022 100644
--- a/textLayout/src/flashx/textLayout/edit/SelectionManager.as
+++ b/textLayout/src/flashx/textLayout/edit/SelectionManager.as
@@ -318,7 +318,7 @@ package flashx.textLayout.edit
                        
                        if (rows && rows.length) {
                                
-                               for (var i:int;i<rows.length;i++) 
+                               for (var i:int;i<rows.length;i++) 
                                {
                                        var row:TableRowElement = rows[i] as 
TableRowElement;
                                        
@@ -1226,8 +1226,8 @@ package flashx.textLayout.edit
         {
             if (_textFlow.flowComposer)
             {
-                // selection may need to be constrainted due to model changes 
that weren't done with the EditManager
-                
internalSetSelection(_textFlow,anchorMark.position,activeMark.position,_pointFormat);
+                // selection may need to be constrained due to model changes 
that weren't done with the EditManager
+                internalSetSelection(_textFlow, anchorMark.position, 
activeMark.position, _pointFormat);
                 
                 // zero alpha means nothing is drawn so skip it
                 if (currentSelectionFormat && 
@@ -2919,11 +2919,11 @@ package flashx.textLayout.edit
                 * @playerversion AIR 1.5
                 * @langversion 3.0
                 */                              
-               public function get subManager():ISelectionManager
+               public function get subManager():ISelectionManager
                {
                        return _subManager;
                }
-               public function set subManager(value:ISelectionManager):void
+               public function set subManager(value:ISelectionManager):void
                {
                        if(value == _subManager)
                                return;
@@ -2939,32 +2939,32 @@ package flashx.textLayout.edit
                 * @langversion 3.0
                 */                              
 
-               public function get superManager():ISelectionManager
+               public function get superManager():ISelectionManager
                {
                        return _superManager;
                }
 
-               public function set superManager(value:ISelectionManager):void
+               public function set superManager(value:ISelectionManager):void
                {
                        _superManager = value;
                }
 
                /** Anchor point of the current cell selection, as coordinates 
within the table. */
-               public function get anchorCellPosition():CellCoordinates
+               public function get anchorCellPosition():CellCoordinates
                {
                        return _anchorCellPosition;
                }
-               public function set 
anchorCellPosition(value:CellCoordinates):void
+               public function set 
anchorCellPosition(value:CellCoordinates):void
                {
                        _anchorCellPosition = value;
                }
 
                /** Active end of the current cell selection, as coordinates 
within the table. */
-               public function get activeCellPosition():CellCoordinates
+               public function get activeCellPosition():CellCoordinates
                {
                        return _activeCellPosition;
                }
-               public function set 
activeCellPosition(value:CellCoordinates):void
+               public function set 
activeCellPosition(value:CellCoordinates):void
                {
                        _activeCellPosition = value;
                }

Reply via email to