Commit 5b3e9042 authored by Emily Stark's avatar Emily Stark Committed by Commit Bot

Simplified domain: Further kill the edit bump

The previous CL in this chain reveals trivial subdomain and scheme
when the URL is unelided on hover. This CL adds a hover animation to
the omnibox even before the user interacts with the page (in the
hide-on-interaction field trial). This allows the user to hover over
the omnibox to bring back the scheme and trivial subdomain even before
the URL has been elided to the simplified domain, thereby minimizing
the potential of having an edit bump before interacting the page as
well as after.

The main change is that we need to create the hover animation
earlier. Previously, we were creating it once the user interacts with
the page; now we create it on page load. Each elide/unelide operation
decides whether to use the full URL, partially elided URL (just scheme
and trivial subdomain hidden), or simplified domain based on whether
the user has interacted with the page yet or not.

Bug: 1101486
Change-Id: Id747929df56becadc34f0cb7a581494f4d90df5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2291310
Commit-Queue: Emily Stark <estark@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#788837}
parent 52334214
...@@ -173,6 +173,9 @@ class OmniboxViewViews : public OmniboxView, ...@@ -173,6 +173,9 @@ class OmniboxViewViews : public OmniboxView,
FRIEND_TEST_ALL_PREFIXES( FRIEND_TEST_ALL_PREFIXES(
OmniboxViewViewsHideOnInteractionAndRevealOnHoverTest, OmniboxViewViewsHideOnInteractionAndRevealOnHoverTest,
UserInteractionAndHover); UserInteractionAndHover);
FRIEND_TEST_ALL_PREFIXES(
OmniboxViewViewsHideOnInteractionAndRevealOnHoverTest,
SchemeAndTrivialSubdomainElision);
FRIEND_TEST_ALL_PREFIXES( FRIEND_TEST_ALL_PREFIXES(
OmniboxViewViewsHideOnInteractionAndRevealOnHoverTest, OmniboxViewViewsHideOnInteractionAndRevealOnHoverTest,
HideOnInteractionAfterFocusAndBlur); HideOnInteractionAfterFocusAndBlur);
...@@ -447,16 +450,27 @@ class OmniboxViewViews : public OmniboxView, ...@@ -447,16 +450,27 @@ class OmniboxViewViews : public OmniboxView,
// display. // display.
void OnShouldPreventElisionChanged(); void OnShouldPreventElisionChanged();
// Elides or unelides to a simplified version of the URL. Callers should // The methods below elide to or unelide from a simplified version of the URL.
// ensure that the URL is valid before calling. // Callers should ensure that the URL is valid before calling.
// //
// These methods do not animate, but rather immediately elide/unelide. These // These methods do not animate, but rather immediately elide/unelide. These
// methods are used when we don't want to draw the user's attention to the URL // methods are used when we don't want to draw the user's attention to the URL
// simplification -- for example, if the URL is already simplified and the // simplification -- for example, if the URL is already simplified and the
// user performs a same-document navigation, we want to keep the URL // user performs a same-document navigation, we want to keep the URL
// simplified without it appearing to be a change from the user's perspective. // simplified without it appearing to be a change from the user's perspective.
void ElideToSimplifiedDomain();
void UnelideFromSimplifiedDomain(); // Elides the URL to a simplified version of the domain. This will be the
// registrable domain if OmniboxFieldTrial::ShouldElideToRegistrableDomain()
// is true; otherwise it is the hostname with trivial subdomains ("www.")
// elided. The scheme, path, and other components of the URL are hidden.
void ElideURL();
// Show the full URL, including scheme, all subdomains, and path.
void ShowFullURL();
// Shows the full URL and then elides http/https schemes and the
// "www." subdomain (if present) by setting the display rect to the width of
// the remaining URL and then setting the display offset to scroll the scheme
// and trivial subdomain offscreen.
void ShowFullURLWithoutSchemeAndTrivialSubdomain();
// Parses GetText() as a URL, trims trivial subdomains from it (if any and if // Parses GetText() as a URL, trims trivial subdomains from it (if any and if
// applicable), and returns the result. // applicable), and returns the result.
...@@ -483,26 +497,19 @@ class OmniboxViewViews : public OmniboxView, ...@@ -483,26 +497,19 @@ class OmniboxViewViews : public OmniboxView,
// //
// These animations are used by different field trials as described below. // These animations are used by different field trials as described below.
// When ShouldRevealPathQueryRefOnHover() is enabled but not // This animation is used to unelide or elide the URL
// ShouldHidePathQueryRefOnInteraction(), then the URL is elided in // when the mouse hovers or exits the omnibox. The URL will unelide to the
// EmphasizeUrlComponents() and |hover_elide_or_unelide_animation_| is created // full URL or a partially elided version (with scheme and trivial subdomains
// in OnThemeChanged(). This animation is used to unelide or elide the URL // elided) depending on whether the user has interacted with the page yet
// when the mouse hovers or exits the omnibox. // (when reveal-on-interaction is enabled).
std::unique_ptr<ElideAnimation> hover_elide_or_unelide_animation_; std::unique_ptr<ElideAnimation> hover_elide_or_unelide_animation_;
// When ShouldHidePathQueryRefOnInteraction() is enabled, we don't // When ShouldHidePathQueryRefOnInteraction() is enabled, when a
// create any animations until the user interacts with the page. When a
// navigation finishes, we unelide the URL if it was a full cross-document // navigation finishes, we unelide the URL if it was a full cross-document
// navigation. Once the user interacts with the page, we create and run // navigation. Once the user interacts with the page, we create and run
// |elide_after_interaction_animation_| to elide the URL. If // |elide_after_interaction_animation_| to elide the URL. After the first user
// ShouldRevealPathQueryRefOnHover() is also enabled, we defer the creation of // interaction, |elide_after_interaction_animation_| doesn't run again until
// |hover_elide_or_unelide_animation_| until the user interacts with the page // it's re-created after the next navigation. There are 2 separate animations
// as well, since we don't want to do any hover animations until the URL has // (one for after-interaction and one hovering) so that the state of the
// been elided after user interaction. After the first user interaction,
// |elide_after_interaction_animation_| doesn't run again until it's
// re-created after the next navigation, and
// |hover_elide_or_unelide_animation_| behaves as described above for the rest
// of the navigation. There are 2 separate animations (one for
// after-interaction and one hovering) so that the state of the
// after-interaction animation can be queried to know when the user has or has // after-interaction animation can be queried to know when the user has or has
// not already interacted with the page. // not already interacted with the page.
std::unique_ptr<ElideAnimation> elide_after_interaction_animation_; std::unique_ptr<ElideAnimation> elide_after_interaction_animation_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment