flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mih...@apache.org
Subject [1/2] git commit: [flex-tlf] [refs/heads/develop] - FLEX-34756 Split the functionality provided by FlowComposerBase.isDamaged() and StandardFlowComposer.isDamaged() into two separate functions, because 1) they do very different things, and 2) to solve FL
Date Mon, 30 Mar 2015 13:53:56 GMT
Repository: flex-tlf
Updated Branches:
  refs/heads/develop dd7df805d -> b08af46da


FLEX-34756 Split the functionality provided by FlowComposerBase.isDamaged() and StandardFlowComposer.isDamaged()
into two separate functions, because 1) they do very different things, and 2) to solve FLEX-34756
I need the former.
-Also improved some comments and imports.


Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/2b0977d2
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/2b0977d2
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/2b0977d2

Branch: refs/heads/develop
Commit: 2b0977d25e74c1e987001fb9d523945ad0278e67
Parents: ec066bb
Author: Mihai Chira <mihaic@apache.org>
Authored: Mon Mar 30 13:51:09 2015 +0200
Committer: Mihai Chira <mihaic@apache.org>
Committed: Mon Mar 30 13:51:09 2015 +0200

----------------------------------------------------------------------
 .../textLayout/compose/FlowComposerBase.as      | 27 +++++++--
 .../flashx/textLayout/compose/IFlowComposer.as  | 18 +++++-
 .../textLayout/compose/StandardFlowComposer.as  |  4 +-
 .../textLayout/container/ContainerController.as | 58 +++-----------------
 .../container/TextContainerManager.as           |  2 +-
 .../textLayout/elements/TableCellElement.as     | 34 ++++++------
 6 files changed, 66 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2b0977d2/textLayout/src/flashx/textLayout/compose/FlowComposerBase.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/compose/FlowComposerBase.as b/textLayout/src/flashx/textLayout/compose/FlowComposerBase.as
index b050201..7ed9f23 100644
--- a/textLayout/src/flashx/textLayout/compose/FlowComposerBase.as
+++ b/textLayout/src/flashx/textLayout/compose/FlowComposerBase.as
@@ -29,7 +29,7 @@ package flashx.textLayout.compose
 	import flashx.textLayout.elements.FlowLeafElement;
 	import flashx.textLayout.elements.TextFlow;
 	import flashx.textLayout.tlf_internal;
-	
+
 	use namespace tlf_internal;
 	
 	[Exclude(name="initializeLines",kind="method")]
@@ -310,7 +310,6 @@ package flashx.textLayout.compose
 				startPosition = 0;
 			}
 			
-			// find the line at damageStart
 			if (_lines.length == 0 || textFlow.textLength == 0)
 				return;
 				
@@ -319,10 +318,12 @@ package flashx.textLayout.compose
 				return;
 				
 			CONFIG::debug { assert(startPosition + damageLength <= textFlow.textLength, "Damaging
past end of flow!"); }
-			
-			// Start damaging one line before the startPosition location in case some of the first
"damaged" line will fit on the previous line.
-			var lineIndex:int = findLineIndexAtPosition(startPosition);
-			var leaf:FlowLeafElement = textFlow.findLeaf(startPosition);
+
+            // find the line at damageStart
+            var lineIndex:int = findLineIndexAtPosition(startPosition);
+
+            // Start damaging one line before the startPosition location in case some of
the first "damaged" line will fit on the previous line.
+            var leaf:FlowLeafElement = textFlow.findLeaf(startPosition);
 			if (leaf && lineIndex > 0)
 				lineIndex--;
 
@@ -367,6 +368,20 @@ package flashx.textLayout.compose
 			return _damageAbsoluteStart <= absolutePosition && _damageAbsoluteStart !=
textFlow.textLength;
 		}
 
+
+		/**
+		 * @copy IFlowComposer#isPotentiallyDamaged()
+		 *
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0
+		 */
+
+		public function isPotentiallyDamaged(absolutePosition:int):Boolean
+		{
+			return isDamaged(absolutePosition);
+		}
+
 		/** @private */
 		CONFIG::debug public function checkFirstDamaged():void
 		{

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2b0977d2/textLayout/src/flashx/textLayout/compose/IFlowComposer.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/compose/IFlowComposer.as b/textLayout/src/flashx/textLayout/compose/IFlowComposer.as
index 2b5a700..fc461de 100644
--- a/textLayout/src/flashx/textLayout/compose/IFlowComposer.as
+++ b/textLayout/src/flashx/textLayout/compose/IFlowComposer.as
@@ -431,7 +431,23 @@ package flashx.textLayout.compose
 	 	 */
 	 	 
 		function isDamaged(absolutePosition:int):Boolean;
-		
+
+		/**
+		 * Indicates whether any TextFlowLine objects between the beginning of the flow and the
line containing the content at
+		 * the specified position are marked as damaged OR if there are other clues that the textFlow
should be rebuilt.
+		 *
+		 * @param absolutePosition the last position in the area of interest
+		 * @return 	true if any of the TextFlowLine objects from the start of the flow up to the
line containing the content at
+		 * <code>absolutePosition</code> are marked as damaged OR if there are other
reasons to believe the textFlow is damaged.
+		 *
+         * @see flashx.textLayout.compose.IFlowComposer#isDamaged()
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0
+	 	 */
+
+		function isPotentiallyDamaged(absolutePosition:int):Boolean;
+
 		
 		/** 
 		 * True, if the flow composer is currently performing a composition operation.

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2b0977d2/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as b/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as
index ca4b66e..9c93e94 100644
--- a/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as
+++ b/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as
@@ -628,10 +628,10 @@ package flashx.textLayout.compose
 		//--------------------------------------------------------------------------
 		
 		/** @private Override required because we may be damaged if the last container has scrolling
*/
-		public override function isDamaged(absolutePosition:int):Boolean
+		public override function isPotentiallyDamaged(absolutePosition:int):Boolean
 		{
 			// Returns true if any text from _damageAbsoluteStart through absolutePosition needs to
be recomposed
-			if (!super.isDamaged(absolutePosition))
+			if (!super.isPotentiallyDamaged(absolutePosition))
 			{	
 				if (absolutePosition == _textFlow.textLength)
 				{

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2b0977d2/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 a000035..58a93ad 100644
--- a/textLayout/src/flashx/textLayout/container/ContainerController.as
+++ b/textLayout/src/flashx/textLayout/container/ContainerController.as
@@ -47,6 +47,7 @@ package flashx.textLayout.container
     import flashx.textLayout.compose.FlowDamageType;
     import flashx.textLayout.compose.IFlowComposer;
     import flashx.textLayout.compose.TextFlowLine;
+    import flashx.textLayout.compose.TextFlowTableBlock;
     import flashx.textLayout.compose.TextLineRecycler;
     import flashx.textLayout.debug.Debugging;
     import flashx.textLayout.debug.assert;
@@ -55,6 +56,7 @@ package flashx.textLayout.container
     import flashx.textLayout.edit.ISelectionManager;
     import flashx.textLayout.edit.SelectionFormat;
     import flashx.textLayout.elements.BackgroundManager;
+    import flashx.textLayout.elements.CellCoordinates;
     import flashx.textLayout.elements.Configuration;
     import flashx.textLayout.elements.ContainerFormattedElement;
     import flashx.textLayout.elements.FlowElement;
@@ -63,6 +65,9 @@ package flashx.textLayout.container
     import flashx.textLayout.elements.InlineGraphicElement;
     import flashx.textLayout.elements.ParagraphElement;
     import flashx.textLayout.elements.TCYElement;
+    import flashx.textLayout.elements.TableBlockContainer;
+    import flashx.textLayout.elements.TableCellElement;
+    import flashx.textLayout.elements.TableRowElement;
     import flashx.textLayout.elements.TextFlow;
     import flashx.textLayout.events.FlowElementMouseEventManager;
     import flashx.textLayout.events.ModelChange;
@@ -79,55 +84,8 @@ package flashx.textLayout.container
     import flashx.textLayout.utils.Twips;
 
     use namespace tlf_internal;
-	
-	import flashx.textLayout.compose.FloatCompositionData;
-	import flashx.textLayout.compose.FlowComposerBase;
-	import flashx.textLayout.compose.FlowDamageType;
-	import flashx.textLayout.compose.IFlowComposer;
-	import flashx.textLayout.compose.TextFlowLine;
-	import flashx.textLayout.compose.TextFlowTableBlock;
-	import flashx.textLayout.compose.TextLineRecycler;
-	import flashx.textLayout.debug.Debugging;
-	import flashx.textLayout.debug.assert;
-	import flashx.textLayout.edit.EditingMode;
-	import flashx.textLayout.edit.IInteractionEventHandler;
-	import flashx.textLayout.edit.ISelectionManager;
-	import flashx.textLayout.edit.SelectionFormat;
-	import flashx.textLayout.elements.BackgroundManager;
-	import flashx.textLayout.elements.CellCoordinates;
-	import flashx.textLayout.elements.CellRange;
-	import flashx.textLayout.elements.Configuration;
-	import flashx.textLayout.elements.ContainerFormattedElement;
-	import flashx.textLayout.elements.FlowElement;
-	import flashx.textLayout.elements.FlowLeafElement;
-	import flashx.textLayout.elements.FlowValueHolder;
-	import flashx.textLayout.elements.InlineGraphicElement;
-	import flashx.textLayout.elements.LinkElement;
-	import flashx.textLayout.elements.ParagraphElement;
-	import flashx.textLayout.elements.TableBlockContainer;
-	import flashx.textLayout.elements.TableCellElement;
-	import flashx.textLayout.elements.TableElement;
-	import flashx.textLayout.elements.TableRowElement;
-	import flashx.textLayout.elements.TextFlow;
-	import flashx.textLayout.events.FlowElementMouseEvent;
-	import flashx.textLayout.events.FlowElementMouseEventManager;
-	import flashx.textLayout.events.ModelChange;
-	import flashx.textLayout.events.ScrollEvent;
-	import flashx.textLayout.events.ScrollEventDirection;
-	import flashx.textLayout.events.TextLayoutEvent;
-	import flashx.textLayout.events.UpdateCompleteEvent;
-	import flashx.textLayout.formats.BlockProgression;
-	import flashx.textLayout.formats.Float;
-	import flashx.textLayout.formats.FormatValue;
-	import flashx.textLayout.formats.ITextLayoutFormat;
-	import flashx.textLayout.formats.TextLayoutFormat;
-	import flashx.textLayout.property.Property;
-	import flashx.textLayout.tlf_internal;
-	import flashx.textLayout.utils.Twips;
-	
-	use namespace tlf_internal;
-	
-	/** 
+
+	/**
 	 * The ContainerController class defines the relationship between a TextFlow object and
a container.
 	 * A TextFlow may have one or more rectangular areas that can hold text; the text is said
to be flowing
 	 * through the containers. Each container is a Sprite that is the parent DisplayObject for
the TextLines.
@@ -722,7 +680,7 @@ package flashx.textLayout.container
 		
 		public function isDamaged():Boolean
 		{
-			return flowComposer.isDamaged(absoluteStart + _textLength);
+			return flowComposer.isPotentiallyDamaged(absoluteStart + _textLength);
 		}
 		
 		/** called whenever the container attributes are changed.  Mark computed attributes and
columnstate as out of date. 

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2b0977d2/textLayout/src/flashx/textLayout/container/TextContainerManager.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/container/TextContainerManager.as b/textLayout/src/flashx/textLayout/container/TextContainerManager.as
index a89566a..99ccce3 100644
--- a/textLayout/src/flashx/textLayout/container/TextContainerManager.as
+++ b/textLayout/src/flashx/textLayout/container/TextContainerManager.as
@@ -475,7 +475,7 @@ package flashx.textLayout.container
 	 	 * @langversion 3.0
 	 	 */
 		public function isDamaged():Boolean
-		{ return _composeState == COMPOSE_FACTORY ? _damaged : _textFlow.flowComposer.isDamaged(_textFlow.textLength);
}
+		{ return _composeState == COMPOSE_FACTORY ? _damaged : _textFlow.flowComposer.isPotentiallyDamaged(_textFlow.textLength);
}
 		
 		/** Editing mode of this TextContainerManager. Modes are reading only, reading and selection
permitted, 
 		 * and editing (reading, selection, and writing)  permitted. Use the constant values of
the EditingMode

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/2b0977d2/textLayout/src/flashx/textLayout/elements/TableCellElement.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/TableCellElement.as b/textLayout/src/flashx/textLayout/elements/TableCellElement.as
index 197d4c9..c734010 100644
--- a/textLayout/src/flashx/textLayout/elements/TableCellElement.as
+++ b/textLayout/src/flashx/textLayout/elements/TableCellElement.as
@@ -91,7 +91,7 @@ package flashx.textLayout.elements
 		}
 
 		public function isDamaged():Boolean {
-			return _damaged || (_textFlow && _textFlow.flowComposer.isDamaged(_textFlow.textLength));
+			return _damaged || (_textFlow && _textFlow.flowComposer.isPotentiallyDamaged(_textFlow.textLength));
 		}
 		
 		private var _savedPaddingTop:Number = 0;
@@ -229,12 +229,12 @@ package flashx.textLayout.elements
 			damage();
 		}
 
-		public function get enableIME():Boolean
+		public function get enableIME():Boolean
 		{
 			return _enableIME;
 		}
 
-		public function set enableIME(value:Boolean):void
+		public function set enableIME(value:Boolean):void
 		{
 			_enableIME = value;
 		}
@@ -251,7 +251,7 @@ package flashx.textLayout.elements
 		/**
 		 * Gets the width.
 		 **/
-		public function get width():Number
+		public function get width():Number
 		{
 			return _width;
 		}
@@ -259,7 +259,7 @@ package flashx.textLayout.elements
 		/**
 		 * @private
 		 **/
-		public function set width(value:Number):void
+		public function set width(value:Number):void
 		{
 			if(_width != value) {
 				_damaged = true;
@@ -273,7 +273,7 @@ package flashx.textLayout.elements
 		/**
 		 * Returns the height of the cell. 
 		 **/
-		public function get height():Number
+		public function get height():Number
 		{
 			//return getRowHeight(); not sure if we should always use row height
 			return _height;
@@ -282,7 +282,7 @@ package flashx.textLayout.elements
 		/**
 		 * @private
 		 **/
-		public function set height(value:Number):void
+		public function set height(value:Number):void
 		{
 			if (_height != value) {
 				_damaged = true;
@@ -313,23 +313,23 @@ package flashx.textLayout.elements
 			return getRow() ? getRow().composedHeight : NaN;
 		}
 
-		public function get rowSpan():uint
+		public function get rowSpan():uint
 		{
 			return _rowSpan;
 		}
 
-		public function set rowSpan(value:uint):void
+		public function set rowSpan(value:uint):void
 		{
 			if(value >= 1)
 				_rowSpan = value;
 		}
 
-		public function get columnSpan():uint
+		public function get columnSpan():uint
 		{
 			return _columnSpan;
 		}
 
-		public function set columnSpan(value:uint):void
+		public function set columnSpan(value:uint):void
 		{
 			if(value >= 1)
 				_columnSpan = value;
@@ -364,22 +364,22 @@ package flashx.textLayout.elements
 			return table ? table.getPreviousCell(this) : null;
 		}
 
-		public function get x():Number
+		public function get x():Number
 		{
 			return container.x;
 		}
 
-		public function set x(value:Number):void
+		public function set x(value:Number):void
 		{
 			container.x = value;
 		}
 
-		public function get y():Number
+		public function get y():Number
 		{
 			return container.y;
 		}
 
-		public function set y(value:Number):void
+		public function set y(value:Number):void
 		{
 			container.y = value;
 		}
@@ -446,12 +446,12 @@ package flashx.textLayout.elements
 			return paddingAmount;
 		}
 
-		public function get includeDescentInCellBounds():Boolean
+		public function get includeDescentInCellBounds():Boolean
 		{
 			return _includeDescentInCellBounds;
 		}
 
-		public function set includeDescentInCellBounds(value:Boolean):void
+		public function set includeDescentInCellBounds(value:Boolean):void
 		{
 			_includeDescentInCellBounds = value;
 		}


Mime
View raw message