Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-35078

Fatal when SelectionManager tries to reapply selection onto changed textFlow

    XMLWordPrintableJSON

Details

    Description

      Steps to reproduce:

      • run the attached mxml
      • click on the "Bullets" button

      Expected results: the bullet text is removed from the paragraph and the RichEditableText is focused.
      Actual results: the bullet text is removed, but when the focus moves back to the RichEditableText component, the following fatal is thrown:

      [Fault] exception, information=RangeError: Error #2006: The supplied index is out of bounds.
      at flash.text.engine::TextLine/getAtomBidiLevel()
      at flashx.textLayout.compose::TextFlowLine/adjustEndElementForBidi()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\flashx\textLayout\compose\TextFlowLine.as:2499]
      at flashx.textLayout.compose::TextFlowLine/makeSelectionBlocks()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\flashx\textLayout\compose\TextFlowLine.as:1812]
      at flashx.textLayout.compose::TextFlowLine/http://ns.adobe.com/textLayout/internal/2008::calculateSelectionBounds()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\flashx\textLayout\compose\TextFlowLine.as:1517]
      at flashx.textLayout.compose::TextFlowLine/getSelectionShapesCacheEntry()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\flashx\textLayout\compose\TextFlowLine.as:1428]
      at flashx.textLayout.compose::TextFlowLine/createSelectionShapes()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\flashx\textLayout\compose\TextFlowLine.as:1664]
      at flashx.textLayout.compose::TextFlowLine/http://ns.adobe.com/textLayout/internal/2008::hiliteBlockSelection()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\flashx\textLayout\compose\TextFlowLine.as:2196]
      at flashx.textLayout.container::ContainerController/http://ns.adobe.com/textLayout/internal/2008::addSelectionShapes()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\container\ContainerController.as:2920]
      at flashx.textLayout.edit::SelectionManager/addSelectionShapes()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\edit\SelectionManager.as:1240]
      at flashx.textLayout.edit::SelectionManager/refreshSelection()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\edit\SelectionManager.as:1272]
      at flashx.textLayout.edit::SelectionManager/http://ns.adobe.com/textLayout/internal/2008::setSelectionFormatState()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\edit\SelectionManager.as:896]
      at flashx.textLayout.edit::SelectionManager/focusInHandler()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\edit\SelectionManager.as:2279]
      at flashx.textLayout.container::ContainerController/focusInHandler()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\container\ContainerController.as:2452]
      at flashx.textLayout.container::TextContainerManager/focusInHandler()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\container\TextContainerManager.as:2089]
      at spark.components.supportClasses::RichEditableTextContainerManager/focusInHandler()[C:\Users\evolverine\workspace\flex-sdk\frameworks\projects\spark\src\spark\components\supportClasses\RichEditableTextContainerManager.as:642]
      at flashx.textLayout.container::ContainerController/http://ns.adobe.com/textLayout/internal/2008::requiredFocusInHandler()[C:\Users\evolverine\workspace\tlf\textLayout\src\flashx\textLayout\container\ContainerController.as:2470]
      at flash.display::Stage/set focus()
      at mx.core::UIComponent/setFocus()[C:\Users\evolverine\workspace\flex-sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:10437]
      at spark.components::RichEditableText/setFocus()[C:\Users\evolverine\workspace\flex-sdk\frameworks\projects\spark\src\spark\components\RichEditableText.as:3122]
      at Main/bulletList_clickHandler()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\Main.mxml:39]
      at Main/__bulletsButton_click()[C:\Users\evolverine\Adobe Flash Builder 4.7\FLEX-33058\src\Main.mxml:71]
      

      Workaround: call display.validateNow(); before display.setFocus();
      Notes:

      • couldn't reproduce the bug with only one line; we seem to need the text to wrap around the second line.
      • couldn't reproduce the bug if the span representing the bullet text wasn't set to an explicit font size (of any value).
      • could reproduce the bug with many random (non-empty) strings for the bullet text, including one space.
      • could reproduce the bug when I set the fontWeight instead of the fontSize on the bullet span. It seems that anything that will get the bullet placed into a separate span rather than merged with the span containing the main text will reproduce the bug.

      Attachments

        1. Main.mxml
          2 kB
          Mihai Chira

        Issue Links

          Activity

            People

              harbs Harbs
              evolverine Mihai Chira
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: