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

Commit adb89214 authored by Doris Liu's avatar Doris Liu
Browse files

Clean up calls to Rect.intersect()

This CL checks for the return value for Rect.intersect() for whether
there is actually an intersection before taking the return intersected
rect. In the case of no intersection (Rect.intersect() returns false),
an empty rect will be used as the intersection.

bug: 7368679
Change-Id: Ibda3bfd662f8ca83cb5662748d9be250243b72b2
parent 63428ccd
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -46,7 +46,10 @@ class AccessibilityNodeInfoHelper {
        displayRect.right = width;
        displayRect.bottom = height;

        nodeRect.intersect(displayRect);
        if (nodeRect.intersect(displayRect)) {
            return nodeRect;
        } else {
            return new Rect();
        }
    }
}
+6 −2
Original line number Diff line number Diff line
@@ -353,8 +353,12 @@ public class UiObject {
        Rect parentRect = AccessibilityNodeInfoHelper
                .getVisibleBoundsInScreen(scrollableParentNode, w, h);
        // adjust for partial clipping of targeted by parent node if required
        nodeRect.intersect(parentRect);
        if (nodeRect.intersect(parentRect)) {
            return nodeRect;
        } else {
            // Node rect has no intersection with parent Rect
            return new Rect();
        }
    }

    /**