Add a URL elision method tailored for a URL bar

Desktop / Chromium - Christopher Grant [chromium.org] - 9 October 2017 11:47 EDT

VR mode currently shows a read-only URL bar. We currently bail from VR if the hostname doesn't fit on the bar, but we should be eliding instead.

Enamel's current guidance for this scenario is to elide from the right until we've chopped the path and related parts, then continue to elide from the front, preserving the TLD as long as possible. This is different from other elision helpers currently available.

This method, and the original ElideUrl() method, should converge incrementally to a single algorithm.

BUG=753789

Change-Id: I19464f00df8f3e87743bbb19f857210164f810c3 Reviewed-on: https://chromium-review.googlesource.com/627121 Commit-Queue: Christopher Grant

6871e12 Add a URL elision method tailored for a URL bar
components/url_formatter/BUILD.gn | 7 +-
components/url_formatter/elide_url.cc | 138 ++++++++++++-
components/url_formatter/elide_url.h | 23 ++-
components/url_formatter/elide_url_unittest.cc | 259 ++++++++++++++++++++++---
4 files changed, 391 insertions(+), 36 deletions(-)

Upstream: git.chromium.org


  • Share