Commit 5b4208c4 authored by Ernesto García's avatar Ernesto García Committed by Commit Bot

omnibox: Rename elide_after_interaction_animation_

Renamed elide_after_interaction_animation to
elide_after_web_contents_interaction_animation_ as suggested, to avoid
confusion with hover_elide_or_unelide_animation_

Bug: 1106004
Change-Id: I1c1cba6e84f3d0a650905c26dff0fcc65709443c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2330532Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Commit-Queue: Ernesto García <ernestognw@google.com>
Cr-Commit-Position: refs/heads/master@{#793459}
parent 19e39043
...@@ -433,8 +433,8 @@ void OmniboxViewViews::EmphasizeURLComponents() { ...@@ -433,8 +433,8 @@ void OmniboxViewViews::EmphasizeURLComponents() {
// Cancel any existing simplified URL animations. // Cancel any existing simplified URL animations.
if (hover_elide_or_unelide_animation_) if (hover_elide_or_unelide_animation_)
hover_elide_or_unelide_animation_->Stop(); hover_elide_or_unelide_animation_->Stop();
if (elide_after_interaction_animation_) if (elide_after_web_contents_interaction_animation_)
elide_after_interaction_animation_->Stop(); elide_after_web_contents_interaction_animation_->Stop();
// If the current contents is a URL, turn on special URL rendering mode in // If the current contents is a URL, turn on special URL rendering mode in
// RenderText. // RenderText.
...@@ -1126,8 +1126,8 @@ void OmniboxViewViews::OnMouseMoved(const ui::MouseEvent& event) { ...@@ -1126,8 +1126,8 @@ void OmniboxViewViews::OnMouseMoved(const ui::MouseEvent& event) {
if (!IsURLEligibleForSimplifiedDomainEliding()) if (!IsURLEligibleForSimplifiedDomainEliding())
return; return;
if (elide_after_interaction_animation_) if (elide_after_web_contents_interaction_animation_)
elide_after_interaction_animation_->Stop(); elide_after_web_contents_interaction_animation_->Stop();
// When the reveal-on-hover field trial is enabled, we elide the path and // When the reveal-on-hover field trial is enabled, we elide the path and
// optionally subdomains of the URL. We bring back the URL when the user // optionally subdomains of the URL. We bring back the URL when the user
...@@ -1162,7 +1162,7 @@ void OmniboxViewViews::OnMouseMoved(const ui::MouseEvent& event) { ...@@ -1162,7 +1162,7 @@ void OmniboxViewViews::OnMouseMoved(const ui::MouseEvent& event) {
// uneliding from now. Otherwise, only the scheme and possibly a trivial // uneliding from now. Otherwise, only the scheme and possibly a trivial
// subdomain have been elided and those components now need to be faded in. // subdomain have been elided and those components now need to be faded in.
std::vector<gfx::Range> ranges_to_fade_in; std::vector<gfx::Range> ranges_to_fade_in;
if (elide_after_interaction_animation_ || if (elide_after_web_contents_interaction_animation_ ||
!OmniboxFieldTrial::ShouldHidePathQueryRefOnInteraction()) { !OmniboxFieldTrial::ShouldHidePathQueryRefOnInteraction()) {
GetSimplifiedDomainBounds(&ranges_to_fade_in); GetSimplifiedDomainBounds(&ranges_to_fade_in);
} else { } else {
...@@ -1208,7 +1208,7 @@ void OmniboxViewViews::OnMouseExited(const ui::MouseEvent& event) { ...@@ -1208,7 +1208,7 @@ void OmniboxViewViews::OnMouseExited(const ui::MouseEvent& event) {
// Figure out where to elide to. If the user has already interacted with the // Figure out where to elide to. If the user has already interacted with the
// page or reveal-on-interaction is disabled, then elide to the simplified // page or reveal-on-interaction is disabled, then elide to the simplified
// domain; otherwise just hide the scheme and trivial subdomain (if any). // domain; otherwise just hide the scheme and trivial subdomain (if any).
if (elide_after_interaction_animation_ || if (elide_after_web_contents_interaction_animation_ ||
!OmniboxFieldTrial::ShouldHidePathQueryRefOnInteraction()) { !OmniboxFieldTrial::ShouldHidePathQueryRefOnInteraction()) {
std::vector<gfx::Range> ranges_surrounding_simplified_domain; std::vector<gfx::Range> ranges_surrounding_simplified_domain;
gfx::Range simplified_domain = gfx::Range simplified_domain =
...@@ -1558,16 +1558,17 @@ void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { ...@@ -1558,16 +1558,17 @@ void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) {
// but we can't adapt running animations to new bounds. // but we can't adapt running animations to new bounds.
if (hover_elide_or_unelide_animation_) if (hover_elide_or_unelide_animation_)
hover_elide_or_unelide_animation_->Stop(); hover_elide_or_unelide_animation_->Stop();
if (elide_after_interaction_animation_) if (elide_after_web_contents_interaction_animation_)
elide_after_interaction_animation_->Stop(); elide_after_web_contents_interaction_animation_->Stop();
// |elide_after_interaction_animation_| is created when the user interacts // |elide_after_web_contents_interaction_animation_| is created when the user
// with the page, if hide-on-interaction is enabled. If hide-on-interaction is // interacts with the page, if hide-on-interaction is enabled. If
// disabled or the user has already interacted with the page, the simplified // hide-on-interaction is disabled or the user has already interacted with the
// domain should have been showing before the bounds changed (or we would have // page, the simplified domain should have been showing before the bounds
// been in the process of animating to the simplified domain). // changed (or we would have been in the process of animating to the
// simplified domain).
if (!OmniboxFieldTrial::ShouldHidePathQueryRefOnInteraction() || if (!OmniboxFieldTrial::ShouldHidePathQueryRefOnInteraction() ||
elide_after_interaction_animation_) { elide_after_web_contents_interaction_animation_) {
if (IsURLEligibleForSimplifiedDomainEliding() && if (IsURLEligibleForSimplifiedDomainEliding() &&
!model()->ShouldPreventElision()) { !model()->ShouldPreventElision()) {
ElideURL(); ElideURL();
...@@ -1768,12 +1769,12 @@ void OmniboxViewViews::DidFinishNavigation( ...@@ -1768,12 +1769,12 @@ void OmniboxViewViews::DidFinishNavigation(
// ensure the full URL (without scheme and trivial subdomain) is showing; // ensure the full URL (without scheme and trivial subdomain) is showing;
// this is done by falling through to ResetToHideOnInteraction() below. // this is done by falling through to ResetToHideOnInteraction() below.
// //
// |elide_after_interaction_animation_| is only created after the user // |elide_after_web_contents_interaction_animation_| is only created after
// interacts with the page (in DidGetUserInteraction()), so we use its // the user interacts with the page (in DidGetUserInteraction()), so we use
// existence to determine whether the user has interacted with the page yet // its existence to determine whether the user has interacted with the page
// or not. // yet or not.
if (elide_after_interaction_animation_) { if (elide_after_web_contents_interaction_animation_) {
if (!elide_after_interaction_animation_->IsAnimating()) if (!elide_after_web_contents_interaction_animation_->IsAnimating())
ElideURL(); ElideURL();
return; return;
} }
...@@ -1821,14 +1822,14 @@ void OmniboxViewViews::DidGetUserInteraction( ...@@ -1821,14 +1822,14 @@ void OmniboxViewViews::DidGetUserInteraction(
// Only create and run the animation if we haven't already done so on an // Only create and run the animation if we haven't already done so on an
// earlier call to this method. // earlier call to this method.
if (IsURLEligibleForSimplifiedDomainEliding() && if (IsURLEligibleForSimplifiedDomainEliding() &&
!elide_after_interaction_animation_) { !elide_after_web_contents_interaction_animation_) {
GetRenderText()->SetElideBehavior(gfx::NO_ELIDE); GetRenderText()->SetElideBehavior(gfx::NO_ELIDE);
elide_after_interaction_animation_ = elide_after_web_contents_interaction_animation_ =
std::make_unique<ElideAnimation>(this, GetRenderText()); std::make_unique<ElideAnimation>(this, GetRenderText());
std::vector<gfx::Range> ranges_surrounding_simplified_domain; std::vector<gfx::Range> ranges_surrounding_simplified_domain;
gfx::Range simplified_domain = gfx::Range simplified_domain =
GetSimplifiedDomainBounds(&ranges_surrounding_simplified_domain); GetSimplifiedDomainBounds(&ranges_surrounding_simplified_domain);
elide_after_interaction_animation_->Start( elide_after_web_contents_interaction_animation_->Start(
simplified_domain, 0 /* delay_ms */, simplified_domain, 0 /* delay_ms */,
ranges_surrounding_simplified_domain, ranges_surrounding_simplified_domain,
GetOmniboxColor(GetThemeProvider(), GetOmniboxColor(GetThemeProvider(),
...@@ -2340,7 +2341,7 @@ void OmniboxViewViews::ResetToHideOnInteraction() { ...@@ -2340,7 +2341,7 @@ void OmniboxViewViews::ResetToHideOnInteraction() {
// DidGetUserInteraction(). Recreate the hover animation now because the user // DidGetUserInteraction(). Recreate the hover animation now because the user
// can hover over the URL before interacting with the page to reveal the // can hover over the URL before interacting with the page to reveal the
// scheme and trivial subdomain (if any). // scheme and trivial subdomain (if any).
elide_after_interaction_animation_.reset(); elide_after_web_contents_interaction_animation_.reset();
hover_elide_or_unelide_animation_ = hover_elide_or_unelide_animation_ =
std::make_unique<OmniboxViewViews::ElideAnimation>(this, GetRenderText()); std::make_unique<OmniboxViewViews::ElideAnimation>(this, GetRenderText());
if (IsURLEligibleForSimplifiedDomainEliding()) if (IsURLEligibleForSimplifiedDomainEliding())
...@@ -2355,7 +2356,7 @@ void OmniboxViewViews::OnShouldPreventElisionChanged() { ...@@ -2355,7 +2356,7 @@ void OmniboxViewViews::OnShouldPreventElisionChanged() {
} }
if (model()->ShouldPreventElision()) { if (model()->ShouldPreventElision()) {
hover_elide_or_unelide_animation_.reset(); hover_elide_or_unelide_animation_.reset();
elide_after_interaction_animation_.reset(); elide_after_web_contents_interaction_animation_.reset();
if (IsURLEligibleForSimplifiedDomainEliding()) if (IsURLEligibleForSimplifiedDomainEliding())
ShowFullURL(); ShowFullURL();
return; return;
...@@ -2426,8 +2427,8 @@ void OmniboxViewViews::ShowFullURL() { ...@@ -2426,8 +2427,8 @@ void OmniboxViewViews::ShowFullURL() {
if (hover_elide_or_unelide_animation_) if (hover_elide_or_unelide_animation_)
hover_elide_or_unelide_animation_->Stop(); hover_elide_or_unelide_animation_->Stop();
if (elide_after_interaction_animation_) if (elide_after_web_contents_interaction_animation_)
elide_after_interaction_animation_->Stop(); elide_after_web_contents_interaction_animation_->Stop();
ApplyCaretVisibility(); ApplyCaretVisibility();
FitToLocalBounds(); FitToLocalBounds();
...@@ -2523,5 +2524,5 @@ OmniboxViewViews::GetHoverElideOrUnelideAnimationForTesting() { ...@@ -2523,5 +2524,5 @@ OmniboxViewViews::GetHoverElideOrUnelideAnimationForTesting() {
OmniboxViewViews::ElideAnimation* OmniboxViewViews::ElideAnimation*
OmniboxViewViews::GetElideAfterInteractionAnimationForTesting() { OmniboxViewViews::GetElideAfterInteractionAnimationForTesting() {
return elide_after_interaction_animation_.get(); return elide_after_web_contents_interaction_animation_.get();
} }
...@@ -515,13 +515,15 @@ class OmniboxViewViews : public OmniboxView, ...@@ -515,13 +515,15 @@ class OmniboxViewViews : public OmniboxView,
// When ShouldHidePathQueryRefOnInteraction() is enabled, when a // When ShouldHidePathQueryRefOnInteraction() is enabled, 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. After the first user // |elide_after_web_contents_interaction_animation_| to elide the URL. After
// interaction, |elide_after_interaction_animation_| doesn't run again until // the first user interaction,
// |elide_after_web_contents_interaction_animation_| doesn't run again until
// it's re-created after the next navigation. There are 2 separate animations // it's re-created after the next navigation. There are 2 separate animations
// (one for after-interaction and one hovering) so that the state of the // (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_web_contents_interaction_animation_;
// Selection persisted across temporary text changes, like popup suggestions. // Selection persisted across temporary text changes, like popup suggestions.
std::vector<gfx::Range> saved_temporary_selection_; std::vector<gfx::Range> saved_temporary_selection_;
......
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