• Emily Stark's avatar
    Simplified domain display: fix bug that bails out with narrow omnibox · e9d8ac22
    Emily Stark authored
    This CL fixes a bug where we were incorrectly bailing out on
    simplified domain elision all together when the whole URL doesn't fit
    in the omnibox.
    
    As background, note that the simplified domain field trials code sets
    the steady-state omnibox's RenderText into NO_ELIDE mode. This is
    because RenderText over-elides when a display offset has caused part
    of the text to scroll offscreen. (I'm not sure if this RenderText
    behavior is a bug or not, but it's tracked at crbug.com/1099078.) The
    bug is that ElideURL() was bailing out early if the RenderText() didn't
    fit the whole URL; instead we want to switch the RenderText into
    NO_ELIDE mode and then elide in OmniboxViewViews as best we can.
    (Currently, if the full domain doesn't fit, we elide from the right,
    but a follow-up CL implements left-edge elision which is better from a
    security perspective.)
    
    This change also serves as a speculative fix for crbug.com/1107912,
    which I can't reproduce. In that bug, the omnibox seems to somehow get
    set back into ELIDE_TAIL mode when switching tabs, so that ElideURL()
    early-returns when landing on a different tab instead of properly
    eliding to the simplified domain. I'm not sure how the omnibox would
    be getting set back into ELIDE_TAIL mode, but if this fix makes the
    problem go away, then it confirms the theory that that is indeed
    what's happening.
    
    Bug: 1107912
    Change-Id: I22ede3b875bac343a6d01fc8d5d8aeb25c2bb5e6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2348156
    Commit-Queue: Emily Stark <estark@chromium.org>
    Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#797148}
    e9d8ac22
omnibox_view_views.h 29.3 KB