@@ -1484,7 +1484,21 @@ public int getVisibleTitleHeight() {
14841484 private int getVisibleTitleHeightImpl() {
14851485 // need to restrict mScrollY due to over scroll
14861486 return Math.max(getTitleHeight() - Math.max(0, mScrollY),
1487- mFindCallback != null ? mFindCallback.getActionModeHeight() : 0);
1487+ getOverlappingActionModeHeight());
1488+ }
1489+
1490+ private int mCachedOverlappingActionModeHeight = -1;
1491+
1492+ private int getOverlappingActionModeHeight() {
1493+ if (mFindCallback == null) {
1494+ return 0;
1495+ }
1496+ if (mCachedOverlappingActionModeHeight < 0) {
1497+ getGlobalVisibleRect(mGlobalVisibleRect, mGlobalVisibleOffset);
1498+ mCachedOverlappingActionModeHeight = Math.max(0,
1499+ mFindCallback.getActionModeGlobalBottom() - mGlobalVisibleRect.top);
1500+ }
1501+ return mCachedOverlappingActionModeHeight;
14881502 }
14891503
14901504 /*
@@ -3375,6 +3389,7 @@ public boolean showFindDialog(String text, boolean showIme) {
33753389 // Could not start the action mode, so end Find on page
33763390 return false;
33773391 }
3392+ mCachedOverlappingActionModeHeight = -1;
33783393 mFindCallback = callback;
33793394 setFindIsUp(true);
33803395 mFindCallback.setWebView(this);
@@ -3492,6 +3507,7 @@ public void clearMatches() {
34923507 */
34933508 void notifyFindDialogDismissed() {
34943509 mFindCallback = null;
3510+ mCachedOverlappingActionModeHeight = -1;
34953511 if (mWebViewCore == null) {
34963512 return;
34973513 }
@@ -4341,6 +4357,7 @@ boolean selectText(int x, int y) {
43414357
43424358 @Override
43434359 protected void onConfigurationChanged(Configuration newConfig) {
4360+ mCachedOverlappingActionModeHeight = -1;
43444361 if (mSelectingText && mOrientation != newConfig.orientation) {
43454362 selectionDone();
43464363 }
0 commit comments