FLEX-35078
Changes while reading the code: minor asdoc edits, code formatting changes, and Array instantiation simplification.
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 @@
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 @@
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 @@
++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 @@
++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 @@
{
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 @@
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 @@
//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 @@
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
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 @@
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 @@
{
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 @@
* @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 @@
* @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;
}