Skip to content

Commit 25d888b

Browse files
jreckAndroid (Google) Code Review
authored andcommitted
Merge "Fix calc visible to account for action bar"
2 parents cf6bc99 + fffce6f commit 25d888b

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

core/java/android/webkit/FindActionModeCallback.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@
2222
import android.text.Selection;
2323
import android.text.Spannable;
2424
import android.text.TextWatcher;
25-
import android.webkit.WebView;
26-
import android.widget.EditText;
27-
import android.widget.TextView;
2825
import android.view.ActionMode;
2926
import android.view.LayoutInflater;
3027
import android.view.Menu;
31-
import android.view.MenuInflater;
3228
import android.view.MenuItem;
3329
import android.view.View;
3430
import android.view.inputmethod.InputMethodManager;
31+
import android.widget.EditText;
32+
import android.widget.TextView;
3533

3634
class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
3735
View.OnLongClickListener, View.OnClickListener {
@@ -203,6 +201,7 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
203201

204202
@Override
205203
public void onDestroyActionMode(ActionMode mode) {
204+
mActionMode = null;
206205
mWebView.notifyFindDialogDismissed();
207206
mInput.hideSoftInputFromWindow(mWebView.getWindowToken(), 0);
208207
}
@@ -255,4 +254,13 @@ public void afterTextChanged(Editable s) {
255254
// Does nothing. Needed to implement TextWatcher.
256255
}
257256

257+
public int getActionModeHeight() {
258+
if (mActionMode == null) {
259+
return 0;
260+
}
261+
View parent = (View) mCustomView.getParent();
262+
return parent != null ? parent.getMeasuredHeight()
263+
: mCustomView.getMeasuredHeight();
264+
}
265+
258266
}

core/java/android/webkit/WebView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,8 @@ public int getVisibleTitleHeight() {
14831483

14841484
private int getVisibleTitleHeightImpl() {
14851485
// need to restrict mScrollY due to over scroll
1486-
return Math.max(getTitleHeight() - Math.max(0, mScrollY), 0);
1486+
return Math.max(getTitleHeight() - Math.max(0, mScrollY),
1487+
mFindCallback != null ? mFindCallback.getActionModeHeight() : 0);
14871488
}
14881489

14891490
/*

0 commit comments

Comments
 (0)