Repository: flex-asjs Updated Branches: refs/heads/tlf 53fc55802 -> 65bdee587
Fixed static TLF issues Fixed various TLF bugs Added numberLine property to Text Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/65bdee58 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/65bdee58 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/65bdee58 Branch: refs/heads/tlf Commit: 65bdee58752176eaab48137a6671214e434f5acc Parents: 53fc558 Author: Harbs <[email protected]> Authored: Tue Apr 18 23:07:33 2017 -0400 Committer: Harbs <[email protected]> Committed: Tue Apr 18 23:07:33 2017 -0400 ---------------------------------------------------------------------- frameworks/js/FlexJS/projects/TLFJS/build.xml | 1 + .../main/flex/org/apache/flex/utils/UIDUtil.as | 9 +- .../projects/TLF/src/main/flex/TLFClasses.as | 3 +- .../flex/textLayout/compose/BaseCompose.as | 82 ++++++++++------- .../flex/textLayout/compose/FactoryComposer.as | 24 +---- .../flex/textLayout/compose/TextFlowLine.as | 85 +++++++++++++----- .../flex/textLayout/compose/TextLineRecycler.as | 65 ++++++++------ .../textLayout/compose/utils/NumberlineUtil.as | 1 + .../textLayout/compose/utils/TextLineUtil.as | 25 +++--- .../textLayout/container/ContainerController.as | 22 +++-- .../flex/textLayout/container/ScrollPolicy.as | 9 +- .../apache/flex/textLayout/dummy/BoundsUtil.as | 7 +- .../flex/textLayout/elements/Configuration.as | 11 ++- .../flex/textLayout/elements/FlowElement.as | 17 ++-- .../textLayout/elements/InlineGraphicElement.as | 32 ++++++- .../flex/textLayout/elements/LinkElement.as | 2 +- .../textLayout/elements/ParagraphElement.as | 8 +- .../events/FlowElementMouseEventManager.as | 43 ++++----- .../flex/textLayout/factory/TLFFactory.as | 8 +- .../textLayout/factory/TextLineFactoryBase.as | 10 ++- .../flex/textLayout/formats/ListMarkerFormat.as | 95 +++++++++++++++----- .../flex/textLayout/formats/TextLayoutFormat.as | 6 +- .../flex/textLayout/property/PropertyFactory.as | 59 ++++++++++-- .../org/apache/flex/text/engine/ITextLine.as | 4 + .../flex/org/apache/flex/text/html/TextLine.as | 11 +++ 25 files changed, 437 insertions(+), 202 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/js/FlexJS/projects/TLFJS/build.xml ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/projects/TLFJS/build.xml b/frameworks/js/FlexJS/projects/TLFJS/build.xml index 4f35c4a..d0603cf 100644 --- a/frameworks/js/FlexJS/projects/TLFJS/build.xml +++ b/frameworks/js/FlexJS/projects/TLFJS/build.xml @@ -66,6 +66,7 @@ <arg value="-compiler.strict-xml=true" /> <arg value="-keep-asdoc" /><!-- allows compiler to see @flexjsignorecoercion annotations --> <!--<arg value="-output=${basedir}/../../../../projects/${target.name.nojs}/target/${target.name.nojs}.swc" />--> + <arg value="-js-output-optimization=skipAsCoercions"/> <arg value="-output=${FLEX_HOME}/frameworks/projects/${target.name.nojs}/target/${target.name.nojs}.swc" /> <arg value="-load-config=${FLEX_HOME}/frameworks/js-config.xml" /> <arg value="-load-config+=${basedir}/src/main/config/compile-js-config.xml" /> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIDUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIDUtil.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIDUtil.as index ecf40ad..cb37fb0 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIDUtil.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIDUtil.as @@ -57,7 +57,14 @@ public class UIDUtil 55, 56, 57, 65, 66, 67, 68, 69, 70]; private static const DASH:int = 45; // dash ascii - private static const UIDBuffer:BinaryData = new BinaryData(); // static ByteArray used for UID generation to save memory allocation cost + + private static var _UIDBuffer:BinaryData; + private static function get UIDBuffer():BinaryData{ + if(_UIDBuffer == null) + _UIDBuffer = new BinaryData(); // static ByteArray used for UID generation to save memory allocation cost + + return _UIDBuffer; + } //-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/TLFClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/TLFClasses.as b/frameworks/projects/TLF/src/main/flex/TLFClasses.as index 51142c1..f67e79a 100644 --- a/frameworks/projects/TLF/src/main/flex/TLFClasses.as +++ b/frameworks/projects/TLF/src/main/flex/TLFClasses.as @@ -160,7 +160,8 @@ package import org.apache.flex.textLayout.utils.GeometryUtil; GeometryUtil; import org.apache.flex.textLayout.utils.HitTestArea; HitTestArea; import org.apache.flex.textLayout.utils.Twips; Twips; - + import org.apache.flex.textLayout.factory.ITLFFactory; ITLFFactory; + // CONFIG::release public function exportAssert():void // { // assert(); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/BaseCompose.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/BaseCompose.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/BaseCompose.as index bd86156..75fb687 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/BaseCompose.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/BaseCompose.as @@ -318,7 +318,12 @@ package org.apache.flex.textLayout.compose { var child:IFlowElement; var rslt:Boolean; // scratch - var isInTableCell:Boolean = elem.className == "TextFlow" && ITextFlow(elem).parentElement.className == "TableCellElement" ? true : false; + var isInTableCell:Boolean = false; + if(elem && elem.className == "TextFlow" && + (elem as ITextFlow).parentElement && + (elem as ITextFlow).parentElement.className == "TableCellElement") + isInTableCell = true; + var cellSpacing:Number = 0; if (isInTableCell) { @@ -719,25 +724,27 @@ package org.apache.flex.textLayout.compose _curElementStart = _curElement.getAbsoluteStart(); _curElementOffset = _startComposePosition - _curElementStart; - //clear interactiveObject - var curInteractiveObjects:ObjectMap = _startController.interactiveObjects; - var interactiveObjects_lastTime:Array = _startController.oldInteractiveObjects; - var curElem:Object; - interactiveObjects_lastTime.splice(0); - for each(curElem in curInteractiveObjects) - { - if(curElem && (curElem as IFlowElement).getAbsoluteStart() >= _startComposePosition) - { - interactiveObjects_lastTime.push(curInteractiveObjects[curElem]); - delete curInteractiveObjects[curElem]; - } - } +//TODO fix once interactive objects is worked out + // //clear interactiveObject + // var curInteractiveObjects:ObjectMap = _startController.interactiveObjects; + // var interactiveObjects_lastTime:Array = _startController.oldInteractiveObjects; + // var curElem:Object; + // interactiveObjects_lastTime.splice(0); + // for each(curElem in curInteractiveObjects) + // { + // if(curElem && (curElem as IFlowElement).getAbsoluteStart() >= _startComposePosition) + // { + // interactiveObjects_lastTime.push(curInteractiveObjects[curElem]); + // delete curInteractiveObjects[curElem]; + // } + // } for(var cidx:int = _flowComposer.getControllerIndex(_startController) + 1; cidx <= controllerEndIndex; cidx ++) { - curInteractiveObjects = _flowComposer.getControllerAt(cidx).interactiveObjects; - for each(curElem in curInteractiveObjects) - if(curElem) - delete curInteractiveObjects[curElem]; +//TODO fix once interactive objects is worked out + // curInteractiveObjects = _flowComposer.getControllerAt(cidx).interactiveObjects; + // for each(curElem in curInteractiveObjects) + // if(curElem) + // delete curInteractiveObjects[curElem]; // Clear previous composition results _flowComposer.getControllerAt(cidx).clearCompositionResults(); @@ -1304,13 +1311,15 @@ package org.apache.flex.textLayout.compose while (curElement && (curElement != _curParaElement)) { // It's a link element? - if (curElement is ILinkElement) + if (curElement.className == "LinkElement") { - _curInteractiveObjects[curElement] = curElement; +//TODO interactive objects + // _curInteractiveObjects[curElement] = curElement; } else if (curElement.hasActiveEventMirror()) { - _curInteractiveObjects[curElement] = curElement; +//TODO interactive objects + // _curInteractiveObjects[curElement] = curElement; } curElement = curElement.parent ; } @@ -1355,19 +1364,21 @@ package org.apache.flex.textLayout.compose ):ITextLine { var lineOffset:Number = (_curParaFormat.direction == Direction.LTR) ? _lineSlug.leftMargin : _lineSlug.rightMargin; - + +//TODO maybe implement recycling var textLine:ITextLine = null; - textLine = TextLineRecycler.getLineForReuse(); + // textLine = TextLineRecycler.getLineForReuse(); var textBlock:ITextBlock = _curParaElement.getTextBlockAtPosition(_curElement.getElementRelativeStart(_curParaElement)); - if (textLine) - { - CONFIG::debug { assert(_textFlow.backgroundManager == null || _textFlow.backgroundManager.getEntry(textLine) === undefined,"createTextLine - Bad ITextLine in recycler cache"); } - textLine = swfContext.callInContext(textBlock["recreateTextLine"],textBlock,[textLine, _previousLine, targetWidth, lineOffset, true]); - } - else - { + // if (textLine) + // { + // CONFIG::debug { assert(_textFlow.backgroundManager == null || _textFlow.backgroundManager.getEntry(textLine) === undefined,"createTextLine - Bad ITextLine in recycler cache"); } + // textLine = swfContext.callInContext(textBlock["recreateTextLine"],textBlock,[textLine, _previousLine, targetWidth, lineOffset, true]); + // } + // else + // { +//TODO is swfContext necessary? textLine = swfContext.callInContext(textBlock.createTextLine,textBlock,[_previousLine, targetWidth, lineOffset, true]); - } + // } CONFIG::debug { assert(!_previousLine || !textLine || _previousLine.textBlockBeginIndex + _previousLine.rawTextLength == textLine.textBlockBeginIndex, "FTE made non-contiguous ITextLine"); } if (!allowEmergencyBreaks && textBlock.textLineCreationResult == TextLineCreationResult.EMERGENCY) textLine = null; @@ -1621,11 +1632,13 @@ package org.apache.flex.textLayout.compose // It's a link element? if (curElement is ILinkElement) { - _curInteractiveObjects[curElement] = curElement; +//TODO interactive objects + // _curInteractiveObjects[curElement] = curElement; } else if (curElement.hasActiveEventMirror()) { - _curInteractiveObjects[curElement] = curElement; +//TODO interactive objects + // _curInteractiveObjects[curElement] = curElement; } curElement = curElement.parent ; } @@ -2721,7 +2734,8 @@ package org.apache.flex.textLayout.compose } if (oldController) // advance the start pos to the next controller if newController isn't the first controller _startComposePosition = newController.absoluteStart; - _curInteractiveObjects = newController.interactiveObjects; +//TODO interactive objects + // _curInteractiveObjects = newController.interactiveObjects; calculateControllerVisibleBounds(newController); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/FactoryComposer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/FactoryComposer.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/FactoryComposer.as index ad897d4..d5cac5a 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/FactoryComposer.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/FactoryComposer.as @@ -18,6 +18,7 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.textLayout.compose { + import org.apache.flex.textLayout.factory.FactoryBackgroundManager; import org.apache.flex.textLayout.compose.utils.FactoryHelper; import org.apache.flex.textLayout.container.IContainerController; import org.apache.flex.textLayout.elements.IBackgroundManager; @@ -57,26 +58,3 @@ package org.apache.flex.textLayout.compose } } } - -import org.apache.flex.text.engine.ITextLine; -import org.apache.flex.textLayout.compose.ITextFlowLine; -import org.apache.flex.textLayout.elements.BackgroundManager; - - -class FactoryBackgroundManager extends BackgroundManager -{ - public override function finalizeLine(line:ITextFlowLine):void - { - var textLine:ITextLine = line.getTextLine(); - - var array:Array = _lineDict[textLine]; - if (array) - { - // attach the columnRect and the ITextLine to the first object in the Array - var obj:Object = array[0]; - - if (obj) // check not needed? - obj.columnRect = line.controller.columnState.getColumnAt(line.columnIndex); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as index 75377ba..54e7721 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextFlowLine.as @@ -90,7 +90,13 @@ package org.apache.flex.textLayout.compose } /** @private - the selection block cache */ - static private var _selectionBlockCache:ObjectMap = new ObjectMap(true); + static private var _selectionBlockCache:ObjectMap; + static private function get selectionBlockCache():ObjectMap{ + if(_selectionBlockCache == null) + _selectionBlockCache = new ObjectMap(true); + + return _selectionBlockCache; + } public function get composable():Boolean { @@ -629,14 +635,20 @@ package org.apache.flex.textLayout.compose return new Rectangle(shapeX, shapeY, textLine.width, textLine.height); } - private const _validities:Array = ["invalid", "possiblyInvalid", "static", "valid", FlowDamageType.GEOMETRY]; + private var _validities:Array; + private function get validities():Array{ + if(_validities == null) + _validities = ["invalid", "possiblyInvalid", "static", "valid", FlowDamageType.GEOMETRY]; + + return _validities; + } private function setValidity(value:String):void { CONFIG::debug { - assert(_validities.indexOf(value) != -1, "Bad alignment passed to TextFlowLine"); } - setFlag(_validities.indexOf(value), VALIDITY_MASK); + assert(validities.indexOf(value) != -1, "Bad alignment passed to TextFlowLine"); } + setFlag(validities.indexOf(value), VALIDITY_MASK); } /** The validity of the line. @@ -655,7 +667,7 @@ package org.apache.flex.textLayout.compose */ public function get validity():String { - return _validities[getFlag(VALIDITY_MASK)]; + return validities[getFlag(VALIDITY_MASK)]; } /** @@ -713,12 +725,18 @@ package org.apache.flex.textLayout.compose _accumulatedMinimumStart = value; } - static private const _alignments:Array = [TextAlign.LEFT, TextAlign.CENTER, TextAlign.RIGHT]; + static private var _alignments:Array; + static private function get alignments():Array{ + if(_alignments == null) + _alignments = [TextAlign.LEFT, TextAlign.CENTER, TextAlign.RIGHT]; + + return _alignments; + } /** @private */ public function get alignment():String { - return _alignments[getFlag(ALIGNMENT_MASK) >> ALIGNMENT_SHIFT]; + return alignments[getFlag(ALIGNMENT_MASK) >> ALIGNMENT_SHIFT]; } /** @private */ @@ -726,8 +744,8 @@ package org.apache.flex.textLayout.compose { CONFIG::debug { - assert(_alignments.indexOf(value) != -1, "Bad alignment passed to TextFlowLine"); } - setFlag(_alignments.indexOf(value) << ALIGNMENT_SHIFT, ALIGNMENT_MASK); + assert(alignments.indexOf(value) != -1, "Bad alignment passed to TextFlowLine"); } + setFlag(alignments.indexOf(value) << ALIGNMENT_SHIFT, ALIGNMENT_MASK); } /** @private @@ -982,15 +1000,16 @@ package org.apache.flex.textLayout.compose } // trace("Recreating line from", absoluteStart, "to", absoluteStart + textLength); - textLine = TextLineRecycler.getLineForReuse(); - if (textLine) - { - CONFIG::debug - { - assert(textFlow.backgroundManager == null || textFlow.backgroundManager.getEntry(textLine) === undefined, "Bad ITextLine in recycler cache"); } - textLine = swfContext.callInContext(textBlock["recreateTextLine"], textBlock, [textLine, previousLine, _targetWidth, effLineOffset, true]); - } - else +//TODO implement line reuse + // textLine = TextLineRecycler.getLineForReuse(); + // if (textLine) + // { + // CONFIG::debug + // { + // assert(textFlow.backgroundManager == null || textFlow.backgroundManager.getEntry(textLine) === undefined, "Bad ITextLine in recycler cache"); } + // textLine = swfContext.callInContext(textBlock["recreateTextLine"], textBlock, [textLine, previousLine, _targetWidth, effLineOffset, true]); + // } + // else textLine = swfContext.callInContext(textBlock.createTextLine, textBlock, [previousLine, _targetWidth, effLineOffset, true]); if (textLine == null) @@ -1095,7 +1114,7 @@ package org.apache.flex.textLayout.compose { _adornCount++; setFlag(NUMBERLINE_MASK, NUMBERLINE_MASK); - textLine.addElement(numberLine); + textLine.numberLine = numberLine; CONFIG::debug { Debugging.traceFTECall(null, textLine, "addChildNumberLine", numberLine); } @@ -1321,7 +1340,7 @@ package org.apache.flex.textLayout.compose } // the cached selection bounds and rects - var selectionCache:SelectionCache = _selectionBlockCache[this]; + var selectionCache:SelectionCache = selectionBlockCache.get(this); if (selectionCache && selectionCache.begIdx == begIdx && selectionCache.endIdx == endIdx) return selectionCache; @@ -1332,7 +1351,7 @@ package org.apache.flex.textLayout.compose if (selectionCache == null) { selectionCache = new SelectionCache(); - _selectionBlockCache[this] = selectionCache; + selectionBlockCache.set(this,selectionCache); } else { @@ -2137,9 +2156,27 @@ package org.apache.flex.textLayout.compose rect.height = height; } - static private const localZeroPoint:Point = new Point(0, 0); - static private const localOnePoint:Point = new Point(1, 0); - static private const rlLocalOnePoint:Point = new Point(0, 1); + static private var _localZeroPoint:Point; + static private function get localZeroPoint():Point{ + if(_localZeroPoint == null) + _localZeroPoint = new Point(0, 0); + + return localZeroPoint; + } + static private var _localOnePoint:Point; + static private function get localOnePoint():Point{ + if(_localOnePoint == null) + _localOnePoint = new Point(1, 0); + + return localOnePoint; + } + static private var _rlLocalOnePoint:Point; + static private function get rlLocalOnePoint():Point{ + if(_rlLocalOnePoint == null) + _rlLocalOnePoint = new Point(0, 1); + + return rlLocalOnePoint; + } // TODO generalize this so we're not relying on UIBase /** @private */ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextLineRecycler.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextLineRecycler.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextLineRecycler.as index e2ae145..1be1f57 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextLineRecycler.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/TextLineRecycler.as @@ -52,7 +52,17 @@ package org.apache.flex.textLayout.compose // manage a cache of ITextLine's that can be reused // This version uses a dictionary that holds the TextLines as weak references - static private var reusableLineCache:ObjectMap = new ObjectMap(true); + static private var _reusableLineCache:ObjectMap; + static public function get reusableLineCache():ObjectMap + { + if(_reusableLineCache == null) + _reusableLineCache = new ObjectMap(true); + return _reusableLineCache; + } + static public function set reusableLineCache(value:ObjectMap):void + { + _reusableLineCache = value; + } /** * Add a ITextLine to the pool for reuse. TextLines for reuse should have null userData and null parent. @@ -63,19 +73,21 @@ package org.apache.flex.textLayout.compose static public function addLineForReuse(textLine:ITextLine):void { - CONFIG::debug { assert(textLine.parent == null && textLine.userData == null && (textLine.validity == "invalid" || textLine.validity == "static"),"textLine not ready for reuse"); } - if (_textLineRecyclerEnabled) - { - CONFIG::debug - { - for each (var line:ITextLine in reusableLineCache) - { - assert(line != textLine,"READDING LINE TO CACHE"); - } - } - CONFIG::debug { cacheTotal++; } - reusableLineCache[textLine] = null; - } +//TODO make this work... + return; + // CONFIG::debug { assert(textLine.parent == null && textLine.userData == null && (textLine.validity == "invalid" || textLine.validity == "static"),"textLine not ready for reuse"); } + // if (_textLineRecyclerEnabled) + // { + // CONFIG::debug + // { + // for each (var line:ITextLine in reusableLineCache) + // { + // assert(line != textLine,"READDING LINE TO CACHE"); + // } + // } + // CONFIG::debug { cacheTotal++; } + // reusableLineCache[textLine] = null; + // } } CONFIG::debug { @@ -105,18 +117,19 @@ package org.apache.flex.textLayout.compose static public function getLineForReuse():ITextLine { - if (_textLineRecyclerEnabled) - { - for (var obj:Object in reusableLineCache) - { - // remove from the cache - delete reusableLineCache[obj]; - CONFIG::debug { assert(reusableLineCache[obj] === undefined,"Bad delete"); } - CONFIG::debug { recordFetch(1); } - return obj as ITextLine; - } - CONFIG::debug { recordFetch(0); } - } +//TODO make this work + // if (_textLineRecyclerEnabled) + // { + // for (var obj:Object in reusableLineCache) + // { + // // remove from the cache + // delete reusableLineCache[obj]; + // CONFIG::debug { assert(reusableLineCache[obj] === undefined,"Bad delete"); } + // CONFIG::debug { recordFetch(1); } + // return obj as ITextLine; + // } + // CONFIG::debug { recordFetch(0); } + // } return null; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/NumberlineUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/NumberlineUtil.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/NumberlineUtil.as index d82bca3..fa9dc28 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/NumberlineUtil.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/NumberlineUtil.as @@ -139,6 +139,7 @@ package org.apache.flex.textLayout.compose.utils rslt.push(o); }); +//TODO make sure this works // position it relative to the parent line - later need to take inside/outside into account var numberLine:ITextLine = rslt[0] as ITextLine; if (numberLine) http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/TextLineUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/TextLineUtil.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/TextLineUtil.as index 52a0bd2..58ec859 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/TextLineUtil.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/compose/utils/TextLineUtil.as @@ -37,18 +37,19 @@ package org.apache.flex.textLayout.compose.utils /** @private */ static public function findNumberLine(textLine:ITextLine):ITextLine { - if (textLine == null) - return null; - // not always going to be a numberLine - listStyleType may be "none" - // have to hunt for it because inlinegraphics get pushed at the beginning - // risk here is that clients decorate TextLines with other TextLines. - for (var idx:int = 0; idx < textLine.numElements; idx++) - { - var numberLine:ITextLine = textLine.getElementAt(idx) as ITextLine; - if (numberLine && (numberLine.userData is NumberLineUserData)) - break; - } - return numberLine; + return textLine.numberLine; + // if (textLine == null) + // return null; + // // not always going to be a numberLine - listStyleType may be "none" + // // have to hunt for it because inlinegraphics get pushed at the beginning + // // risk here is that clients decorate TextLines with other TextLines. + // for (var idx:int = 0; idx < textLine.numElements; idx++) + // { + // var numberLine:ITextLine = textLine.getElementAt(idx) as ITextLine; + // if (numberLine && (numberLine.userData is NumberLineUserData)) + // break; + // } + // return numberLine; } /** @private */ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as index f17f045..6cc0841 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as @@ -270,7 +270,7 @@ package org.apache.flex.textLayout.container _tableBlocksInView = []; setCompositionSize(compositionWidth, compositionHeight); - format = _containerControllerInitialFormat; + format = containerControllerInitialFormat; } /** @private */ @@ -3100,7 +3100,7 @@ package org.apache.flex.textLayout.container return ccif; } - static private var _containerControllerInitialFormat:ITextLayoutFormat = createContainerControllerInitialFormat(); + static private var _containerControllerInitialFormat:ITextLayoutFormat; /** * @private @@ -3117,7 +3117,12 @@ package org.apache.flex.textLayout.container */ static public function get containerControllerInitialFormat():ITextLayoutFormat - { return _containerControllerInitialFormat; } + { + if(_containerControllerInitialFormat == null) + _containerControllerInitialFormat = createContainerControllerInitialFormat(); + + return _containerControllerInitialFormat; + } static public function set containerControllerInitialFormat(val:ITextLayoutFormat):void { _containerControllerInitialFormat = val; } @@ -3147,8 +3152,13 @@ package org.apache.flex.textLayout.container _composedFloats.length = 0; // trace("clear composedFloats for container", flowComposer ? flowComposer.getControllerIndex(this) : 0); } - - private static var scratchRectangle:Rectangle = new Rectangle(); + private static var _scratchRectangle:Rectangle; + private static function get scratchRectangle():Rectangle{ + if(_scratchRectangle == null) + _scratchRectangle = new Rectangle(); + + return _scratchRectangle; + } private function intersperseTableBlocks(targetArray:Array):void{ if(_tableBlocksInView.length == 0) @@ -4760,7 +4770,7 @@ package org.apache.flex.textLayout.container } private function calculateComputedFormat():void { - var parentPrototype:TextLayoutFormat = _rootElement ? TextLayoutFormat(_rootElement.computedFormat): null; + var parentPrototype:TextLayoutFormat = _rootElement ? (_rootElement.computedFormat as TextLayoutFormat): null; _computedFormat = CreateTLFUtil.createTLF(formatForCascade,parentPrototype); resetColumnState(); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ScrollPolicy.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ScrollPolicy.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ScrollPolicy.as index 0f391cf..0675a2e 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ScrollPolicy.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ScrollPolicy.as @@ -77,8 +77,13 @@ package org.apache.flex.textLayout.container public static const ON:String = "on"; + static private var _scrollPolicyPropertyDefinition:Property; /** Shared definition of the scrollPolicy property. @private */ - static public const scrollPolicyPropertyDefinition:Property = PropertyFactory.enumString("scrollPolicy", ScrollPolicy.AUTO, false, null, - ScrollPolicy.AUTO, ScrollPolicy.OFF, ScrollPolicy.ON); + static public function get scrollPolicyPropertyDefinition():Property{ + if(_scrollPolicyPropertyDefinition == null) + _scrollPolicyPropertyDefinition = PropertyFactory.enumString("scrollPolicy", ScrollPolicy.AUTO, false, null, ScrollPolicy.AUTO, ScrollPolicy.OFF, ScrollPolicy.ON); + + return _scrollPolicyPropertyDefinition; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/BoundsUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/BoundsUtil.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/BoundsUtil.as index a3409c9..e4213cb 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/BoundsUtil.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/dummy/BoundsUtil.as @@ -21,9 +21,10 @@ package org.apache.flex.textLayout.dummy { import org.apache.flex.core.IUIBase; public class BoundsUtil { static public function getBounds(child:IUIBase,parent:IUIBase):Rectangle{ - //TODO implement getting bounds - child;parent; - return null; + if(child == parent) + return new Rectangle(child.x,child.y,child.width,child.height); + //TODO implement getting relative bounds + throw new Error("bounds type not yet implemented") } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/Configuration.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/Configuration.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/Configuration.as index 9b6171d..83e1594 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/Configuration.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/Configuration.as @@ -565,7 +565,16 @@ package org.apache.flex.textLayout.elements { _immutableClone = null; } - public static var defaultConfiguration:IConfiguration = new Configuration(); + private static var _defaultConfiguration:IConfiguration; + public static function get defaultConfiguration():IConfiguration{ + if(_defaultConfiguration == null) + _defaultConfiguration = new Configuration(); + + return _defaultConfiguration; + } + public static function set defaultConfiguration(value:IConfiguration):void{ + _defaultConfiguration = value; + } /** Returns true if the ActionScript text engine was built with debugging code enabled. @private */ static public function get debugCodeEnabled():Boolean http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/FlowElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/FlowElement.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/FlowElement.as index 0eae11f..aa92092 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/FlowElement.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/FlowElement.as @@ -654,7 +654,7 @@ package org.apache.flex.textLayout.elements } /** @private Shared scratch element for use in computedFormat methods only */ - static public var _scratchTextLayoutFormat:TextLayoutFormat = new TextLayoutFormat(); + // static public var _scratchTextLayoutFormat:TextLayoutFormat = new TextLayoutFormat(); /** * Returns the computed format attributes that are in effect for this element. @@ -682,7 +682,7 @@ package org.apache.flex.textLayout.elements /** @private */ public function doComputeTextLayoutFormat():TextLayoutFormat { - var parentPrototype:TextLayoutFormat = _parent ? TextLayoutFormat(_parent.computedFormat) : null; + var parentPrototype:TextLayoutFormat = _parent ? (_parent.computedFormat as TextLayoutFormat) : null; return CreateTLFUtil.createTLF(formatForCascade, parentPrototype); } @@ -1019,7 +1019,11 @@ package org.apache.flex.textLayout.elements var elem:IFlowElement = this; while (elem.parent != null) elem = elem.parent; - return elem as ITextFlow; + + if(elem.className == "TextFlow") + return elem as ITextFlow; + + return null; } /** @@ -1044,11 +1048,12 @@ package org.apache.flex.textLayout.elements var rslt:IFlowElement = this; while (rslt) { + if(rslt.className == "ParagraphElement") + return rslt as IParagraphElement; + rslt = rslt.parent; - if (!rslt) - throw new Error("No ParagraphElement found!"); } - return rslt as IParagraphElement; + return null; } public function isInTable():Boolean http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/InlineGraphicElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/InlineGraphicElement.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/InlineGraphicElement.as index 7397513..7c5dabf 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/InlineGraphicElement.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/InlineGraphicElement.as @@ -320,13 +320,37 @@ package org.apache.flex.textLayout.elements } /** Definition of the height property @private */ - static public const heightPropertyDefinition:Property = PropertyFactory.numPercentEnum("height", "auto", false, null, 0, 32000, "0%", "1000000%", "auto"); + static private var _heightPropertyDefinition:Property; + static public function get heightPropertyDefinition():Property{ + if(_heightPropertyDefinition == null) + _heightPropertyDefinition = PropertyFactory.numPercentEnum("height", "auto", false, null, 0, 32000, "0%", "1000000%", "auto"); + + return _heightPropertyDefinition; + } /** Definition of the width property @private */ - static public const widthPropertyDefinition:Property = PropertyFactory.numPercentEnum("width", "auto", false, null, 0, 32000, "0%", "1000000%", "auto"); + static private var _widthPropertyDefinition:Property; + static public function get widthPropertyDefinition():Property{ + if(_widthPropertyDefinition == null) + _widthPropertyDefinition = PropertyFactory.numPercentEnum("width", "auto", false, null, 0, 32000, "0%", "1000000%", "auto"); + + return _widthPropertyDefinition; + } /** Disabled due to player bug. @private */ - static public const rotationPropertyDefinition:Property = PropertyFactory.enumString("rotation", "rotate0", false, null, "rotate0", "rotate90", "rotate180", "rotate270"); + static private var _rotationPropertyDefinition:Property; + static public function get rotationPropertyDefinition():Property{ + if(_rotationPropertyDefinition == null) + _rotationPropertyDefinition = PropertyFactory.enumString("rotation", "rotate0", false, null, "rotate0", "rotate90", "rotate180", "rotate270"); + + return _rotationPropertyDefinition; + } /** Definition of the float property @private */ - static public const floatPropertyDefinition:Property = PropertyFactory.enumString("float", "none", false, null, "none", "left", "right", "start", "end"); + static private var _floatPropertyDefinition:Property; + static public function get floatPropertyDefinition():Property{ + if(_floatPropertyDefinition == null) + _floatPropertyDefinition = PropertyFactory.enumString("float", "none", false, null, "none", "left", "right", "start", "end"); + + return _floatPropertyDefinition; + } /** The current status of the image. On each status change the owning TextFlow sends a StatusChangeEvent. * http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as index d2b4d18..72cc6ca 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as @@ -440,7 +440,7 @@ package org.apache.flex.textLayout.elements /** @private TODO: Possible optimization - replace this with prototype chaining?? */ public override function get formatForCascade():ITextLayoutFormat { - var superFormat:TextLayoutFormat = TextLayoutFormat(format); + var superFormat:TextLayoutFormat = format as TextLayoutFormat; var effectiveFormat:ITextLayoutFormat = effectiveLinkElementTextLayoutFormat; if (effectiveFormat || superFormat) { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/ParagraphElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/ParagraphElement.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/ParagraphElement.as index d72d869..74e1c26 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/ParagraphElement.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/ParagraphElement.as @@ -46,6 +46,7 @@ package org.apache.flex.textLayout.elements import org.apache.flex.textLayout.property.PropertyUtil; import org.apache.flex.textLayout.utils.CharacterUtil; import org.apache.flex.textLayout.utils.LocaleUtil; + import org.apache.flex.textLayout.elements.ITextFlow; @@ -98,13 +99,16 @@ package org.apache.flex.textLayout.elements /** @private */ public function createTextBlock():void { + var tf:ITextFlow = getTextFlow(); + if(tf == null)// if it's not in a text flow, we cannot create text blocaks yet + return; // CONFIG::debug { assert(_textBlock == null,"createTextBlock called when there is already a textblock"); } calculateComputedFormat(); // recreate the format BEFORE the _textBlock is created var tbs:Vector.<ITextBlock> = getTextBlocks(); //tbs.length = 0; var tableCount:int = 0; if(tbs.length == 0 && !(getChildAt(0) is ITableElement) ) - tbs.push(getTextFlow().tlfFactory.textFactory.getTextBlock()); + tbs.push(tf.tlfFactory.textFactory.getTextBlock()); //getTextBlocks()[0] = new ITextBlock(); // CONFIG::debug { Debugging.traceFTECall(_textBlock,null,"new ITextBlock()"); } for (var i:int = 0; i < numChildren; i++) @@ -120,7 +124,7 @@ package org.apache.flex.textLayout.elements } } while(tableCount >= tbs.length) - tbs.push(getTextFlow().tlfFactory.textFactory.getTextBlock()); + tbs.push(tf.tlfFactory.textFactory.getTextBlock()); for (i = 0; i < numChildren; i++) { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as index 855dc12..0a993ee 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as @@ -225,28 +225,29 @@ package org.apache.flex.textLayout.events var elements:Array = []; if (textFlow.interactiveObjectCount != 0 && startPos != endPos) // check for empty container { - //New algorithm here to improve performance when there are link elements - var uniqueDictionary:ObjectMap = container.interactiveObjects; - var o:Object ; - var f:IFlowElement; - for each (o in uniqueDictionary) - { - f = o as IFlowElement ; - if (f && f.getAbsoluteStart() < endPos && f.getAbsoluteStart() + f.textLength >= startPos) - elements.push(o) ; - } - //ensure there is no bug when you paste many words, which causes the link across containers - var interactiveObjects_LastTime:Array = container.oldInteractiveObjects; - for each (o in interactiveObjects_LastTime) - { - f = o as IFlowElement ; - if (f && f.getAbsoluteStart() < endPos && f.getAbsoluteStart() + f.textLength >= startPos) - { - elements.push(o) ; - uniqueDictionary[o] = o;//push back the interactive object, make sure the total number is correct - } +//TODO commenting this out until we figure out what to do with interactive objects + // //New algorithm here to improve performance when there are link elements + // var uniqueDictionary:ObjectMap = container.interactiveObjects; + // var o:Object ; + // var f:IFlowElement; + // for each (o in uniqueDictionary) + // { + // f = o as IFlowElement ; + // if (f && f.getAbsoluteStart() < endPos && f.getAbsoluteStart() + f.textLength >= startPos) + // elements.push(o) ; + // } + // //ensure there is no bug when you paste many words, which causes the link across containers + // var interactiveObjects_LastTime:Array = container.oldInteractiveObjects; + // for each (o in interactiveObjects_LastTime) + // { + // f = o as IFlowElement ; + // if (f && f.getAbsoluteStart() < endPos && f.getAbsoluteStart() + f.textLength >= startPos) + // { + // elements.push(o) ; + // uniqueDictionary[o] = o;//push back the interactive object, make sure the total number is correct + // } - } + // } CONFIG::debug { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as index 98bccb3..cf1ec10 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as @@ -5,6 +5,12 @@ package org.apache.flex.textLayout.factory /** * Default ITLFFactory if one is not specified. */ - public static var defaultTLFFactory:ITLFFactory = new StandardTLFFactory(); + private static var _defaultTLFFactory:ITLFFactory; + public static function get defaultTLFFactory():ITLFFactory{ + if(_defaultTLFFactory == null) + _defaultTLFFactory = new StandardTLFFactory(); + + return _defaultTLFFactory; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TextLineFactoryBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TextLineFactoryBase.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TextLineFactoryBase.as index cccf0b6..38518cb 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TextLineFactoryBase.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TextLineFactoryBase.as @@ -77,7 +77,13 @@ package org.apache.flex.textLayout.factory private var _containerController:IContainerController; //TODO figure out what this should be - static private var _tc:IParentIUIBase = new UIBase(); + static private var _tc:IParentIUIBase; + static private function get tc():IParentIUIBase{ + if(_tc == null) + _tc = new UIBase(); + + return _tc; + } private var _swfContext:ISWFContext; @@ -125,7 +131,7 @@ package org.apache.flex.textLayout.factory */ public function TextLineFactoryBase() { - _containerController = ContainerUtil.getController(_tc); + _containerController = ContainerUtil.getController(tc); _horizontalScrollPolicy = _verticalScrollPolicy = String(ScrollPolicy.scrollPolicyPropertyDefinition.defaultValue); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/ListMarkerFormat.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/ListMarkerFormat.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/ListMarkerFormat.as index acf203c..5b389be 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/ListMarkerFormat.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/ListMarkerFormat.as @@ -63,26 +63,68 @@ package org.apache.flex.textLayout.formats } /** @private */ - static public const counterResetProperty:Property = createCounterResetProperty("counterReset", FormatValue.NONE, false, Vector.<String>([Category.LIST])); + static private var _counterResetProperty:Property; + static public function get counterResetProperty():Property{ + if(_counterResetProperty == null) + _counterResetProperty = createCounterResetProperty("counterReset", FormatValue.NONE, false, Vector.<String>([Category.LIST])); + + return _counterResetProperty; + } /** @private */ - static public const counterIncrementProperty:Property = createCounterResetProperty("counterIncrement", "ordered 1", false, Vector.<String>([Category.LIST])); + static private var _counterIncrementProperty:Property; + static public function get counterIncrementProperty():Property{ + if(_counterIncrementProperty == null) + _counterIncrementProperty = createCounterResetProperty("counterIncrement", "ordered 1", false, Vector.<String>([Category.LIST])); + + return _counterIncrementProperty; + } /** @private */ - static public const beforeContentProperty:Property = PropertyFactory.string("beforeContent", null, false, Vector.<String>([Category.LIST])); + static private var _beforeContentProperty:Property; + static public function get beforeContentProperty():Property{ + if(_beforeContentProperty == null) + _beforeContentProperty = PropertyFactory.string("beforeContent", null, false, Vector.<String>([Category.LIST])); + + return _beforeContentProperty; + } /** @private */ - static public const contentProperty:Property = createCounterContentProperty("content", "counter(ordered)", false, Vector.<String>([Category.LIST])); + static private var _contentProperty:Property; + static public function get contentProperty():Property{ + if(_contentProperty == null) + _contentProperty = createCounterContentProperty("content", "counter(ordered)", false, Vector.<String>([Category.LIST])); + + return _contentProperty; + } /** @private */ - static public const afterContentProperty:Property = PropertyFactory.string("afterContent", null, false, Vector.<String>([Category.LIST])); + static private var _afterContentProperty:Property; + static public function get afterContentProperty():Property{ + if(_afterContentProperty == null) + _afterContentProperty = PropertyFactory.string("afterContent", null, false, Vector.<String>([Category.LIST])); + + return _afterContentProperty; + } /** @private */ - static public const suffixProperty:Property = PropertyFactory.enumString("suffix", Suffix.AUTO, false, Vector.<String>([Category.LIST]), Suffix.AUTO, Suffix.NONE); + static private var _suffixProperty:Property; + static public function get suffixProperty():Property{ + if(_suffixProperty == null) + _suffixProperty = PropertyFactory.enumString("suffix", Suffix.AUTO, false, Vector.<String>([Category.LIST]), Suffix.AUTO, Suffix.NONE); + + return _suffixProperty; + } - static private var _lmfDescription:Object = { - counterReset:counterResetProperty, - counterIncrement:counterIncrementProperty, - beforeContent:beforeContentProperty, - content:contentProperty, - afterContent:afterContentProperty, - suffix:suffixProperty - }; + static private var _lmfDescription:Object; + static private function get lmfDescription():Object{ + if(_lmfDescription == null){ + _lmfDescription = { + "counterReset":counterResetProperty, + "counterIncrement":counterIncrementProperty, + "beforeContent":beforeContentProperty, + "content":contentProperty, + "afterContent":afterContentProperty, + "suffix":suffixProperty + }; + } + return _lmfDescription; + } // at this point we know that both TextLayoutFormat and ListMarkerFormat are initialized so can setup the Property objects PropertyFactory.sharedTextLayoutFormatHandler.converter = TextLayoutFormat.createTextLayoutFormat; @@ -113,7 +155,7 @@ package org.apache.flex.textLayout.formats /** @private */ public override function setStyle(styleProp:String,newValue:*):void { - var lmfStyle:Property = _lmfDescription[styleProp]; + var lmfStyle:Property = lmfDescription[styleProp]; if (lmfStyle) setLMFStyle(lmfStyle,newValue); else @@ -242,8 +284,9 @@ package org.apache.flex.textLayout.formats { // use prototype chaining _description = PropertyUtil.createObjectWithPrototype(TextLayoutFormat.description); - for (var key:String in _lmfDescription) - _description[key] = _lmfDescription[key]; + var lmfd:Object = lmfDescription; + for (var key:String in lmfd) + _description[key] = lmfd[key]; } return _description; } @@ -256,7 +299,8 @@ package org.apache.flex.textLayout.formats var lmf:IListMarkerFormat = incoming as IListMarkerFormat; if (lmf) { - for (var key:String in _lmfDescription) + var lmfd:Object = lmfDescription; + for (var key:String in lmfd) this[key] = lmf[key]; } } @@ -268,7 +312,8 @@ package org.apache.flex.textLayout.formats var lmf:IListMarkerFormat = incoming as IListMarkerFormat; if (lmf) { - for each (var prop:Property in _lmfDescription) + var lmfd:Object = lmfDescription + for each (var prop:Property in lmfd) { var name:String = prop.name; setLMFStyle(prop,prop.concatHelper(this[name],lmf[name])); @@ -283,7 +328,8 @@ package org.apache.flex.textLayout.formats var lmf:IListMarkerFormat = incoming as IListMarkerFormat; if (lmf) { - for each (var prop:Property in _lmfDescription) + var lmfd:Object = lmfDescription; + for each (var prop:Property in lmfd) { var name:String = prop.name; setLMFStyle(prop,prop.concatInheritOnlyHelper(this[name],lmf[name])); @@ -298,7 +344,8 @@ package org.apache.flex.textLayout.formats var lmf:IListMarkerFormat = incoming as IListMarkerFormat; if (lmf) { - for each (var prop:Property in _lmfDescription) + var lmfd:Object = lmfDescription; + for each (var prop:Property in lmfd) { var name:String = prop.name; var val:* = lmf[name]; @@ -315,7 +362,8 @@ package org.apache.flex.textLayout.formats var lmf:IListMarkerFormat = incoming as IListMarkerFormat; if (lmf) { - for each (var prop:Property in _lmfDescription) + var lmfd:Object = lmfDescription; + for each (var prop:Property in lmfd) { var name:String = prop.name; if (prop.equalHelper(this[name],lmf[name])) @@ -332,7 +380,8 @@ package org.apache.flex.textLayout.formats var lmf:IListMarkerFormat = incoming as IListMarkerFormat; if (lmf) { - for each (var prop:Property in _lmfDescription) + var lmfd:Object = lmfDescription; + for each (var prop:Property in lmfd) { var name:String = prop.name; if (!prop.equalHelper(this[name],lmf[name])) http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/TextLayoutFormat.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/TextLayoutFormat.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/TextLayoutFormat.as index dd76830..1e0f0ed 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/TextLayoutFormat.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/TextLayoutFormat.as @@ -313,7 +313,9 @@ package org.apache.flex.textLayout.formats static public function get fontStyleProperty():Property { if (!_fontStyleProperty) - _fontStyleProperty = PropertyFactory.enumString("fontStyle", FontPosture.NORMAL, true, Vector.<String>([Category.CHARACTER]), FontPosture.NORMAL, FontPosture.ITALIC); + _fontStyleProperty = PropertyFactory.string("fontStyle", "Regular", true, Vector.<String>([Category.CHARACTER])); + // if (!_fontStyleProperty) + // _fontStyleProperty = PropertyFactory.enumString("fontStyle", FontPosture.NORMAL, true, Vector.<String>([Category.CHARACTER]), FontPosture.NORMAL, FontPosture.ITALIC); return _fontStyleProperty; } @@ -3667,7 +3669,7 @@ package org.apache.flex.textLayout.formats if (_defaults == null) { _defaults = new TextLayoutFormat(); - PropertyUtil.defaultsAllHelper(_description, _defaults); + PropertyUtil.defaultsAllHelper(description, _defaults); } return _defaults; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/property/PropertyFactory.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/property/PropertyFactory.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/property/PropertyFactory.as index 36904fc..17f9263 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/property/PropertyFactory.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/property/PropertyFactory.as @@ -18,23 +18,68 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.textLayout.property { import org.apache.flex.textLayout.formats.FormatValue; + import org.apache.flex.textLayout.property.EnumPropertyHandler; + import org.apache.flex.textLayout.property.UndefinedPropertyHandler; + import org.apache.flex.textLayout.property.UintPropertyHandler; public class PropertyFactory { // shared propertyHandler instances /** @private */ - public static const sharedStringHandler:StringPropertyHandler = new StringPropertyHandler(); + static private var _sharedStringHandler:StringPropertyHandler; + public static function get sharedStringHandler():StringPropertyHandler{ + if(_sharedStringHandler == null) + _sharedStringHandler = new StringPropertyHandler(); + + return _sharedStringHandler; + } /** @private */ - public static const sharedInheritEnumHandler:EnumPropertyHandler = new EnumPropertyHandler([ FormatValue.INHERIT ]); + private static var _sharedInheritEnumHandler:EnumPropertyHandler; + public static function get sharedInheritEnumHandler():EnumPropertyHandler{ + if(_sharedInheritEnumHandler == null) + _sharedInheritEnumHandler = new EnumPropertyHandler([ FormatValue.INHERIT ]); + + return _sharedInheritEnumHandler; + } /** @private */ - public static const sharedUndefinedHandler:UndefinedPropertyHandler = new UndefinedPropertyHandler(); + private static var _sharedUndefinedHandler:UndefinedPropertyHandler; + public static function get sharedUndefinedHandler():UndefinedPropertyHandler{ + if(_sharedUndefinedHandler == null) + _sharedUndefinedHandler = new UndefinedPropertyHandler(); + + return _sharedUndefinedHandler; + } /** @private */ - public static const sharedUintHandler:UintPropertyHandler = new UintPropertyHandler(); + private static var _sharedUintHandler:UintPropertyHandler; + public static function get sharedUintHandler():UintPropertyHandler{ + if(_sharedUintHandler == null) + _sharedUintHandler = new UintPropertyHandler(); + + return _sharedUintHandler; + } /** @private */ - public static const sharedBooleanHandler:BooleanPropertyHandler = new BooleanPropertyHandler(); + private static var _sharedBooleanHandler:BooleanPropertyHandler; + public static function get sharedBooleanHandler():BooleanPropertyHandler{ + if(_sharedBooleanHandler == null) + _sharedBooleanHandler = new BooleanPropertyHandler(); + + return _sharedBooleanHandler; + } /** @private */ - public static const sharedTextLayoutFormatHandler:FormatPropertyHandler = new FormatPropertyHandler(); + private static var _sharedTextLayoutFormatHandler:FormatPropertyHandler; + public static function get sharedTextLayoutFormatHandler():FormatPropertyHandler{ + if(_sharedTextLayoutFormatHandler == null) + _sharedTextLayoutFormatHandler = new FormatPropertyHandler(); + + return _sharedTextLayoutFormatHandler; + } /** @private */ - public static const sharedListMarkerFormatHandler:FormatPropertyHandler = new FormatPropertyHandler(); + private static var _sharedListMarkerFormatHandler:FormatPropertyHandler; + public static function get sharedListMarkerFormatHandler():FormatPropertyHandler{ + if(_sharedListMarkerFormatHandler == null) + _sharedListMarkerFormatHandler = new FormatPropertyHandler(); + + return _sharedListMarkerFormatHandler; + } public static function bool(nameValue:String, defaultValue:Boolean, inherited:Boolean, categories:Vector.<String>):Property { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as index 33f7bbe..17d93c8 100644 --- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as +++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ITextLine.as @@ -22,6 +22,7 @@ package org.apache.flex.text.engine import org.apache.flex.core.IChild; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.IUIBase; + import org.apache.flex.text.engine.ITextLine; public interface ITextLine extends IParentIUIBase { @@ -48,11 +49,13 @@ package org.apache.flex.text.engine function get unjustifiedTextWidth():Number; function get userData():*; function get validity():String; + function get numberLine():ITextLine; //setters function set userData(value:*):void; function set doubleClickEnabled(value:Boolean):void; function set validity(value:String):void; + function set numberLine(value:ITextLine):void; function dump():String; function getAtomBidiLevel(atomIndex:int):int; @@ -66,6 +69,7 @@ package org.apache.flex.text.engine function getAtomTextRotation(atomIndex:int):String; function getAtomWordBoundaryOnLeft(atomIndex:int):Boolean; function getBaselinePosition(baseline:String):Number; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65bdee58/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as index f533641..a3eeaff 100644 --- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as +++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as @@ -270,5 +270,16 @@ package org.apache.flex.text.html } return 0; } + + private var _numberLine:ITextLine; + public function get numberLine():ITextLine + { + return _numberLine; + } + public function set numberLine(value:ITextLine):void + { + _numberLine = value; + } + } } \ No newline at end of file
