Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16205073 authored by George Mount's avatar George Mount Committed by Android Git Automerger
Browse files

am 37f29abe: Merge "DO NOT MERGE Consider current scroll position to move text...

am 37f29abe: Merge "DO NOT MERGE Consider current scroll position to move text field into view." into jb-dev

* commit '37f29abe':
  DO NOT MERGE Consider current scroll position to move text field into view.
parents 5e556e60 37f29abe
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -5504,8 +5504,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        if (visibleRect.contains(mEditTextContentBounds)) {
            return; // no need to scroll
        }
        nativeFindMaxVisibleRect(mNativeClass, mEditTextLayerId, visibleRect);
        syncSelectionCursors();
        nativeFindMaxVisibleRect(mNativeClass, mEditTextLayerId, visibleRect);
        final int buffer = Math.max(1, viewToContentDimension(EDIT_RECT_BUFFER));
        Rect showRect = new Rect(
                Math.max(0, mEditTextContentBounds.left - buffer),
@@ -5538,17 +5538,19 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
            return; // no need to scroll
        }

        int scrollX = visibleRect.left;
        int scrollX = viewToContentX(getScrollX());
        if (visibleRect.left > showRect.left) {
            scrollX = showRect.left;
            // We are scrolled too far
            scrollX += showRect.left - visibleRect.left;
        } else if (visibleRect.right < showRect.right) {
            scrollX = Math.max(0, showRect.right - visibleRect.width());
            // We aren't scrolled enough to include the right
            scrollX += showRect.right - visibleRect.right;
        }
        int scrollY = visibleRect.top;
        int scrollY = viewToContentY(getScrollY());
        if (visibleRect.top > showRect.top) {
            scrollY = showRect.top;
            scrollY += showRect.top - visibleRect.top;
        } else if (visibleRect.bottom < showRect.bottom) {
            scrollY = Math.max(0, showRect.bottom - visibleRect.height());
            scrollY += showRect.bottom - visibleRect.bottom;
        }

        contentScrollTo(scrollX, scrollY, false);