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

Commit 52db2456 authored by Haoyu Zhang's avatar Haoyu Zhang Committed by Android (Google) Code Review
Browse files

Merge "Fix TextView#getEditorAndHandwritingBounds used wrong matrix" into main

parents 18a7d247 97cc132f
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -27376,6 +27376,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * Modifiers the input matrix such that it maps root view's coordinates to view-local
     * coordinates.
     *
     * @param matrix input matrix to modify
     * @hide
     */
    public void transformMatrixRootToLocal(@NonNull Matrix matrix) {
        final ViewParent parent = mParent;
        if (parent instanceof final View vp) {
            vp.transformMatrixRootToLocal(matrix);
            matrix.postTranslate(vp.mScrollX, vp.mScrollY);
        }
        // This method is different from transformMatrixToLocal that it doesn't perform any
        // transformation for ViewRootImpl
        matrix.postTranslate(-mLeft, -mTop);
        if (!hasIdentityMatrix()) {
            matrix.postConcat(getInverseMatrix());
        }
    }
    /**
     * @hide
     */
+1 −1
Original line number Diff line number Diff line
@@ -14375,7 +14375,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        Matrix matrix = mTempMatrix;
        matrix.reset();
        transformMatrixToLocal(matrix);
        transformMatrixRootToLocal(matrix);
        editorBounds.set(rect);
        // When the view has transformations like scaleX/scaleY computing the global visible
        // rectangle will already apply the transformations. The getLocalVisibleRect only offsets