• Allen Bauer's avatar
    TreeView on node deletion, select adjacent node before selecting parent node. · 1a372585
    Allen Bauer authored
    Previous behavior would always select the parent node when a child was deleted. Unless the node was a child of the root node and the root wasn't visible, then select the first child of the root node.
    
    Now the behavior will select the child node after the deleted node(s). If the deleted node was the last node and more children remain, then select the new last node. If there are no remaining children, then select the parent node.
    
    Scenario 1 - Simple delete of child node
    
    root
    +--child1
       +--child1
       +--|child2|  <--- Delete this node.
       +--child3
    
    Result:
    
    root
    +--child1
       +--child1
       +--|child3|
    
    Scenario 2 - Delete of a immediate child of the non-visible root.
    
    >Child1
    >Child2
    >|Child3|   <--- Delete this node.
    >Child4
    
    Result:
    
    >Child1
    >Child2
    >|Child4|
    
    Scenario 3 - Delete of last child node (other children remain).
    
    root
    +--child1
       +--child1
       +--child2
       +--|child3|  <--- Delete this node.
    
    Result:
    
    root
    +--child1
       +--child1
       +--|child2|
    
    Scenario 4 - Delete of last child node (no children remain).
    
    root
    +--child1
       +--|child1|  <--- Delete this node.
    
    Result:
    
    root
    +--|child1|
    
    Bug: 991304
    Change-Id: I26bf90fd89b3d0d946bf73b7c1047621ca35308a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761299
    Auto-Submit: Allen Bauer <kylixrd@chromium.org>
    Commit-Queue: Robert Liao <robliao@chromium.org>
    Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#689248}
    1a372585
tree_view_unittest.cc 14.4 KB