Repository: flex-asjs Updated Branches: refs/heads/develop 4eb3eaf38 -> 397cfc19b
Made the text values of Tables consistant. Fixed merging when span is after a table. These changes should be back-ported to the original TLF as well. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/397cfc19 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/397cfc19 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/397cfc19 Branch: refs/heads/develop Commit: 397cfc19bf7e360b31efd7f45e95176127aba8fb Parents: 4eb3eaf Author: Harbs <ha...@in-tools.com> Authored: Tue Jul 25 20:37:28 2017 +0300 Committer: Harbs <ha...@in-tools.com> Committed: Tue Jul 25 20:37:28 2017 +0300 ---------------------------------------------------------------------- .../org/apache/flex/textLayout/elements/ParagraphElement.as | 2 +- .../flex/org/apache/flex/textLayout/elements/SpanElement.as | 4 +++- .../flex/org/apache/flex/textLayout/elements/TableElement.as | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/397cfc19/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 04e7cd5..1f8129b 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 @@ -100,7 +100,7 @@ package org.apache.flex.textLayout.elements 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 + if(!tf)// if it's not in a text flow, we cannot create text blocks yet return; // CONFIG::debug { assert(_textBlock == null,"createTextBlock called when there is already a textblock"); } calculateComputedFormat(); // recreate the format BEFORE the _textBlock is created http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/397cfc19/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as index 0862061..15cf8a1 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as @@ -533,7 +533,9 @@ package org.apache.flex.textLayout.elements if (myidx != 0) { var sib:SpanElement = parent.getChildAt(myidx-1) as SpanElement; - + // If the previous sibling is a TableElement, we need to preserve the span. + if(sib.className == "TableElement") + return false; // If the element we're checking for merge has only the terminator, and the previous element // is not a Span, then we always merge with the previous span (NOT the previous sib). // We just remove this span, and add the terminator to the previous span. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/397cfc19/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/TableElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/TableElement.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/TableElement.as index d9a1fa8..59d11c5 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/TableElement.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/TableElement.as @@ -1327,6 +1327,14 @@ package org.apache.flex.textLayout.elements { override public function get textLength():int{ return 1; } + /* @private */ + override public function getText(relativeStart:int = 0, relativeEnd:int = -1, paragraphSeparator:String = "\n"):String + { + //TODO The code in ParagraphElement.getText() returns no text for tables. + // This is to ensure the results match when the TextBlocks are not created yet. + return ""; + // return "\uFDEF"; + } /** * Returns the cell at the specified row and column.