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

Commit db8f2fc0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix ViewOverlay#onDescendantInvalidated" into oc-dev

parents 781c8cb6 bc44b1a6
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
@@ -5822,34 +5822,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        return null;
    }

    /**
     * Quick invalidation method that simply transforms the dirty rect into the parent's
     * coordinate system, pruning the invalidation if the parent has already been invalidated.
     *
     * @hide
     */
    protected ViewParent damageChildInParent(int left, int top, final Rect dirty) {
        if ((mPrivateFlags & PFLAG_DRAWN) != 0
                || (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) != 0) {
            dirty.offset(left - mScrollX, top - mScrollY);
            if ((mGroupFlags & FLAG_CLIP_CHILDREN) == 0) {
                dirty.union(0, 0, mRight - mLeft, mBottom - mTop);
            }

            if ((mGroupFlags & FLAG_CLIP_CHILDREN) == 0 ||
                    dirty.intersect(0, 0, mRight - mLeft, mBottom - mTop)) {

                if (!getMatrix().isIdentity()) {
                    transformRect(dirty);
                }

                return mParent;
            }
        }

        return null;
    }

    /**
     * Offset a rectangle that is in a descendant's coordinate
     * space into our coordinate space.
+12 −12
Original line number Diff line number Diff line
@@ -330,20 +330,20 @@ public class ViewOverlay {

        @Override
        public void onDescendantInvalidated(@NonNull View child, @NonNull View target) {
            if (mHostView != null && mHostView.getParent() != null) {
                mHostView.getParent().onDescendantInvalidated(mHostView, target);
            }
        }

        /**
         * @hide
         */
        @Override
        protected ViewParent damageChildInParent(int left, int top, Rect dirty) {
            if (mHostView != null) {
                if (mHostView instanceof ViewGroup) {
                return ((ViewGroup) mHostView).damageChildInParent(left, top, dirty);
                    // Propagate invalidate through the host...
                    ((ViewGroup) mHostView).onDescendantInvalidated(mHostView, target);

                    // ...and also this view, since it will hold the descendant, and must later
                    // propagate the calls to update display lists if dirty
                    super.onDescendantInvalidated(child, target);
                } else {
                    // Can't use onDescendantInvalidated because host isn't a ViewGroup - fall back
                    // to invalidating.
                    invalidate();
                }
            }
            return null;
        }

        @Override