Move function flatten

Move a function 'flatten' in 'view.renderer.grid.arrangePositionAll' to 'textAeUtil'.
Because same functions used in the controller.