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

The following examples show how to use org.chromium.content.browser.ContentViewCore#setCurrentTouchEventOffsets() . 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: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean dispatchDragEvent(DragEvent e) {
    ContentViewCore contentViewCore = mTabVisible.getContentViewCore();
    if (contentViewCore == null) return false;

    if (mLayoutManager != null) mLayoutManager.getViewportPixel(mCacheViewport);
    contentViewCore.setCurrentTouchEventOffsets(-mCacheViewport.left, -mCacheViewport.top);
    boolean ret = super.dispatchDragEvent(e);

    int action = e.getAction();
    if (action == DragEvent.ACTION_DRAG_EXITED || action == DragEvent.ACTION_DRAG_ENDED
            || action == DragEvent.ACTION_DROP) {
        contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f);
    }
    return ret;
}
 
Example 2
Source File: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void setContentViewMotionEventOffsets(MotionEvent e, boolean canClear) {
    // TODO(dtrainor): Factor this out to LayoutDriver.
    if (e == null || mTabVisible == null) return;

    ContentViewCore contentViewCore = mTabVisible.getContentViewCore();
    if (contentViewCore == null) return;

    int actionMasked = e.getActionMasked();

    if (SPenSupport.isSPenSupported(getContext())) {
        actionMasked = SPenSupport.convertSPenEventAction(actionMasked);
    }

    if (actionMasked == MotionEvent.ACTION_DOWN
            || actionMasked == MotionEvent.ACTION_HOVER_ENTER) {
        if (mLayoutManager != null) mLayoutManager.getViewportPixel(mCacheViewport);
        contentViewCore.setCurrentTouchEventOffsets(-mCacheViewport.left, -mCacheViewport.top);
    } else if (canClear && (actionMasked == MotionEvent.ACTION_UP
                                   || actionMasked == MotionEvent.ACTION_CANCEL
                                   || actionMasked == MotionEvent.ACTION_HOVER_EXIT)) {
        contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f);
    }
}
 
Example 3
Source File: CompositorViewHolder.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public boolean dispatchDragEvent(DragEvent e) {
    ContentViewCore contentViewCore = mTabVisible.getContentViewCore();
    if (contentViewCore == null) return false;

    if (mLayoutManager != null) mLayoutManager.getViewportPixel(mCacheViewport);
    contentViewCore.setCurrentTouchEventOffsets(-mCacheViewport.left, -mCacheViewport.top);
    boolean ret = super.dispatchDragEvent(e);

    int action = e.getAction();
    if (action == DragEvent.ACTION_DRAG_EXITED || action == DragEvent.ACTION_DRAG_ENDED
            || action == DragEvent.ACTION_DROP) {
        contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f);
    }
    return ret;
}
 
Example 4
Source File: CompositorViewHolder.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void setContentViewMotionEventOffsets(MotionEvent e, boolean canClear) {
    // TODO(dtrainor): Factor this out to LayoutDriver.
    if (e == null || mTabVisible == null) return;

    ContentViewCore contentViewCore = mTabVisible.getContentViewCore();
    if (contentViewCore == null) return;

    int actionMasked = SPenSupport.convertSPenEventAction(e.getActionMasked());

    if (actionMasked == MotionEvent.ACTION_DOWN
            || actionMasked == MotionEvent.ACTION_HOVER_ENTER) {
        if (mLayoutManager != null) mLayoutManager.getViewportPixel(mCacheViewport);
        contentViewCore.setCurrentTouchEventOffsets(-mCacheViewport.left, -mCacheViewport.top);
    } else if (canClear && (actionMasked == MotionEvent.ACTION_UP
                                   || actionMasked == MotionEvent.ACTION_CANCEL
                                   || actionMasked == MotionEvent.ACTION_HOVER_EXIT)) {
        contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f);
    }
}
 
Example 5
Source File: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the rendering surface parameters of {@code contentViewCore}.  Note that this does
 * not size the actual {@link ContentViewCore}.
 * @param contentViewCore The {@link ContentViewCore} to initialize.
 */
private void initializeContentViewCore(ContentViewCore contentViewCore) {
    contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f);
    contentViewCore.setTopControlsHeight(getTopControlsHeightPixels(),
            contentViewCore.doBrowserControlsShrinkBlinkSize());
    contentViewCore.setBottomControlsHeight(getBottomControlsHeightPixels());

    adjustPhysicalBackingSize(contentViewCore,
            mCompositorView.getWidth(), mCompositorView.getHeight());
}
 
Example 6
Source File: CompositorViewHolder.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the rendering surface parameters of {@code contentViewCore}.  Note that this does
 * not size the actual {@link ContentViewCore}.
 * @param contentViewCore The {@link ContentViewCore} to initialize.
 */
private void initializeContentViewCore(ContentViewCore contentViewCore) {
    contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f);
    contentViewCore.setTopControlsHeight(getTopControlsHeightPixels(),
            contentViewCore.doBrowserControlsShrinkBlinkSize());
    contentViewCore.setBottomControlsHeight(getBottomControlsHeightPixels());

    adjustPhysicalBackingSize(contentViewCore,
            mCompositorView.getWidth(), mCompositorView.getHeight());
}