• Emily Stark's avatar
    Simplified domain display: fix URL jumping around · 3939afe7
    Emily Stark authored
    This CL fixes horizontal and vertical jumping when simplified domain
    omnibox field trials are enabled.
    
    For vertical jumping, we were using the height and vertical position
    returned from GetSubstringBounds(), but that doesn't always match the
    existing height and vertical position of the URL in the omnibox. To
    fix this, we now reuse the previous bounds' height and vertical
    position when eliding/uneliding to the simplified domain.
    
    Horizontal jumping was due to not taking the Textfield's border insets
    into account when eliding/uneliding. To fix this, when eliding or
    uneliding, we now set the display rect's x value to that of the
    previous bounds' x value, instead of 0, so that the leading edge of
    the display rect always stays in the same spot. When uneliding to the
    full URL, we reuse the logic from Textfield::OnBoundsChanged() (which
    has been factored out into its own method) to reset the Textfield's
    display rect to its local bounds.
    
    Bug: 1101674
    Change-Id: Ia32420a2d4365910267acd05b86cd299204b7e95
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283655
    Commit-Queue: Emily Stark <estark@chromium.org>
    Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
    Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#786011}
    3939afe7
textfield.h 27 KB