You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2014/11/17 23:33:18 UTC

git commit: [flex-tlf] [refs/heads/tables] - Fixed vertical placement of table blocks to take into account the previous line descent and paragraph space before/space after.

Repository: flex-tlf
Updated Branches:
  refs/heads/tables 8db7a4a2e -> 135709a2c


Fixed vertical placement of table blocks to take into account the previous line descent and paragraph space before/space after.


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

Branch: refs/heads/tables
Commit: 135709a2ce8b0ad03b40a07d1c71abe1260b60d0
Parents: 8db7a4a
Author: Harbs <ha...@in-tools.com>
Authored: Tue Nov 18 00:32:54 2014 +0200
Committer: Harbs <ha...@in-tools.com>
Committed: Tue Nov 18 00:32:54 2014 +0200

----------------------------------------------------------------------
 .../flashx/textLayout/compose/BaseCompose.as    | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/135709a2/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 b051036..6107c2f 100644
--- a/textLayout/src/flashx/textLayout/compose/BaseCompose.as
+++ b/textLayout/src/flashx/textLayout/compose/BaseCompose.as
@@ -548,6 +548,8 @@ package flashx.textLayout.compose
 			var curTableBlock:TextFlowTableBlock = tableElement.getFirstBlock();
 			curTableBlock.clear();
 			curTableBlock.y = _parcelList.totalDepth;
+			var adjustTop:Number = isNaN(_lastLineDescent) ? 0 : _lastLineDescent;
+			curTableBlock.y += adjustTop;
 			curTableBlock.x = _lineSlug.leftMargin;
 			var lineOffset:Number = (_curParaFormat.direction == Direction.LTR) ? _lineSlug.leftMargin : _lineSlug.rightMargin;
 			curTableBlock.initialize(_curParaElement, _lineSlug.width, lineOffset-_parcelList.insideListItemMargin, tableElement.getAbsoluteStart(),1);
@@ -1073,6 +1075,9 @@ package flashx.textLayout.compose
 			var result:Boolean = true;
 			var textLine:TextLine;
 			
+			var spaceBefore:Number;
+			var spaceCarried:Number;
+			
 			var leftMargin:Number;
 			var rightMargin:Number;
 			
@@ -1124,6 +1129,18 @@ package flashx.textLayout.compose
 				var curChild:FlowElement = _curParaElement.getChildAt(_curParaElement.findChildIndexAtPosition(_curElementStart - _curParaStart));
 				if(curChild is TableElement)
 				{
+					// Space before does not apply to the first line, unless LeadingModel.BOX is used
+					// Space carried never applies to the first line
+					spaceBefore = isNaN(_curParaElement.computedFormat.paragraphSpaceBefore) ? 0 : _curParaElement.computedFormat.paragraphSpaceBefore;
+					spaceBefore  = _atColumnStart ? 0 : spaceBefore;
+					spaceCarried = _atColumnStart ? 0 : _paragraphSpaceCarried;
+					if (spaceBefore != 0 || spaceCarried != 0)
+						_parcelList.addTotalDepth(Math.max(spaceBefore, spaceCarried));
+					
+					_paragraphSpaceCarried = 0;
+					if (_verticalSpaceCarried != 0)
+						_verticalSpaceCarried = 0;
+					
 					if(!composeTableElement(curChild as TableElement, _curElementStart))
 						return false;
 					
@@ -1215,8 +1232,8 @@ package flashx.textLayout.compose
 				
 				// Space before does not apply to the first line, unless LeadingModel.BOX is used
 				// Space carried never applies to the first line
-				var spaceBefore:Number  = _atColumnStart && (_curParaFormat.leadingModel != LeadingModel.BOX) ? 0 : _curLine.spaceBefore;
-				var spaceCarried:Number = _atColumnStart ? 0 : _paragraphSpaceCarried;
+				spaceBefore  = _atColumnStart && (_curParaFormat.leadingModel != LeadingModel.BOX) ? 0 : _curLine.spaceBefore;
+				spaceCarried = _atColumnStart ? 0 : _paragraphSpaceCarried;
 				if (spaceBefore != 0 || spaceCarried != 0)
 					_parcelList.addTotalDepth(Math.max(spaceBefore, spaceCarried));