am 36a7f2a9: Merge "Fix determining find on page overlap" into ics-mr1
* commit '36a7f2a9adfa21ec31f00d496fef82e68931c860': Fix determining find on page overlap
This commit is contained in:
@@ -18,6 +18,8 @@ package android.webkit;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Selection;
|
import android.text.Selection;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
@@ -254,13 +256,18 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
|
|||||||
// Does nothing. Needed to implement TextWatcher.
|
// Does nothing. Needed to implement TextWatcher.
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getActionModeHeight() {
|
private Rect mGlobalVisibleRect = new Rect();
|
||||||
|
private Point mGlobalVisibleOffset = new Point();
|
||||||
|
public int getActionModeGlobalBottom() {
|
||||||
if (mActionMode == null) {
|
if (mActionMode == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
View parent = (View) mCustomView.getParent();
|
View view = (View) mCustomView.getParent();
|
||||||
return parent != null ? parent.getMeasuredHeight()
|
if (view == null) {
|
||||||
: mCustomView.getMeasuredHeight();
|
view = mCustomView;
|
||||||
|
}
|
||||||
|
view.getGlobalVisibleRect(mGlobalVisibleRect, mGlobalVisibleOffset);
|
||||||
|
return mGlobalVisibleRect.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1484,7 +1484,21 @@ public class WebView extends AbsoluteLayout
|
|||||||
private int getVisibleTitleHeightImpl() {
|
private int getVisibleTitleHeightImpl() {
|
||||||
// need to restrict mScrollY due to over scroll
|
// need to restrict mScrollY due to over scroll
|
||||||
return Math.max(getTitleHeight() - Math.max(0, mScrollY),
|
return Math.max(getTitleHeight() - Math.max(0, mScrollY),
|
||||||
mFindCallback != null ? mFindCallback.getActionModeHeight() : 0);
|
getOverlappingActionModeHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
private int mCachedOverlappingActionModeHeight = -1;
|
||||||
|
|
||||||
|
private int getOverlappingActionModeHeight() {
|
||||||
|
if (mFindCallback == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (mCachedOverlappingActionModeHeight < 0) {
|
||||||
|
getGlobalVisibleRect(mGlobalVisibleRect, mGlobalVisibleOffset);
|
||||||
|
mCachedOverlappingActionModeHeight = Math.max(0,
|
||||||
|
mFindCallback.getActionModeGlobalBottom() - mGlobalVisibleRect.top);
|
||||||
|
}
|
||||||
|
return mCachedOverlappingActionModeHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3375,6 +3389,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
// Could not start the action mode, so end Find on page
|
// Could not start the action mode, so end Find on page
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
mCachedOverlappingActionModeHeight = -1;
|
||||||
mFindCallback = callback;
|
mFindCallback = callback;
|
||||||
setFindIsUp(true);
|
setFindIsUp(true);
|
||||||
mFindCallback.setWebView(this);
|
mFindCallback.setWebView(this);
|
||||||
@@ -3492,6 +3507,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
*/
|
*/
|
||||||
void notifyFindDialogDismissed() {
|
void notifyFindDialogDismissed() {
|
||||||
mFindCallback = null;
|
mFindCallback = null;
|
||||||
|
mCachedOverlappingActionModeHeight = -1;
|
||||||
if (mWebViewCore == null) {
|
if (mWebViewCore == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4341,6 +4357,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
mCachedOverlappingActionModeHeight = -1;
|
||||||
if (mSelectingText && mOrientation != newConfig.orientation) {
|
if (mSelectingText && mOrientation != newConfig.orientation) {
|
||||||
selectionDone();
|
selectionDone();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user