Java Code Examples for org.chromium.content.browser.ContentViewCore#getRenderCoordinates()

The following examples show how to use org.chromium.content.browser.ContentViewCore#getRenderCoordinates() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValidationMessageBubble.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * This adjusts the position if the popup protrudes the web view.
 */
private Point adjustWindowPosition(ContentViewCore contentViewCore, int x, int y) {
    final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
    final int viewWidth = coordinates.getLastFrameViewportWidthPixInt();
    final int viewBottom = (int) getWebViewOffsetYPixInScreen(contentViewCore)
            + coordinates.getLastFrameViewportHeightPixInt();
    final int width = mPopup.getContentView().getMeasuredWidth();
    final int height = mPopup.getContentView().getMeasuredHeight();
    if (x < 0) {
        x = 0;
    } else if (x + width > viewWidth) {
        x = viewWidth - width;
    }
    if (y + height > viewBottom) {
        y = viewBottom - height;
    }
    return new Point(x, y);
}
 
Example 2
Source File: ValidationMessageBubble.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * This adjusts the position if the popup protrudes the web view.
 */
private Point adjustWindowPosition(ContentViewCore contentViewCore, int x, int y) {
    final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
    final int viewWidth = coordinates.getLastFrameViewportWidthPixInt();
    final int viewBottom = (int) getWebViewOffsetYPixInScreen(contentViewCore) +
            coordinates.getLastFrameViewportHeightPixInt();
    final int width = mPopup.getContentView().getMeasuredWidth();
    final int height = mPopup.getContentView().getMeasuredHeight();
    if (x < 0) {
        x = 0;
    } else if (x + width > viewWidth) {
        x = viewWidth - width;
    }
    if (y + height > viewBottom) {
        y = viewBottom - height;
    }
    return new Point(x, y);
}
 
Example 3
Source File: ValidationMessageBubble.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * This adjusts the position if the popup protrudes the web view.
 */
private Point adjustWindowPosition(ContentViewCore contentViewCore, int x, int y) {
    final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
    final int viewWidth = coordinates.getLastFrameViewportWidthPixInt();
    final int viewBottom = (int) getWebViewOffsetYPixInScreen(contentViewCore) +
            coordinates.getLastFrameViewportHeightPixInt();
    final int width = mPopup.getContentView().getMeasuredWidth();
    final int height = mPopup.getContentView().getMeasuredHeight();
    if (x < 0) {
        x = 0;
    } else if (x + width > viewWidth) {
        x = viewWidth - width;
    }
    if (y + height > viewBottom) {
        y = viewBottom - height;
    }
    return new Point(x, y);
}
 
Example 4
Source File: ValidationMessageBubble.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private static RectF makePixRectInScreen(ContentViewCore contentViewCore,
        int anchorX, int anchorY, int anchorWidth, int anchorHeight) {
    final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
    final float yOffset = getWebViewOffsetYPixInScreen(contentViewCore);
    return new RectF(
            coordinates.fromLocalCssToPix(anchorX),
            coordinates.fromLocalCssToPix(anchorY) + yOffset,
            coordinates.fromLocalCssToPix(anchorX + anchorWidth),
            coordinates.fromLocalCssToPix(anchorY + anchorHeight) + yOffset);
}
 
Example 5
Source File: ValidationMessageBubble.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static RectF makePixRectInScreen(ContentViewCore contentViewCore,
        int anchorX, int anchorY, int anchorWidth, int anchorHeight) {
    final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
    final float yOffset = getWebViewOffsetYPixInScreen(contentViewCore);
    return new RectF(
            coordinates.fromLocalCssToPix(anchorX),
            coordinates.fromLocalCssToPix(anchorY) + yOffset,
            coordinates.fromLocalCssToPix(anchorX + anchorWidth),
            coordinates.fromLocalCssToPix(anchorY + anchorHeight) + yOffset);
}
 
Example 6
Source File: ValidationMessageBubble.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static RectF makePixRectInScreen(ContentViewCore contentViewCore,
        int anchorX, int anchorY, int anchorWidth, int anchorHeight) {
    final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
    final float yOffset = getWebViewOffsetYPixInScreen(contentViewCore);
    return new RectF(
            coordinates.fromLocalCssToPix(anchorX),
            coordinates.fromLocalCssToPix(anchorY) + yOffset,
            coordinates.fromLocalCssToPix(anchorX + anchorWidth),
            coordinates.fromLocalCssToPix(anchorY + anchorHeight) + yOffset);
}