Repository: flex-tlf Updated Branches: refs/heads/develop 219260876 -> 422b5536a
FLEX-34807 Removed unused variables and optimised Array and Object construction. Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/2d5df2a6 Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/2d5df2a6 Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/2d5df2a6 Branch: refs/heads/develop Commit: 2d5df2a6b40ab36f570f885dce60284262d56f85 Parents: 2192608 Author: Mihai Chira <[email protected]> Authored: Mon Sep 21 12:28:05 2015 +0200 Committer: Mihai Chira <[email protected]> Committed: Mon Sep 21 12:28:05 2015 +0200 ---------------------------------------------------------------------- .../src/UnitTest/Tests/CompositionTest.as | 21 ++++++++------------ .../textLayout/elements/FlowGroupElement.as | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2d5df2a6/automation_tests/src/UnitTest/Tests/CompositionTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/CompositionTest.as b/automation_tests/src/UnitTest/Tests/CompositionTest.as index d2e3ec3..30a1a71 100644 --- a/automation_tests/src/UnitTest/Tests/CompositionTest.as +++ b/automation_tests/src/UnitTest/Tests/CompositionTest.as @@ -111,8 +111,6 @@ package UnitTest.Tests [Test] public function checkParagraphShufflingTest():void { - var startLength:int = TestFrame.rootElement.textLength; - var flow1:FlowElement; var flow2:FlowElement; @@ -220,7 +218,7 @@ package UnitTest.Tests } //Register all the lines that shouldn't be damaged. - var undamagedUIDs:Array = new Array(); + var undamagedUIDs:Array = []; for (var k:int = 0; k < linenum; k++) { undamagedUIDs[k] = UIDUtil.getUID(lines[k]); @@ -235,7 +233,7 @@ package UnitTest.Tests } //Register all the lines that should be damaged. - var damagedUIDs:Array = new Array(); + var damagedUIDs:Array = []; for (var n:int = linenum; n < lines.length && (lines[n] as TextFlowLine).paragraph != null && @@ -292,7 +290,6 @@ package UnitTest.Tests assertTrue("Composed to the end, should leave text that is not in view uncomposed", flowComposer.damageAbsoluteStart < SelManager.textFlow.textLength); var controller:ContainerController = flowComposer.getControllerAt(0); - var originalEstimatedHeight:Number = controller.contentHeight; controller.verticalScrollPosition += 500; // scroll ahead so we have some lines generated that can be released var lineSummary:Object = createLineSummary(flowComposer); @@ -359,7 +356,7 @@ package UnitTest.Tests formatForRtlTest.fontFamily = 'Adobe Arabic'; // Get stats used later - _lines = new Array(); + _lines = []; _textLen = 0; bounds.width = 200; bounds.height = NaN; @@ -375,7 +372,6 @@ package UnitTest.Tests var line1:TextLine = _lines[1] as TextLine; var line1Extent:Number = StringTextLineFactory.defaultConfiguration.overflowPolicy == OverflowPolicy.FIT_ANY ? line1.y - line1.ascent : line1.y + line1.descent; var line2:TextLine = _lines[2] as TextLine; - var line2Extent:Number = StringTextLineFactory.defaultConfiguration.overflowPolicy == OverflowPolicy.FIT_ANY ? line2.y - line2.ascent : line2.y + line2.descent; var contentHeight:Number = bounds.height; var contentTextLength:int = _textLen; @@ -850,13 +846,13 @@ package UnitTest.Tests SelManager.pasteTextScrap(scrap); SelManager.pasteTextScrap(scrap); textFlow.flowComposer.updateAllControllers(); - controller.setCompositionSize(825, 471) + controller.setCompositionSize(825, 471); SelManager.updateAllControllers(); - controller.setCompositionSize(808, 464) + controller.setCompositionSize(808, 464); SelManager.updateAllControllers(); - controller.setCompositionSize(791, 462) + controller.setCompositionSize(791, 462); SelManager.updateAllControllers(); - controller.setCompositionSize(768, 461) + controller.setCompositionSize(768, 461); SelManager.updateAllControllers(); } @@ -910,7 +906,6 @@ package UnitTest.Tests var textFlow:TextFlow = SelManager.textFlow; var controller:ContainerController = textFlow.flowComposer.getControllerAt(0); - var composeSpace:Rectangle = new Rectangle(0, 0, controller.compositionWidth, controller.compositionHeight); var lastLine:TextFlowLine = controller.getLastVisibleLine(); var lastVisiblePosition:int = lastLine.absoluteStart + lastLine.textLength - 1; @@ -988,7 +983,7 @@ package UnitTest.Tests lineIndex++; } - var result:Object = new Object(); + var result:Object = {}; result["releasedLineCount"] = releasedLineCount; result["invalidLineCount"] = invalidLineCount; result["validLineCount"] = validLineCount; http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2d5df2a6/textLayout/src/flashx/textLayout/elements/FlowGroupElement.as ---------------------------------------------------------------------- diff --git a/textLayout/src/flashx/textLayout/elements/FlowGroupElement.as b/textLayout/src/flashx/textLayout/elements/FlowGroupElement.as index a6ea842..b223bb1 100644 --- a/textLayout/src/flashx/textLayout/elements/FlowGroupElement.as +++ b/textLayout/src/flashx/textLayout/elements/FlowGroupElement.as @@ -778,7 +778,7 @@ package flashx.textLayout.elements // manage as an array or a single child if (childrenToAdd == 0) - newChildToAdd = newChild + newChildToAdd = newChild; else if (childrenToAdd == 1) flatNewChildList = [ newChildToAdd, newChild ]; else
