Code example for Rect

Methods: offset

0
            boundsInParent.offset(0, (int) mRenderCoordinates.getContentOffsetYPix());
        } 
        node.setBoundsInParent(boundsInParent);
 
        // Now set the absolute rect, which requires several transformations. 
        Rect rect = new Rect(absoluteLeft, absoluteTop, absoluteLeft + width, absoluteTop + height);
 
        // Offset by the scroll position. 
        rect.offset(-(int) mRenderCoordinates.getScrollX(),
                    -(int) mRenderCoordinates.getScrollY());
 
        // Convert CSS (web) pixels to Android View pixels 
        rect.left = (int) mRenderCoordinates.fromLocalCssToPix(rect.left);
        rect.top = (int) mRenderCoordinates.fromLocalCssToPix(rect.top);
        rect.bottom = (int) mRenderCoordinates.fromLocalCssToPix(rect.bottom);
        rect.right = (int) mRenderCoordinates.fromLocalCssToPix(rect.right);
 
        // Offset by the location of the web content within the view. 
        rect.offset(0,
                    (int) mRenderCoordinates.getContentOffsetYPix());
 
        // Finally offset by the location of the view within the screen. 
        final int[] viewLocation = new int[2];
        mView.getLocationOnScreen(viewLocation);
        rect.offset(viewLocation[0], viewLocation[1]);
 
        node.setBoundsInScreen(rect);
    } 
 
    @CalledByNative