Commit a973fa60 authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Remove omnibox suggestions from view tree when hidden.

This ensures we aren't running deferred runnables and reacting
to the omnibox positioning when the omnibox isn't focused.

BUG=512087,444670

Change-Id: Ie353c94caf9bbf753ea2c55dbb7974df78bcc9e4
Reviewed-on: https://chromium-review.googlesource.com/1091505Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565403}
parent d59785a3
...@@ -1358,7 +1358,6 @@ public class LocationBarLayout ...@@ -1358,7 +1358,6 @@ public class LocationBarLayout
// Ensure the results container is initialized and add the suggestion list to it. // Ensure the results container is initialized and add the suggestion list to it.
initOmniboxResultsContainer(); initOmniboxResultsContainer();
mOmniboxResultsContainer.addView(mSuggestionList);
// Start with visibility GONE to ensure that show() is called. http://crbug.com/517438 // Start with visibility GONE to ensure that show() is called. http://crbug.com/517438
mSuggestionList.setVisibility(GONE); mSuggestionList.setVisibility(GONE);
...@@ -1453,9 +1452,11 @@ public class LocationBarLayout ...@@ -1453,9 +1452,11 @@ public class LocationBarLayout
final boolean isShowing = mSuggestionList.isShown(); final boolean isShowing = mSuggestionList.isShown();
if (visible && !isShowing) { if (visible && !isShowing) {
mIgnoreOmniboxItemSelection = true; // Reset to default value. mIgnoreOmniboxItemSelection = true; // Reset to default value.
mOmniboxResultsContainer.addView(mSuggestionList);
mSuggestionList.show(); mSuggestionList.show();
} else if (!visible && isShowing) { } else if (!visible && isShowing) {
mSuggestionList.setVisibility(GONE); mSuggestionList.setVisibility(GONE);
mOmniboxResultsContainer.removeView(mSuggestionList);
} }
} }
maybeShowOmniboxResultsContainer(); maybeShowOmniboxResultsContainer();
......
...@@ -1099,6 +1099,7 @@ class SuggestionView extends ViewGroup { ...@@ -1099,6 +1099,7 @@ class SuggestionView extends ViewGroup {
@Override @Override
protected void onDetachedFromWindow() { protected void onDetachedFromWindow() {
removeCallbacks(mRelayoutRunnable);
if (mNavigationButton != null) mNavigationButton.removeOnLayoutChangeListener(this); if (mNavigationButton != null) mNavigationButton.removeOnLayoutChangeListener(this);
if (mUrlBar != null) mUrlBar.removeOnLayoutChangeListener(this); if (mUrlBar != null) mUrlBar.removeOnLayoutChangeListener(this);
if (mLocationBar != null) { if (mLocationBar != null) {
......
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