• Emily Stark's avatar
    Simplified domain display: improve elision with very narrow omnibox · 3fa22f9f
    Emily Stark authored
    This CL improves elision behavior in the simplified domain field
    trials when the omnibox is too narrow to fit the full hostname (or
    even the full registrable domain).
    
    The main change is that if the omnibox is too narrow, we scroll the
    domain to show as much of it as we can from the right. This is a
    partial fix, in the simplified domain field trials, for a longstanding
    security bug (crbug.com/527638). The behavior with this CL is still a
    little weird because there's no visual cue that the domain is
    truncated, but I think it's better than the status quo where we show
    the left edge of the domain in Chrome today (e.g., "google.com..."
    instead of "...evil.com").
    
    For simplicity, I've made it so that if the domain does not fit in the
    omnibox's bounds, we don't do any hover animations. I think this is
    okay from a UX perspective; after all, in this case, we're not eliding
    anything that the user wouldn't be able to see today. It's simplest to
    implement because ElideAnimation doesn't know anything about
    hostname/URL semantics and thus doesn't know that it should align the
    URL specially when the domain doesn't fit.
    
    Bug: 1107912,527638
    Change-Id: I0682582b95393ded82dfd6d56f5ab9d0859e92d0
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2342283
    Commit-Queue: Emily Stark <estark@chromium.org>
    Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#797440}
    3fa22f9f
omnibox_view_views.cc 110 KB