FLEX-34247 improve TLF performance. I added a flag in case some scenario really needs composition to start from the beginning, but the default is now more like the TLF version that shipped with Adobe Flex 4.6
diff --git a/textLayout/src/flashx/textLayout/compose/BaseCompose.as b/textLayout/src/flashx/textLayout/compose/BaseCompose.as
index 2ad0506..b7c4b02 100644
--- a/textLayout/src/flashx/textLayout/compose/BaseCompose.as
+++ b/textLayout/src/flashx/textLayout/compose/BaseCompose.as
@@ -30,6 +30,7 @@
import flash.text.engine.TextLineValidity;
import flash.utils.Dictionary;
+ import flashx.textLayout.tlf_internal;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.debug.Debugging;
import flashx.textLayout.debug.assert;
@@ -69,7 +70,6 @@
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.formats.VerticalAlign;
import flashx.textLayout.property.Property;
- import flashx.textLayout.tlf_internal;
import flashx.textLayout.utils.LocaleUtil;
import flashx.textLayout.utils.Twips;
@@ -892,8 +892,9 @@
resetControllerBounds();
- // Bug, needs to remove
- _startComposePosition = _startController.absoluteStart;
+ // Bug, needs to remove
+ if (ContainerController.tlf_internal::startComposeFromBeginning)
+ _startComposePosition = _startController.absoluteStart;
// This is where we will start composing from
_curElement = _textFlow.findLeaf(_startComposePosition);
diff --git a/textLayout/src/flashx/textLayout/compose/ComposeState.as b/textLayout/src/flashx/textLayout/compose/ComposeState.as
index ce7bddc..d40dc2b 100644
--- a/textLayout/src/flashx/textLayout/compose/ComposeState.as
+++ b/textLayout/src/flashx/textLayout/compose/ComposeState.as
@@ -27,6 +27,7 @@
import flash.text.engine.TextLineCreationResult;
import flash.text.engine.TextLineValidity;
+ import flashx.textLayout.tlf_internal;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.debug.Debugging;
import flashx.textLayout.debug.assert;
@@ -46,7 +47,6 @@
import flashx.textLayout.formats.ListStylePosition;
import flashx.textLayout.formats.TextAlign;
import flashx.textLayout.formats.VerticalAlign;
- import flashx.textLayout.tlf_internal;
import flashx.textLayout.utils.Twips;
use namespace tlf_internal;
@@ -340,11 +340,14 @@
var line:TextFlowLine = _curLineIndex < _flowComposer.numLines ? (_flowComposer as StandardFlowComposer).lines[_curLineIndex] : null;
var useExistingLine:Boolean = line && (!line.isDamaged() || line.validity == FlowDamageType.GEOMETRY);
- // if the line ends with a hyphen, don't use existing line because the player seems to mis-handle
- // starting the next line.
- if (useExistingLine && line.textLength > 0 &&
- line.paragraph.getCharCodeAtPosition(line.absoluteStart + line.textLength - 1) == 0xAD)
- useExistingLine = false;
+ if (ContainerController.tlf_internal::usesDiscretionaryHyphens)
+ {
+ // if the line ends with a hyphen, don't use existing line because the player seems to mis-handle
+ // starting the next line.
+ if (useExistingLine && line.textLength > 0 &&
+ line.paragraph.getCharCodeAtPosition(line.absoluteStart + line.textLength - 1) == 0xAD)
+ useExistingLine = false;
+ }
var numberLine:TextLine;
// create numberLine if in a listElement
diff --git a/textLayout/src/flashx/textLayout/container/ContainerController.as b/textLayout/src/flashx/textLayout/container/ContainerController.as
index 528c26d..a4e63f1 100644
--- a/textLayout/src/flashx/textLayout/container/ContainerController.as
+++ b/textLayout/src/flashx/textLayout/container/ContainerController.as
@@ -112,6 +112,7 @@
public class ContainerController implements IInteractionEventHandler, ITextLayoutFormat, ISandboxSupport
{
static tlf_internal var usesDiscretionaryHyphens:Boolean = true;
+ static tlf_internal var startComposeFromBeginning:Boolean = false;
private var _textFlowCache:TextFlow;
private var _rootElement:ContainerFormattedElement;