• Alex Newcomer's avatar
    cros: Fix menus getting squished · be913dcb
    Alex Newcomer authored
    Menu bounds do not fit new wider options if the menu options are added
    after the menu is initially drawn, and the width of the new options
    exceeds {screen_width - original_menu_origin.x}. This makes wide menu
    options unusable in some cases because the menu does not widen to
    accommodate the new items.
    
    Regression started: r573978
    
    Test case:
    1. Show a website with link[1] on the far right side of the screen:
    https://www.google.com/chromebook/
    2. Right click to show a menu on one of the links in the toolbar.
    
    The menu should be wide enough to show all contents of the menu.
    
    [1]Step 1 must have a link as the source of the menu because
    links use arc::OpenWithMenu, which can add wider ("Open with ...")
    options to a context menu. These options are added after the menu
    is drawn because we show the menu before arc calls back with the new
    menu options.
    
    Test: MenuControllerTest.GrowingMenuMovesLaterallyNotVertically
    Bug: 882662
    Change-Id: Ic848fdb545bbdd05f874041bf1044adb7bd1d094
    Reviewed-on: https://chromium-review.googlesource.com/c/1262397
    Commit-Queue: Alex Newcomer <newcomer@chromium.org>
    Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#600563}
    be913dcb
menu_controller.cc 105 KB