Commit 4abbf57b authored by Amirhossein Simjour's avatar Amirhossein Simjour Committed by Commit Bot

Refresh Rect bounds when WindowCoordinate < 0

When the View is partially outside of the Window, the rectangle
bounds should be recalculated with the assumption that the View
is started from the edges.
This will make sure that Autofill popup shows up on top/bottom
of the correct input field, when input fields doesn't fit inside
the Window.

Bug: 828759
Change-Id: I253fc9febe93e90058f95923a18cdfe5363d2186
Reviewed-on: https://chromium-review.googlesource.com/1044529Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Amirhossein Simjour <asimjour@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557953}
parent 0361c3ce
...@@ -110,8 +110,8 @@ public class ViewRectProvider extends RectProvider ...@@ -110,8 +110,8 @@ public class ViewRectProvider extends RectProvider
int previousPositionY = mCachedWindowCoordinates[1]; int previousPositionY = mCachedWindowCoordinates[1];
mView.getLocationInWindow(mCachedWindowCoordinates); mView.getLocationInWindow(mCachedWindowCoordinates);
// Return if the window position is invalid. mCachedWindowCoordinates[0] = Math.max(mCachedWindowCoordinates[0], 0);
if (mCachedWindowCoordinates[0] < 0 || mCachedWindowCoordinates[1] < 0) return; mCachedWindowCoordinates[1] = Math.max(mCachedWindowCoordinates[1], 0);
// Return if the window coordinates haven't changed. // Return if the window coordinates haven't changed.
if (mCachedWindowCoordinates[0] == previousPositionX if (mCachedWindowCoordinates[0] == previousPositionX
...@@ -144,6 +144,9 @@ public class ViewRectProvider extends RectProvider ...@@ -144,6 +144,9 @@ public class ViewRectProvider extends RectProvider
mRect.right = Math.max(mRect.left, mRect.right); mRect.right = Math.max(mRect.left, mRect.right);
mRect.bottom = Math.max(mRect.top, mRect.bottom); mRect.bottom = Math.max(mRect.top, mRect.bottom);
mRect.right = Math.min(mRect.right, mView.getRootView().getWidth());
mRect.bottom = Math.min(mRect.bottom, mView.getRootView().getHeight());
notifyRectChanged(); notifyRectChanged();
} }
} }
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