Commit c0fd3631 authored by tedchoc's avatar tedchoc Committed by Commit bot

Fix omnibox suggestions being overdrawn with the nav bar.

getLocationInWindow adjusts for the Android nav bar, while the
positioning of the parent is exclusive of the nav bar.  This causes
the suggestions be too bar left aligned and cut off.

Only visible if you have the nav bar aligned with the start of
the text (i.e. on the left with LTR text).

BUG=669150

Review-Url: https://codereview.chromium.org/2849283002
Cr-Commit-Position: refs/heads/master@{#468466}
parent 39852808
......@@ -35,6 +35,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.OmniboxResultItem;
import org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.OmniboxSuggestionDelegate;
import org.chromium.chrome.browser.omnibox.OmniboxSuggestion.MatchClassification;
import org.chromium.chrome.browser.util.ViewUtils;
import org.chromium.chrome.browser.widget.TintedDrawable;
import org.chromium.ui.base.DeviceFormFactor;
......@@ -862,7 +863,8 @@ class SuggestionView extends ViewGroup {
private int getUrlBarLeftOffset() {
if (mLocationBar.mustQueryUrlBarLocationForSuggestions()) {
mUrlBar.getLocationInWindow(mViewPositionHolder);
View contentView = getRootView().findViewById(android.R.id.content);
ViewUtils.getRelativeLayoutPosition(contentView, mUrlBar, mViewPositionHolder);
return mViewPositionHolder[0];
} else {
return ApiCompatibilityUtils.isLayoutRtl(this) ? mPhoneUrlBarLeftOffsetRtlPx
......@@ -877,7 +879,8 @@ class SuggestionView extends ViewGroup {
if (mLocationBar == null) return 0;
int leftOffset = getUrlBarLeftOffset();
getLocationInWindow(mViewPositionHolder);
View contentView = getRootView().findViewById(android.R.id.content);
ViewUtils.getRelativeLayoutPosition(contentView, this, mViewPositionHolder);
return leftOffset + mUrlBar.getPaddingLeft() - mViewPositionHolder[0];
}
......@@ -888,7 +891,8 @@ class SuggestionView extends ViewGroup {
if (mLocationBar == null) return 0;
int leftOffset = getUrlBarLeftOffset();
getLocationInWindow(mViewPositionHolder);
View contentView = getRootView().findViewById(android.R.id.content);
ViewUtils.getRelativeLayoutPosition(contentView, this, mViewPositionHolder);
return leftOffset + mUrlBar.getWidth() - mUrlBar.getPaddingRight()
- mViewPositionHolder[0];
}
......
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