Repository: flex-tlf
Updated Branches:
  refs/heads/develop 095a165a5 -> 235cd97ee


Moved the logic for composing the table on cell resizing out of EditManager and 
into StandardFlowComposer where it belongs.


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

Branch: refs/heads/develop
Commit: 235cd97ee0ef17ac21bdd1a55081fee6ee5d9b54
Parents: 095a165
Author: Harbs <[email protected]>
Authored: Mon Dec 28 18:39:53 2015 +0200
Committer: Harbs <[email protected]>
Committed: Mon Dec 28 18:39:53 2015 +0200

----------------------------------------------------------------------
 .../textLayout/compose/StandardFlowComposer.as  | 26 ++++++++++++++++++--
 .../src/flashx/textLayout/edit/EditManager.as   | 23 -----------------
 2 files changed, 24 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/235cd97e/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 9c93e94..5557167 100644
--- a/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as
+++ b/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as
@@ -20,7 +20,7 @@ package flashx.textLayout.compose
 {
     import flash.display.Sprite;
     import flash.system.Capabilities;
-
+    
     import flashx.textLayout.accessibility.TextAccImpl;
     import flashx.textLayout.container.ContainerController;
     import flashx.textLayout.container.ScrollPolicy;
@@ -28,8 +28,11 @@ package flashx.textLayout.compose
     import flashx.textLayout.edit.ISelectionManager;
     import flashx.textLayout.elements.BackgroundManager;
     import flashx.textLayout.elements.ContainerFormattedElement;
+    import flashx.textLayout.elements.TableCellElement;
+    import flashx.textLayout.elements.TableElement;
     import flashx.textLayout.elements.TextFlow;
     import flashx.textLayout.events.CompositionCompleteEvent;
+    import flashx.textLayout.events.ModelChange;
     import flashx.textLayout.formats.BlockProgression;
     import flashx.textLayout.tlf_internal;
 
@@ -550,7 +553,15 @@ package flashx.textLayout.compose
                        //CONFIG::debug { 
assert(!_composing,"updateToController: compose in process"); }
                        if (_composing)
                                return false;
-                               
+                       
+                       var cellHeight:Number = 0;
+                       if(textFlow.nestedInTable())
+                       {
+                               var controller:ContainerController = 
getControllerAt(0);
+                               if (controller)
+                                       cellHeight = 
controller.container.height;
+
+                       }
                        //note that this will always update the display AND 
update the
                        //selection.  So, even if nothing has changed that 
would cause
                        //a recompose, the selection would still be redrawn.
@@ -563,6 +574,17 @@ package flashx.textLayout.compose
                        if (shapesDamaged)
                                updateCompositionShapes();
 
+                       // recompose the containing table if the cell height 
changed.
+                       // This should be ok because updateAllControllers() 
should be ignored if the parent textFlow is in middle of a compose.
+                       if(cellHeight && controller.container.height != 
cellHeight)
+                       {
+                               var table:TableElement = 
(textFlow.parentElement as TableCellElement).getTable();
+                               
table.modelChanged(ModelChange.ELEMENT_MODIFIED, table, 0, table.textLength);
+                               
table.getTextFlow().flowComposer.updateAllControllers();
+                               if(sm && sm.focused)
+                                       controller.setFocus();
+                       }
+
                        if (sm)
                                sm.refreshSelection();
                        return shapesDamaged;

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/235cd97e/textLayout/src/flashx/textLayout/edit/EditManager.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/edit/EditManager.as 
b/textLayout/src/flashx/textLayout/edit/EditManager.as
index 0eaafeb..b0ab077 100644
--- a/textLayout/src/flashx/textLayout/edit/EditManager.as
+++ b/textLayout/src/flashx/textLayout/edit/EditManager.as
@@ -852,19 +852,8 @@ package flashx.textLayout.edit
                                redrawListener = null;
                        }
 
-                       var cellHeight:Number = 0;
                        if (textFlow.flowComposer)
                        {
-                               if(superManager && superManager is IEditManager)
-                               {
-                                       var controller:ContainerController = 
textFlow.flowComposer.getControllerAt(0);
-                                       if (controller)
-                                       {
-                                               cellHeight = 
controller.container.height;
-                                       }
-                               }
-
-
                                 textFlow.flowComposer.updateAllControllers(); 
 
                                // Scroll to selection
@@ -874,18 +863,6 @@ package flashx.textLayout.edit
                                        if (controllerIndex >= 0)
                                                
textFlow.flowComposer.getControllerAt(controllerIndex).scrollToRange(activePosition,anchorPosition);
    
                                }
-                               if(superManager && superManager is IEditManager)
-                               {
-                                       if(controller.container.height != 
cellHeight)
-                                       {
-                                               var setFormat:String = 
selectionFormatState;
-                                               var table:TableElement = 
(textFlow.parentElement as TableCellElement).getTable();
-                                               
table.modelChanged(ModelChange.ELEMENT_MODIFIED, table, 0, table.textLength);
-                                               (superManager as 
IEditManager).updateAllControllers();
-                                               if(setFormat == 
SelectionFormatState.FOCUSED)
-                                                       setFocus();
-                                       }
-                               }
                        }
 
                        selectionChanged(true, false);

Reply via email to