flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject git commit: [flex-tlf] [refs/heads/develop] - Removing the last span from a paragraph was causing ensureTerminatorAfterReplace() to create a new terminatorSpan.
Date Wed, 03 Dec 2014 08:27:22 GMT
Repository: flex-tlf
Updated Branches:
  refs/heads/develop 0df892afb -> 632a153e0


Removing the last span from a paragraph was causing ensureTerminatorAfterReplace() to create
a new terminatorSpan.


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

Branch: refs/heads/develop
Commit: 632a153e06f10bae5bd9804bcc239a407737c7c1
Parents: 0df892a
Author: Harbs <harbs@in-tools.com>
Authored: Wed Dec 3 10:27:10 2014 +0200
Committer: Harbs <harbs@in-tools.com>
Committed: Wed Dec 3 10:27:10 2014 +0200

----------------------------------------------------------------------
 .../textLayout/elements/ParagraphElement.as     | 29 ++++++++++++--------
 1 file changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/632a153e/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/ParagraphElement.as b/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
index 51b8283..5db84d0 100644
--- a/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
+++ b/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
@@ -627,9 +627,10 @@ package flashx.textLayout.elements
 			var newLastLeaf:FlowLeafElement = getLastLeaf();
 			if (_terminatorSpan != newLastLeaf)
 			{
+				if(_terminatorSpan)
+					_terminatorSpan.removeParaTerminator();
 				if (newLastLeaf && _terminatorSpan)
 				{
-					_terminatorSpan.removeParaTerminator();
 					if(_terminatorSpan.textLength == 0)
 					{
 						var termIdx:int = getChildIndex(_terminatorSpan);
@@ -637,20 +638,24 @@ package flashx.textLayout.elements
 					}
 					this._terminatorSpan = null;
 				}
-				
-				if (newLastLeaf is SpanElement)
+				if(newLastLeaf)
 				{
-					(newLastLeaf as SpanElement).addParaTerminator();
-					this._terminatorSpan = newLastLeaf as SpanElement;
+					if (newLastLeaf is SpanElement)
+					{
+						(newLastLeaf as SpanElement).addParaTerminator();
+						this._terminatorSpan = newLastLeaf as SpanElement;
+					}
+					else
+					{
+						var s:SpanElement = new SpanElement();
+						super.replaceChildren(numChildren,numChildren,s);
+						s.format = newLastLeaf ? newLastLeaf.format : _terminatorSpan.format;
+						s.addParaTerminator();
+						this._terminatorSpan = s;
+					}
 				}
 				else
-				{
-					var s:SpanElement = new SpanElement();
-					super.replaceChildren(numChildren,numChildren,s);
-					s.format = newLastLeaf ? newLastLeaf.format : _terminatorSpan.format;
-					s.addParaTerminator();
-					this._terminatorSpan = s;
-				}
+					_terminatorSpan = null;
 			}
 			//merge terminator span to previous if possible
 			if(_terminatorSpan && _terminatorSpan.textLength == 1)


Mime
View raw message