| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.res.Configuration; | 9 import android.content.res.Configuration; |
| 10 import android.graphics.Canvas; | 10 import android.graphics.Canvas; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 @Override | 242 @Override |
| 243 public boolean onTouchEvent(MotionEvent event) { | 243 public boolean onTouchEvent(MotionEvent event) { |
| 244 if (mContentViewCore == null) return false; | 244 if (mContentViewCore == null) return false; |
| 245 // Convert from PopupWindow local coordinates to | 245 // Convert from PopupWindow local coordinates to |
| 246 // parent view local coordinates prior to forwarding. | 246 // parent view local coordinates prior to forwarding. |
| 247 mContentViewCore.getContainerView().getLocationOnScreen(mTempScreenCoord
s); | 247 mContentViewCore.getContainerView().getLocationOnScreen(mTempScreenCoord
s); |
| 248 final float offsetX = event.getRawX() - event.getX() - mTempScreenCoords
[0]; | 248 final float offsetX = event.getRawX() - event.getX() - mTempScreenCoords
[0]; |
| 249 final float offsetY = event.getRawY() - event.getY() - mTempScreenCoords
[1]; | 249 final float offsetY = event.getRawY() - event.getY() - mTempScreenCoords
[1]; |
| 250 final MotionEvent offsetEvent = MotionEvent.obtainNoHistory(event); | 250 final MotionEvent offsetEvent = MotionEvent.obtainNoHistory(event); |
| 251 offsetEvent.offsetLocation(offsetX, offsetY); | 251 offsetEvent.offsetLocation(offsetX, offsetY); |
| 252 final boolean handled = mContentViewCore.onTouchHandleEvent(offsetEvent)
; | 252 final boolean handled = |
| 253 mContentViewCore.getWebContents().getEventHandler().onTouchHandl
eEvent(offsetEvent); |
| 253 offsetEvent.recycle(); | 254 offsetEvent.recycle(); |
| 254 return handled; | 255 return handled; |
| 255 } | 256 } |
| 256 | 257 |
| 257 @CalledByNative | 258 @CalledByNative |
| 258 private void setOrientation(int orientation, boolean mirrorVertical, boolean
mirrorHorizontal) { | 259 private void setOrientation(int orientation, boolean mirrorVertical, boolean
mirrorHorizontal) { |
| 259 assert (orientation >= TouchHandleOrientation.LEFT | 260 assert (orientation >= TouchHandleOrientation.LEFT |
| 260 && orientation <= TouchHandleOrientation.UNDEFINED); | 261 && orientation <= TouchHandleOrientation.UNDEFINED); |
| 261 | 262 |
| 262 final boolean orientationChanged = mOrientation != orientation; | 263 final boolean orientationChanged = mOrientation != orientation; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 // must be updated accordingly. | 625 // must be updated accordingly. |
| 625 mParentPositionObserver.clearListener(); | 626 mParentPositionObserver.clearListener(); |
| 626 mParentPositionObserver = new ViewPositionObserver(newContainerView); | 627 mParentPositionObserver = new ViewPositionObserver(newContainerView); |
| 627 if (mContainer.isShowing()) { | 628 if (mContainer.isShowing()) { |
| 628 mParentPositionObserver.addListener(mParentPositionListener); | 629 mParentPositionObserver.addListener(mParentPositionListener); |
| 629 } | 630 } |
| 630 } | 631 } |
| 631 | 632 |
| 632 private native long nativeInit(float horizontalPaddingRatio); | 633 private native long nativeInit(float horizontalPaddingRatio); |
| 633 } | 634 } |
| OLD | NEW |