Repository: flex-tlf Updated Branches: refs/heads/develop 41fc042d0 -> 592b45fa2
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 Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/592b45fa Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/592b45fa Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/592b45fa Branch: refs/heads/develop Commit: 592b45fa219af46592f30ad712b739ac606ed296 Parents: 41fc042 Author: Alex Harui <aha...@apache.org> Authored: Wed May 21 20:52:45 2014 -0700 Committer: Alex Harui <aha...@apache.org> Committed: Wed May 21 20:52:45 2014 -0700 ---------------------------------------------------------------------- .../src/flashx/textLayout/compose/BaseCompose.as | 7 ++++--- .../src/flashx/textLayout/compose/ComposeState.as | 15 +++++++++------ .../textLayout/container/ContainerController.as | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/592b45fa/textLayout/src/flashx/textLayout/compose/BaseCompose.as ---------------------------------------------------------------------- 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 @@ package flashx.textLayout.compose 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 @@ package flashx.textLayout.compose 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 @@ package flashx.textLayout.compose 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); http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/592b45fa/textLayout/src/flashx/textLayout/compose/ComposeState.as ---------------------------------------------------------------------- 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 @@ package flashx.textLayout.compose 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 @@ package flashx.textLayout.compose 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 @@ package flashx.textLayout.compose 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 http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/592b45fa/textLayout/src/flashx/textLayout/container/ContainerController.as ---------------------------------------------------------------------- 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 @@ package flashx.textLayout.container 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;